From 8380c6e953a15347b40f2c5c4cc57c2daa8b8c63 Mon Sep 17 00:00:00 2001 From: oetiker Date: Mon, 9 Jun 2008 05:12:27 +0000 Subject: [PATCH] fixed indenting git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1419 a5681a0c-68f1-0310-ab6d-d61299d08faa --- bindings/python/rrdtoolmodule.c | 4 +- src/pngsize.c | 6 +- src/rrd.h | 6 +- src/rrd_error.c | 15 ++-- src/rrd_graph.h | 4 +- src/rrd_info.c | 131 +++++++++++++++++--------------- src/rrd_open.c | 5 +- src/rrd_parsetime.c | 14 ++-- src/rrd_tool.c | 2 +- src/rrd_update.c | 30 ++++---- 10 files changed, 112 insertions(+), 105 deletions(-) diff --git a/bindings/python/rrdtoolmodule.c b/bindings/python/rrdtoolmodule.c index 109d66f..1b85f96 100644 --- a/bindings/python/rrdtoolmodule.c +++ b/bindings/python/rrdtoolmodule.c @@ -220,7 +220,7 @@ static PyObject *PyRRD_fetch( for (i = 0; i < ds_cnt; i++) rrd_freemem(ds_namv[i]); - rrd_freemem(ds_namv); /* rrdtool don't use PyMem_Malloc :) */ + rrd_freemem(ds_namv); /* rrdtool don't use PyMem_Malloc :) */ rrd_freemem(data); } @@ -404,7 +404,7 @@ static PyObject *PyRRD_resize( } static PyObject *PyDict_FromInfo( - rrd_info_t *data) + rrd_info_t * data) { PyObject *r; diff --git a/src/pngsize.c b/src/pngsize.c index 1a7b437..5cac36c 100644 --- a/src/pngsize.c +++ b/src/pngsize.c @@ -31,9 +31,9 @@ int PngSize( #ifdef PNG_SETJMP_SUPPORTED # define png_jmpbuf(png_ptr) ((png_ptr)->PNG_jmpbuf) #else -#ifdef jmpbuf -#undef jmpbuf -#endif +#ifdef jmpbuf +#undef jmpbuf +#endif # define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) #endif #endif diff --git a/src/rrd.h b/src/rrd.h index fc3efd6..dc1569e 100644 --- a/src/rrd.h +++ b/src/rrd.h @@ -128,7 +128,7 @@ extern "C" { rrd_info_type_t, rrd_infoval_t); void rrd_info_print( - rrd_info_t *data); + rrd_info_t * data); void rrd_info_free( rrd_info_t *); int rrd_update( @@ -249,7 +249,7 @@ extern "C" { char *rrd_parsetime( const char *spec, - rrd_time_value_t *ptv); + rrd_time_value_t * ptv); /* END rrd_parsetime.h */ typedef struct rrd_context { @@ -289,7 +289,7 @@ extern "C" { rrd_context_t *rrd_new_context( void); void rrd_free_context( - rrd_context_t *buf); + rrd_context_t * buf); /* void rrd_set_error_r (rrd_context_t *, char *, ...); */ /* void rrd_clear_error_r(rrd_context_t *); */ diff --git a/src/rrd_error.c b/src/rrd_error.c index 175a766..722a185 100644 --- a/src/rrd_error.c +++ b/src/rrd_error.c @@ -78,7 +78,7 @@ char *rrd_get_error( context. Using these functions would require to change each and every function containing any of the non _r versions... */ void rrd_set_error_r( - rrd_context_t *rrd_ctx, + rrd_context_t * rrd_ctx, char *fmt, ...) { @@ -96,19 +96,19 @@ void rrd_set_error_r( } int rrd_test_error_r( - rrd_context_t *rrd_ctx) + rrd_context_t * rrd_ctx) { return rrd_ctx->rrd_error[0] != '\0'; } void rrd_clear_error_r( - rrd_context_t *rrd_ctx) + rrd_context_t * rrd_ctx) { rrd_ctx->rrd_error[0] = '\0'; } char *rrd_get_error_r( - rrd_context_t *rrd_ctx) + rrd_context_t * rrd_ctx) { return rrd_ctx->rrd_error; } @@ -119,8 +119,7 @@ char *rrd_get_error_r( rrd_context_t *rrd_new_context( void) { - rrd_context_t *rrd_ctx = - (rrd_context_t *) malloc(sizeof(rrd_context_t)); + rrd_context_t *rrd_ctx = (rrd_context_t *) malloc(sizeof(rrd_context_t)); if (!rrd_ctx) { return NULL; @@ -132,7 +131,7 @@ rrd_context_t *rrd_new_context( } void rrd_free_context( - rrd_context_t *rrd_ctx) + rrd_context_t * rrd_ctx) { if (rrd_ctx) { free(rrd_ctx); @@ -141,7 +140,7 @@ void rrd_free_context( #if 0 void rrd_globalize_error( - rrd_context_t *rrd_ctx) + rrd_context_t * rrd_ctx) { if (rrd_ctx) { rrd_set_error(rrd_ctx->rrd_error); diff --git a/src/rrd_graph.h b/src/rrd_graph.h index 1b45284..2b1c05b 100644 --- a/src/rrd_graph.h +++ b/src/rrd_graph.h @@ -244,8 +244,8 @@ typedef struct image_desc_t { cairo_font_options_t *font_options; /* cairo font options */ cairo_antialias_t graph_antialias; /* antialiasing for the graph */ - rrd_info_t *grinfo; /* root pointer to extra graph info */ - rrd_info_t *grinfo_current; /* pointing to current entry */ + rrd_info_t *grinfo; /* root pointer to extra graph info */ + rrd_info_t *grinfo_current; /* pointing to current entry */ } image_desc_t; /* Prototypes */ diff --git a/src/rrd_info.c b/src/rrd_info.c index 257219a..0577cc0 100644 --- a/src/rrd_info.c +++ b/src/rrd_info.c @@ -39,11 +39,8 @@ char *sprintf_alloc( /* the function formerly known as push was renamed to info_push and later * rrd_info_push because it is now used outside the scope of this file */ rrd_info_t - *rrd_info_push( - rrd_info_t *info, - char *key, - rrd_info_type_t type, - rrd_infoval_t value) + * rrd_info_push(rrd_info_t * info, + char *key, rrd_info_type_t type, rrd_infoval_t value) { rrd_info_t *next; @@ -101,7 +98,7 @@ rrd_info_t *rrd_info_r( { unsigned int i, ii = 0; rrd_t rrd; - rrd_info_t *data = NULL, *cd; + rrd_info_t *data = NULL, *cd; rrd_infoval_t info; rrd_file_t *rrd_file; enum cf_en current_cf; @@ -128,8 +125,8 @@ rrd_info_t *rrd_info_r( info.u_str = rrd.ds_def[i].dst; cd = rrd_info_push(cd, sprintf_alloc("ds[%s].type", - rrd.ds_def[i].ds_nam), - RD_I_STR, info); + rrd.ds_def[i].ds_nam), + RD_I_STR, info); current_ds = dst_conv(rrd.ds_def[i].dst); switch (current_ds) { @@ -141,105 +138,114 @@ rrd_info_t *rrd_info_r( rrd.ds_def, &buffer); info.u_str = buffer; cd = rrd_info_push(cd, - sprintf_alloc("ds[%s].cdef", rrd.ds_def[i].ds_nam), - RD_I_STR, info); + sprintf_alloc("ds[%s].cdef", + rrd.ds_def[i].ds_nam), RD_I_STR, + info); free(buffer); } break; default: info.u_cnt = rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt; cd = rrd_info_push(cd, - sprintf_alloc("ds[%s].minimal_heartbeat", - rrd.ds_def[i].ds_nam), RD_I_CNT, - info); + sprintf_alloc("ds[%s].minimal_heartbeat", + rrd.ds_def[i].ds_nam), RD_I_CNT, + info); info.u_val = rrd.ds_def[i].par[DS_min_val].u_val; cd = rrd_info_push(cd, - sprintf_alloc("ds[%s].min", rrd.ds_def[i].ds_nam), - RD_I_VAL, info); + sprintf_alloc("ds[%s].min", + rrd.ds_def[i].ds_nam), RD_I_VAL, + info); info.u_val = rrd.ds_def[i].par[DS_max_val].u_val; cd = rrd_info_push(cd, - sprintf_alloc("ds[%s].max", rrd.ds_def[i].ds_nam), - RD_I_VAL, info); + sprintf_alloc("ds[%s].max", + rrd.ds_def[i].ds_nam), RD_I_VAL, + info); break; } info.u_str = rrd.pdp_prep[i].last_ds; cd = rrd_info_push(cd, - sprintf_alloc("ds[%s].last_ds", rrd.ds_def[i].ds_nam), - RD_I_STR, info); + sprintf_alloc("ds[%s].last_ds", + rrd.ds_def[i].ds_nam), RD_I_STR, + info); info.u_val = rrd.pdp_prep[i].scratch[PDP_val].u_val; cd = rrd_info_push(cd, - sprintf_alloc("ds[%s].value", rrd.ds_def[i].ds_nam), - RD_I_VAL, info); + sprintf_alloc("ds[%s].value", + rrd.ds_def[i].ds_nam), RD_I_VAL, + info); info.u_cnt = rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt; cd = rrd_info_push(cd, - sprintf_alloc("ds[%s].unknown_sec", - rrd.ds_def[i].ds_nam), RD_I_CNT, info); + sprintf_alloc("ds[%s].unknown_sec", + rrd.ds_def[i].ds_nam), RD_I_CNT, + info); } for (i = 0; i < rrd.stat_head->rra_cnt; i++) { info.u_str = rrd.rra_def[i].cf_nam; - cd = rrd_info_push(cd, sprintf_alloc("rra[%d].cf", i), RD_I_STR, info); + cd = rrd_info_push(cd, sprintf_alloc("rra[%d].cf", i), RD_I_STR, + info); current_cf = cf_conv(rrd.rra_def[i].cf_nam); info.u_cnt = rrd.rra_def[i].row_cnt; - cd = rrd_info_push(cd, sprintf_alloc("rra[%d].rows", i), RD_I_CNT, info); + cd = rrd_info_push(cd, sprintf_alloc("rra[%d].rows", i), RD_I_CNT, + info); info.u_cnt = rrd.rra_ptr[i].cur_row; cd = rrd_info_push(cd, sprintf_alloc("rra[%d].cur_row", i), RD_I_CNT, - info); + info); info.u_cnt = rrd.rra_def[i].pdp_cnt; - cd = rrd_info_push(cd, sprintf_alloc("rra[%d].pdp_per_row", i), RD_I_CNT, - info); + cd = rrd_info_push(cd, sprintf_alloc("rra[%d].pdp_per_row", i), + RD_I_CNT, info); switch (current_cf) { case CF_HWPREDICT: case CF_MHWPREDICT: info.u_val = rrd.rra_def[i].par[RRA_hw_alpha].u_val; - cd = rrd_info_push(cd, sprintf_alloc("rra[%d].alpha", i), RD_I_VAL, - info); + cd = rrd_info_push(cd, sprintf_alloc("rra[%d].alpha", i), + RD_I_VAL, info); info.u_val = rrd.rra_def[i].par[RRA_hw_beta].u_val; cd = rrd_info_push(cd, sprintf_alloc("rra[%d].beta", i), RD_I_VAL, - info); + info); break; case CF_SEASONAL: case CF_DEVSEASONAL: info.u_val = rrd.rra_def[i].par[RRA_seasonal_gamma].u_val; - cd = rrd_info_push(cd, sprintf_alloc("rra[%d].gamma", i), RD_I_VAL, - info); + cd = rrd_info_push(cd, sprintf_alloc("rra[%d].gamma", i), + RD_I_VAL, info); if (atoi(rrd.stat_head->version) >= 4) { info.u_val = rrd.rra_def[i].par[RRA_seasonal_smoothing_window].u_val; cd = rrd_info_push(cd, - sprintf_alloc("rra[%d].smoothing_window", i), - RD_I_VAL, info); + sprintf_alloc("rra[%d].smoothing_window", + i), RD_I_VAL, info); } break; case CF_FAILURES: info.u_val = rrd.rra_def[i].par[RRA_delta_pos].u_val; cd = rrd_info_push(cd, sprintf_alloc("rra[%d].delta_pos", i), - RD_I_VAL, info); + RD_I_VAL, info); info.u_val = rrd.rra_def[i].par[RRA_delta_neg].u_val; cd = rrd_info_push(cd, sprintf_alloc("rra[%d].delta_neg", i), - RD_I_VAL, info); + RD_I_VAL, info); info.u_cnt = rrd.rra_def[i].par[RRA_failure_threshold].u_cnt; - cd = rrd_info_push(cd, sprintf_alloc("rra[%d].failure_threshold", i), - RD_I_CNT, info); + cd = rrd_info_push(cd, + sprintf_alloc("rra[%d].failure_threshold", i), + RD_I_CNT, info); info.u_cnt = rrd.rra_def[i].par[RRA_window_len].u_cnt; cd = rrd_info_push(cd, sprintf_alloc("rra[%d].window_length", i), - RD_I_CNT, info); + RD_I_CNT, info); break; case CF_DEVPREDICT: break; default: info.u_val = rrd.rra_def[i].par[RRA_cdp_xff_val].u_val; cd = rrd_info_push(cd, sprintf_alloc("rra[%d].xff", i), RD_I_VAL, - info); + info); break; } @@ -251,36 +257,40 @@ rrd_info_t *rrd_info_r( rrd.cdp_prep[i * rrd.stat_head->ds_cnt + ii].scratch[CDP_hw_intercept].u_val; cd = rrd_info_push(cd, - sprintf_alloc("rra[%d].cdp_prep[%d].intercept", - i, ii), RD_I_VAL, info); + sprintf_alloc + ("rra[%d].cdp_prep[%d].intercept", i, ii), + RD_I_VAL, info); info.u_val = rrd.cdp_prep[i * rrd.stat_head->ds_cnt + ii].scratch[CDP_hw_slope].u_val; cd = rrd_info_push(cd, - sprintf_alloc("rra[%d].cdp_prep[%d].slope", i, - ii), RD_I_VAL, info); + sprintf_alloc("rra[%d].cdp_prep[%d].slope", + i, ii), RD_I_VAL, info); info.u_cnt = rrd.cdp_prep[i * rrd.stat_head->ds_cnt + ii].scratch[CDP_null_count].u_cnt; cd = rrd_info_push(cd, - sprintf_alloc("rra[%d].cdp_prep[%d].NaN_count", - i, ii), RD_I_CNT, info); + sprintf_alloc + ("rra[%d].cdp_prep[%d].NaN_count", i, ii), + RD_I_CNT, info); break; case CF_SEASONAL: info.u_val = rrd.cdp_prep[i * rrd.stat_head->ds_cnt + ii].scratch[CDP_hw_seasonal].u_val; cd = rrd_info_push(cd, - sprintf_alloc("rra[%d].cdp_prep[%d].seasonal", - i, ii), RD_I_VAL, info); + sprintf_alloc + ("rra[%d].cdp_prep[%d].seasonal", i, ii), + RD_I_VAL, info); break; case CF_DEVSEASONAL: info.u_val = rrd.cdp_prep[i * rrd.stat_head->ds_cnt + ii].scratch[CDP_seasonal_deviation].u_val; cd = rrd_info_push(cd, - sprintf_alloc("rra[%d].cdp_prep[%d].deviation", - i, ii), RD_I_VAL, info); + sprintf_alloc + ("rra[%d].cdp_prep[%d].deviation", i, ii), + RD_I_VAL, info); break; case CF_DEVPREDICT: break; @@ -298,8 +308,9 @@ rrd_info_t *rrd_info_r( history[j] = '\0'; info.u_str = history; cd = rrd_info_push(cd, - sprintf_alloc("rra[%d].cdp_prep[%d].history", - i, ii), RD_I_STR, info); + sprintf_alloc + ("rra[%d].cdp_prep[%d].history", i, ii), + RD_I_STR, info); } break; default: @@ -307,15 +318,15 @@ rrd_info_t *rrd_info_r( rrd.cdp_prep[i * rrd.stat_head->ds_cnt + ii].scratch[CDP_val].u_val; cd = rrd_info_push(cd, - sprintf_alloc("rra[%d].cdp_prep[%d].value", i, - ii), RD_I_VAL, info); + sprintf_alloc("rra[%d].cdp_prep[%d].value", + i, ii), RD_I_VAL, info); info.u_cnt = rrd.cdp_prep[i * rrd.stat_head->ds_cnt + ii].scratch[CDP_unkn_pdp_cnt].u_cnt; cd = rrd_info_push(cd, - sprintf_alloc - ("rra[%d].cdp_prep[%d].unknown_datapoints", i, - ii), RD_I_CNT, info); + sprintf_alloc + ("rra[%d].cdp_prep[%d].unknown_datapoints", + i, ii), RD_I_CNT, info); break; } } @@ -329,7 +340,7 @@ rrd_info_t *rrd_info_r( void rrd_info_print( - rrd_info_t *data) + rrd_info_t * data) { while (data) { printf("%s = ", data->key); @@ -360,7 +371,7 @@ void rrd_info_print( } void rrd_info_free( - rrd_info_t *data) + rrd_info_t * data) { rrd_info_t *save; diff --git a/src/rrd_open.c b/src/rrd_open.c index 75281e0..4caebd3 100644 --- a/src/rrd_open.c +++ b/src/rrd_open.c @@ -34,7 +34,7 @@ #endif /* get the address of the start of this page */ -#if defined USE_MADVISE || defined HAVE_POSIX_FADVISE +#if defined USE_MADVISE || defined HAVE_POSIX_FADVISE #ifndef PAGE_START #define PAGE_START(addr) ((addr)&(~(_page_size-1))) #endif @@ -371,7 +371,7 @@ void rrd_dontneed( #if defined DEBUG && DEBUG > 1 mincore_print(rrd_file, "after"); #endif -#endif /* without madvise and posix_fadvise ist does not make much sense todo anything */ +#endif /* without madvise and posix_fadvise ist does not make much sense todo anything */ } @@ -563,4 +563,3 @@ void rrd_freemem( { free(mem); } - diff --git a/src/rrd_parsetime.c b/src/rrd_parsetime.c index c1aef0b..7fa3559 100644 --- a/src/rrd_parsetime.c +++ b/src/rrd_parsetime.c @@ -483,7 +483,7 @@ static char *expect2( * It also applies those m-guessing heuristics. */ static char *plus_minus( - rrd_time_value_t *ptv, + rrd_time_value_t * ptv, int doop) { static int op = PLUS; @@ -569,7 +569,7 @@ static char *plus_minus( * tod() computes the time of day (TIME-OF-DAY-SPEC) */ static char *tod( - rrd_time_value_t *ptv) + rrd_time_value_t * ptv) { int hour, minute = 0; int tlen; @@ -646,7 +646,7 @@ static char *tod( * assign_date() assigns a date, adjusting year as appropriate */ static char *assign_date( - rrd_time_value_t *ptv, + rrd_time_value_t * ptv, long mday, long mon, long year) @@ -679,7 +679,7 @@ static char *assign_date( * day() picks apart DAY-SPEC-[12] */ static char *day( - rrd_time_value_t *ptv) + rrd_time_value_t * ptv) { /* using time_t seems to help portability with 64bit oses */ time_t mday = 0, wday, mon, year = ptv->tm.tm_year; @@ -833,7 +833,7 @@ static char *day( */ char *rrd_parsetime( const char *tspec, - rrd_time_value_t *ptv) + rrd_time_value_t * ptv) { time_t now = time(NULL); int hr = 0; @@ -990,8 +990,8 @@ char *rrd_parsetime( int rrd_proc_start_end( - rrd_time_value_t *start_tv, - rrd_time_value_t *end_tv, + rrd_time_value_t * start_tv, + rrd_time_value_t * end_tv, time_t *start, time_t *end) { diff --git a/src/rrd_tool.c b/src/rrd_tool.c index 670e3c3..be6a1d4 100644 --- a/src/rrd_tool.c +++ b/src/rrd_tool.c @@ -804,7 +804,7 @@ int HandleInputLine( } } else if (strcmp("graphv", argv[1]) == 0) { - rrd_info_t *grinfo = NULL; /* 1 to distinguish it from the NULL that rrd_graph sends in */ + rrd_info_t *grinfo = NULL; /* 1 to distinguish it from the NULL that rrd_graph sends in */ grinfo = rrd_graph_v(argc - 1, &argv[1]); if (grinfo) { diff --git a/src/rrd_update.c b/src/rrd_update.c index 594dfd9..9f27593 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -104,7 +104,7 @@ static int process_arg( char **updvals, long *tmpl_idx, unsigned long tmpl_cnt, - rrd_info_t **pcdp_summary, + rrd_info_t ** pcdp_summary, int version, unsigned long *skip_update, int *schedule_smooth); @@ -258,7 +258,7 @@ static int write_to_rras( unsigned long *rra_current, time_t current_time, unsigned long *skip_update, - rrd_info_t **pcdp_summary); + rrd_info_t ** pcdp_summary); static int write_RRA_row( rrd_file_t *rrd_file, @@ -266,7 +266,7 @@ static int write_RRA_row( unsigned long rra_idx, unsigned long *rra_current, unsigned short CDP_scratch_idx, - rrd_info_t **pcdp_summary, + rrd_info_t ** pcdp_summary, time_t rra_time); static int smooth_all_rras( @@ -322,7 +322,7 @@ rrd_info_t *rrd_update_v( char **argv) { char *tmplt = NULL; - rrd_info_t *result = NULL; + rrd_info_t *result = NULL; rrd_infoval_t rc; struct option long_options[] = { {"template", required_argument, 0, 't'}, @@ -428,7 +428,7 @@ int _rrd_update( const char *tmplt, int argc, const char **argv, - rrd_info_t *pcdp_summary) + rrd_info_t * pcdp_summary) { int arg_i = 2; @@ -750,7 +750,7 @@ static int process_arg( char **updvals, long *tmpl_idx, unsigned long tmpl_cnt, - rrd_info_t **pcdp_summary, + rrd_info_t ** pcdp_summary, int version, unsigned long *skip_update, int *schedule_smooth) @@ -1855,7 +1855,7 @@ static int write_to_rras( unsigned long *rra_current, time_t current_time, unsigned long *skip_update, - rrd_info_t **pcdp_summary) + rrd_info_t ** pcdp_summary) { unsigned long rra_idx; unsigned long rra_start; @@ -1963,7 +1963,7 @@ static int write_RRA_row( unsigned long rra_idx, unsigned long *rra_current, unsigned short CDP_scratch_idx, - rrd_info_t **pcdp_summary, + rrd_info_t ** pcdp_summary, time_t rra_time) { unsigned long ds_idx, cdp_idx; @@ -1981,14 +1981,12 @@ static int write_RRA_row( iv.u_val = rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val; /* append info to the return hash */ *pcdp_summary = rrd_info_push(*pcdp_summary, - sprintf_alloc("[%d]RRA[%s][%lu]DS[%s]", - rra_time, - rrd->rra_def[rra_idx]. - cf_nam, - rrd->rra_def[rra_idx]. - pdp_cnt, - rrd->ds_def[ds_idx]. - ds_nam), RD_I_VAL, iv); + sprintf_alloc + ("[%d]RRA[%s][%lu]DS[%s]", rra_time, + rrd->rra_def[rra_idx].cf_nam, + rrd->rra_def[rra_idx].pdp_cnt, + rrd->ds_def[ds_idx].ds_nam), + RD_I_VAL, iv); } if (rrd_write(rrd_file, &(rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx]. -- 2.30.2