fixed indenting
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 25 Jul 2007 20:38:37 +0000 (20:38 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 25 Jul 2007 20:38:37 +0000 (20:38 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1173 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_create.c
src/rrd_dump.c
src/rrd_fetch.c
src/rrd_format.h
src/rrd_graph.c
src/rrd_graph_helper.c
src/rrd_open.c
src/rrd_restore.c
src/rrd_rpncalc.c
src/rrd_tool.h
src/rrd_tune.c

index 4e442d2..3d064ff 100644 (file)
@@ -133,8 +133,8 @@ int rrd_create_r(
     }
 
     /* set some defaults */
-    strcpy(rrd.stat_head->cookie, RRD_COOKIE);    
-    strcpy(rrd.stat_head->version, RRD_VERSION3); /* by default we are still version 3 */
+    strcpy(rrd.stat_head->cookie, RRD_COOKIE);
+    strcpy(rrd.stat_head->version, RRD_VERSION3);   /* by default we are still version 3 */
     rrd.stat_head->float_cookie = FLOAT_COOKIE;
     rrd.stat_head->ds_cnt = 0;  /* this will be adjusted later */
     rrd.stat_head->rra_cnt = 0; /* ditto */
@@ -248,7 +248,7 @@ int rrd_create_r(
                     switch (cf_conv
                             (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
                     case CF_MHWPREDICT:
-                        strcpy(rrd.stat_head->version, RRD_VERSION); /* MHWPREDICT causes Version 4 */
+                        strcpy(rrd.stat_head->version, RRD_VERSION);    /* MHWPREDICT causes Version 4 */
                     case CF_HWPREDICT:
                         /* initialize some parameters */
                         rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_alpha].
@@ -515,7 +515,8 @@ void parseGENERIC_DS(
     int ds_idx)
 {
     char      minstr[DS_NAM_SIZE], maxstr[DS_NAM_SIZE];
-    char *old_locale;
+    char     *old_locale;
+
     /*
        int temp;
 
@@ -523,7 +524,7 @@ void parseGENERIC_DS(
        &(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
        minstr,maxstr);
      */
-    old_locale = setlocale(LC_NUMERIC,"C");
+    old_locale = setlocale(LC_NUMERIC, "C");
     if (sscanf(def, "%lu:%18[^:]:%18[^:]",
                &(rrd->ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
                minstr, maxstr) == 3) {
@@ -542,13 +543,13 @@ void parseGENERIC_DS(
             rrd->ds_def[ds_idx].par[DS_min_val].u_val
             >= rrd->ds_def[ds_idx].par[DS_max_val].u_val) {
             rrd_set_error("min must be less than max in DS definition");
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             return;
         }
     } else {
         rrd_set_error("failed to parse data source %s", def);
     }
-    setlocale(LC_NUMERIC,old_locale);
+    setlocale(LC_NUMERIC, old_locale);
 }
 
 /* Create the CF_DEVPREDICT, CF_DEVSEASONAL, CF_SEASONAL, and CF_FAILURES RRAs
@@ -630,26 +631,27 @@ int rrd_create_fn(
     rrd_t *rrd)
 {
     unsigned long i, ii;
-    int    rrd_file;
+    int       rrd_file;
     rrd_value_t *unknown;
     int       unkn_cnt;
     rrd_file_t *rrd_file_dn;
-    rrd_t      rrd_dn;
+    rrd_t     rrd_dn;
 
-    if ((rrd_file = open(file_name, O_WRONLY|O_CREAT|O_TRUNC,0666)) == NULL) {
+    if ((rrd_file =
+         open(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) == NULL) {
         rrd_set_error("creating '%s': %s", file_name, rrd_strerror(errno));
         rrd_free(rrd);
         return (-1);
     }
 
-    write(rrd_file,rrd->stat_head, sizeof(stat_head_t));
+    write(rrd_file, rrd->stat_head, sizeof(stat_head_t));
 
-    write(rrd_file,rrd->ds_def, sizeof(ds_def_t)*rrd->stat_head->ds_cnt);
+    write(rrd_file, rrd->ds_def, sizeof(ds_def_t) * rrd->stat_head->ds_cnt);
 
-    write(rrd_file,rrd->rra_def,
-           sizeof(rra_def_t)* rrd->stat_head->rra_cnt);
+    write(rrd_file, rrd->rra_def,
+          sizeof(rra_def_t) * rrd->stat_head->rra_cnt);
 
-    write(rrd_file,rrd->live_head, sizeof(live_head_t));
+    write(rrd_file, rrd->live_head, sizeof(live_head_t));
 
     if ((rrd->pdp_prep = calloc(1, sizeof(pdp_prep_t))) == NULL) {
         rrd_set_error("allocating pdp_prep");
@@ -665,7 +667,7 @@ int rrd_create_fn(
         rrd->live_head->last_up % rrd->stat_head->pdp_step;
 
     for (i = 0; i < rrd->stat_head->ds_cnt; i++)
-        write(rrd_file,rrd->pdp_prep, sizeof(pdp_prep_t));
+        write(rrd_file, rrd->pdp_prep, sizeof(pdp_prep_t));
 
     if ((rrd->cdp_prep = calloc(1, sizeof(cdp_prep_t))) == NULL) {
         rrd_set_error("allocating cdp_prep");
@@ -707,7 +709,7 @@ int rrd_create_fn(
         }
 
         for (ii = 0; ii < rrd->stat_head->ds_cnt; ii++) {
-            write(rrd_file,rrd->cdp_prep, sizeof(cdp_prep_t));
+            write(rrd_file, rrd->cdp_prep, sizeof(cdp_prep_t));
         }
     }
 
@@ -727,7 +729,7 @@ int rrd_create_fn(
      * the pointer a priori. */
     for (i = 0; i < rrd->stat_head->rra_cnt; i++) {
         rrd->rra_ptr->cur_row = rrd->rra_def[i].row_cnt - 1;
-        write(rrd_file,rrd->rra_ptr, sizeof(rra_ptr_t));
+        write(rrd_file, rrd->rra_ptr, sizeof(rra_ptr_t));
     }
 
     /* write the empty data area */
@@ -745,20 +747,20 @@ int rrd_create_fn(
         unkn_cnt += rrd->stat_head->ds_cnt * rrd->rra_def[i].row_cnt;
 
     while (unkn_cnt > 0) {
-        write(rrd_file,unknown, sizeof(rrd_value_t) * min(unkn_cnt, 512));
+        write(rrd_file, unknown, sizeof(rrd_value_t) * min(unkn_cnt, 512));
 
         unkn_cnt -= 512;
     }
     free(unknown);
     fdatasync(rrd_file);
     rrd_free(rrd);
-    if ( close(rrd_file) == -1 ) {
+    if (close(rrd_file) == -1) {
         rrd_set_error("creating rrd: %s", rrd_strerror(errno));
         return -1;
     }
     /* flush all we don't need out of the cache */
     rrd_file_dn = rrd_open(file_name, &rrd_dn, RRD_READONLY);
-    rrd_dontneed(rrd_file_dn,&rrd_dn);
+    rrd_dontneed(rrd_file_dn, &rrd_dn);
     rrd_close(rrd_file_dn);
     return (0);
 }
index be000f9..6d743df 100644 (file)
@@ -100,7 +100,7 @@ int rrd_dump_r(
 
     fputs("<!-- Round Robin Database Dump -->", out_file);
     fputs("<rrd>", out_file);
-    if ( atoi(rrd.stat_head->version) <= 3) {
+    if (atoi(rrd.stat_head->version) <= 3) {
         fprintf(out_file, "\t<version> %s </version>\n", RRD_VERSION3);
     } else {
         fprintf(out_file, "\t<version> %s </version>\n", RRD_VERSION);
index b419f53..74829ff 100644 (file)
@@ -420,7 +420,6 @@ int rrd_fetch_fn(
                 rrd_set_error("fetching cdp from rra");
                 goto err_free_data;
             }
-
 #ifdef DEBUG
             fprintf(stderr, "post fetch %li -- ", i);
             for (ii = 0; ii < *ds_cnt; ii++)
index 711778f..4d2dced 100644 (file)
@@ -183,7 +183,7 @@ enum cf_en { CF_AVERAGE = 0,    /* data consolidation functions */
     CF_FAILURES,
     /* HWPREDICT that follows a moving baseline */
     CF_MHWPREDICT
-    /* new entries must come last !!! */
+        /* new entries must come last !!! */
 };
 
                        /* A binary array of failure indicators: 1 indicates
index 6b8a46d..e295397 100644 (file)
@@ -3721,7 +3721,7 @@ void rrd_graph_options(
     long      long_tmp;
     struct rrd_time_value start_tv, end_tv;
     long unsigned int color;
-    char *old_locale = "";
+    char     *old_locale = "";
 
     /* defines for long options without a short equivalent. should be bytes,
        and may not collide with (the ASCII value of) short options */
@@ -3781,6 +3781,7 @@ void rrd_graph_options(
         int       option_index = 0;
         int       opt;
         int       col_start, col_end;
+
         opt = getopt_long(argc, argv,
                           "s:e:x:y:v:w:h:D:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMEX:L:S:T:NR:B:W:",
                           long_options, &option_index);
@@ -3816,7 +3817,7 @@ void rrd_graph_options(
         case LONGOPT_UNITS_SI:
             if (im->extra_flags & FORCE_UNITS) {
                 rrd_set_error("--units can only be used once!");
-                setlocale(LC_NUMERIC,old_locale);
+                setlocale(LC_NUMERIC, old_locale);
                 return;
             }
             if (strcmp(optarg, "si") == 0)
@@ -3834,14 +3835,14 @@ void rrd_graph_options(
             im->forceleftspace = 1;
             break;
         case 'T':
-            old_locale = setlocale(LC_NUMERIC,"C");
+            old_locale = setlocale(LC_NUMERIC, "C");
             im->tabwidth = atof(optarg);
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             break;
         case 'S':
-            old_locale = setlocale(LC_NUMERIC,"C");
+            old_locale = setlocale(LC_NUMERIC, "C");
             im->step = atoi(optarg);
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             break;
         case 'N':
             im->gridfit = 0;
@@ -3901,9 +3902,9 @@ void rrd_graph_options(
                 im->draw_y_grid = 0;
                 break;
             };
-            old_locale=setlocale(LC_NUMERIC,"C");           
+            old_locale = setlocale(LC_NUMERIC, "C");
             if (sscanf(optarg, "%lf:%d", &im->ygridstep, &im->ylabfact) == 2) {
-                setlocale(LC_NUMERIC,old_locale);
+                setlocale(LC_NUMERIC, old_locale);
                 if (im->ygridstep <= 0) {
                     rrd_set_error("grid step must be > 0");
                     return;
@@ -3912,7 +3913,7 @@ void rrd_graph_options(
                     return;
                 }
             } else {
-                setlocale(LC_NUMERIC,old_locale);
+                setlocale(LC_NUMERIC, old_locale);
                 rrd_set_error("invalid y-grid format");
                 return;
             }
@@ -3922,14 +3923,14 @@ void rrd_graph_options(
             im->ylegend[150] = '\0';
             break;
         case 'u':
-            old_locale=setlocale(LC_NUMERIC,"C");           
+            old_locale = setlocale(LC_NUMERIC, "C");
             im->maxval = atof(optarg);
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             break;
         case 'l':
-            old_locale=setlocale(LC_NUMERIC,"C");           
+            old_locale = setlocale(LC_NUMERIC, "C");
             im->minval = atof(optarg);
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             break;
         case 'b':
             im->base = atol(optarg);
@@ -4027,11 +4028,12 @@ void rrd_graph_options(
             char      prop[15];
             double    size = 1;
             char      font[1024] = "";
-            old_locale = setlocale(LC_NUMERIC,"C");
+
+            old_locale = setlocale(LC_NUMERIC, "C");
             if (sscanf(optarg, "%10[A-Z]:%lf:%1000s", prop, &size, font) >= 2) {
                 int       sindex, propidx;
-    
-                setlocale(LC_NUMERIC,old_locale);
+
+                setlocale(LC_NUMERIC, old_locale);
                 if ((sindex = text_prop_conv(prop)) != -1) {
                     for (propidx = sindex; propidx < TEXT_PROP_LAST;
                          propidx++) {
@@ -4048,17 +4050,17 @@ void rrd_graph_options(
                     rrd_set_error("invalid fonttag '%s'", prop);
                     return;
                 }
-           } else {
-                setlocale(LC_NUMERIC,old_locale);
+            } else {
+                setlocale(LC_NUMERIC, old_locale);
                 rrd_set_error("invalid text property format");
                 return;
             }
             break;
         }
         case 'm':
-            old_locale=setlocale(LC_NUMERIC,"C");           
+            old_locale = setlocale(LC_NUMERIC, "C");
             im->zoom = atof(optarg);
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             if (im->zoom <= 0.0) {
                 rrd_set_error("zoom factor must be > 0");
                 return;
@@ -4258,12 +4260,12 @@ int vdef_parse(
     double    param;
     char      func[30];
     int       n;
-    char      *old_locale;
+    char     *old_locale;
 
     n = 0;
-    old_locale = setlocale(LC_NUMERIC,"C");
+    old_locale = setlocale(LC_NUMERIC, "C");
     sscanf(str, "%le,%29[A-Z]%n", &param, func, &n);
-    setlocale(LC_NUMERIC,old_locale);
+    setlocale(LC_NUMERIC, old_locale);
     if (n == (int) strlen(str)) {   /* matched */
         ;
     } else {
index 4373fd0..d59625b 100644 (file)
@@ -445,7 +445,8 @@ int rrd_parse_shift(
             return 1;
         }
     } else {
-        long time_tmp = 0;
+        long      time_tmp = 0;
+
         rrd_clear_error();
         i = 0;
         sscanf(&line[*eaten], "%li%n", &time_tmp, &i);
@@ -607,12 +608,13 @@ int rrd_parse_PVHLAST(
         default:;
         }
     } else {
-        long time_tmp = 0;
+        long      time_tmp = 0;
+
         dprintf("- it is not an existing vname\n");
         switch (gdp->gf) {
         case GF_VRULE:
             k = 0;
-            sscanf(tmpstr, "%li%n",&time_tmp , &k);
+            sscanf(tmpstr, "%li%n", &time_tmp, &k);
             gdp->xrule = time_tmp;
             if (((j != 0) && (k == j)) || ((j == 0) && (k == i))) {
                 dprintf("- found time: %li\n", gdp->xrule);
index 4306eff..80f9a04 100644 (file)
@@ -210,8 +210,7 @@ rrd_file_t *rrd_open(
 #if defined USE_MADVISE
     /* the ds_def will be needed soonish, so hint accordingly */
     madvise(data + PAGE_START(offset),
-             sizeof(ds_def_t) * rrd->stat_head->ds_cnt,
-             MADV_WILLNEED);
+            sizeof(ds_def_t) * rrd->stat_head->ds_cnt, MADV_WILLNEED);
 #endif
     __rrd_read(rrd->ds_def, ds_def_t,
                rrd->stat_head->ds_cnt);
@@ -219,8 +218,7 @@ rrd_file_t *rrd_open(
 #if defined USE_MADVISE
     /* the rra_def will be needed soonish, so hint accordingly */
     madvise(data + PAGE_START(offset),
-             sizeof(rra_def_t) * rrd->stat_head->rra_cnt,
-             MADV_WILLNEED);
+            sizeof(rra_def_t) * rrd->stat_head->rra_cnt, MADV_WILLNEED);
 #endif
     __rrd_read(rrd->rra_def, rra_def_t,
                rrd->stat_head->rra_cnt);
@@ -243,7 +241,7 @@ rrd_file_t *rrd_open(
 #if defined USE_MADVISE
         /* the live_head will be needed soonish, so hint accordingly */
         madvise(data + PAGE_START(offset),
-                 sizeof(live_head_t), MADV_WILLNEED);
+                sizeof(live_head_t), MADV_WILLNEED);
 #endif
         __rrd_read(rrd->live_head, live_head_t,
                    1);
@@ -276,7 +274,10 @@ rrd_file_t *rrd_open(
 
 /* Close a reference to an rrd_file.  */
 static
-void mincore_print(rrd_file_t *rrd_file,char * mark){
+void mincore_print(
+    rrd_file_t *rrd_file,
+    char *mark)
+{
 #ifdef HAVE_MMAP
     /* pretty print blocks in core */
     off_t     off;
@@ -297,7 +298,7 @@ void mincore_print(rrd_file_t *rrd_file,char * mark){
                 if (off == 0)
                     was_in = is_in;
                 if (was_in != is_in) {
-                    fprintf(stderr, "%s: %sin core: %p len %ld\n",mark,
+                    fprintf(stderr, "%s: %sin core: %p len %ld\n", mark,
                             was_in ? "" : "not ", vec + prev, off - prev);
                     was_in = is_in;
                     prev = off;
@@ -310,64 +311,67 @@ void mincore_print(rrd_file_t *rrd_file,char * mark){
             fprintf(stderr, "mincore: %s", rrd_strerror(errno));
     }
 #else
-  fprintf(stderr, "sorry mincore only works with mmap");
+    fprintf(stderr, "sorry mincore only works with mmap");
 #endif
 }
 
 
 /* drop cache except for the header and the active pages */
-void
-rrd_dontneed (
+void rrd_dontneed(
     rrd_file_t *rrd_file,
-    rrd_t *rrd){
-    unsigned long      dontneed_start;
-    unsigned long      rra_start;
-    unsigned long      active_block;
-    unsigned long      i;
+    rrd_t *rrd)
+{
+    unsigned long dontneed_start;
+    unsigned long rra_start;
+    unsigned long active_block;
+    unsigned long i;
     ssize_t   _page_size = sysconf(_SC_PAGESIZE);
 
 #if defined DEBUG && DEBUG > 1
-    mincore_print(rrd_file,"before");
+    mincore_print(rrd_file, "before");
 #endif
 
     /* ignoring errors from RRDs that are smaller then the file_len+rounding */
     rra_start = rrd_file->header_len;
-    dontneed_start = PAGE_START(rra_start)+_page_size;
-    for (i = 0; i < rrd->stat_head->rra_cnt; ++i) {        
-       active_block =
-              PAGE_START(rra_start
-                         + rrd->rra_ptr[i].cur_row 
-                         * rrd->stat_head->ds_cnt 
-                         * sizeof(rrd_value_t));
-       if (active_block > dontneed_start) {
+    dontneed_start = PAGE_START(rra_start) + _page_size;
+    for (i = 0; i < rrd->stat_head->rra_cnt; ++i) {
+        active_block =
+            PAGE_START(rra_start
+                       + rrd->rra_ptr[i].cur_row
+                       * rrd->stat_head->ds_cnt * sizeof(rrd_value_t));
+        if (active_block > dontneed_start) {
 #ifdef USE_MADVISE
-           madvise(rrd_file->file_start + dontneed_start,
-                   active_block-dontneed_start-1,
-                   MADV_DONTNEED);
+            madvise(rrd_file->file_start + dontneed_start,
+                    active_block - dontneed_start - 1, MADV_DONTNEED);
 #endif
 /* in linux at least only fadvise DONTNEED seems to purge pages from cache */
 #ifdef HAVE_POSIX_FADVISE
-            posix_fadvise(rrd_file->fd, dontneed_start, active_block-dontneed_start-1, POSIX_FADV_DONTNEED);
+            posix_fadvise(rrd_file->fd, dontneed_start,
+                          active_block - dontneed_start - 1,
+                          POSIX_FADV_DONTNEED);
 #endif
-       }
-       dontneed_start = active_block;
-       /* do not relase 'hot' block if update for this RAA will occure within 10 minutes */
-       if (  rrd->stat_head->pdp_step * rrd->rra_def[i].pdp_cnt - 
-             rrd->live_head->last_up % (rrd->stat_head->pdp_step * rrd->rra_def[i].pdp_cnt) < 10*60 ){
+        }
+        dontneed_start = active_block;
+        /* do not relase 'hot' block if update for this RAA will occure within 10 minutes */
+        if (rrd->stat_head->pdp_step * rrd->rra_def[i].pdp_cnt -
+            rrd->live_head->last_up % (rrd->stat_head->pdp_step *
+                                       rrd->rra_def[i].pdp_cnt) < 10 * 60) {
             dontneed_start += _page_size;
-       }
-       rra_start += rrd->rra_def[i].row_cnt * rrd->stat_head->ds_cnt * sizeof(rrd_value_t);
+        }
+        rra_start +=
+            rrd->rra_def[i].row_cnt * rrd->stat_head->ds_cnt *
+            sizeof(rrd_value_t);
     }
 #ifdef USE_MADVISE
     madvise(rrd_file->file_start + dontneed_start,
-             rrd_file->file_len - dontneed_start,
-             MADV_DONTNEED);
+            rrd_file->file_len - dontneed_start, MADV_DONTNEED);
 #endif
 #ifdef HAVE_POSIX_FADVISE
-    posix_fadvise(rrd_file->fd, dontneed_start, rrd_file->file_len-dontneed_start, POSIX_FADV_DONTNEED);
+    posix_fadvise(rrd_file->fd, dontneed_start,
+                  rrd_file->file_len - dontneed_start, POSIX_FADV_DONTNEED);
 #endif
 #if defined DEBUG && DEBUG > 1
-    mincore_print(rrd_file,"after");
+    mincore_print(rrd_file, "after");
 #endif
 }
 
@@ -375,6 +379,7 @@ int rrd_close(
     rrd_file_t *rrd_file)
 {
     int       ret;
+
 #ifdef HAVE_MMAP
     ret = munmap(rrd_file->file_start, rrd_file->file_len);
     if (ret != 0)
index 1164adb..1185c66 100644 (file)
@@ -224,7 +224,7 @@ int xml2rrd(
         return -1;
     }
     /* make sure we output the right version only go over 3 if input is over 3 too */
-    if (input_version > 3 ){
+    if (input_version > 3{
         strcpy(rrd->stat_head->version, RRD_VERSION);
     } else {
         strcpy(rrd->stat_head->version, RRD_VERSION3);
index 2fc6ca7..989a108 100644 (file)
@@ -288,8 +288,9 @@ rpnp_t   *rpn_parse(
     long      steps = -1;
     rpnp_t   *rpnp;
     char      vname[MAX_VNAME_LEN + 10];
-    char *old_locale;
-    old_locale = setlocale(LC_NUMERIC,"C");
+    char     *old_locale;
+
+    old_locale = setlocale(LC_NUMERIC, "C");
 
     rpnp = NULL;
     expr = (char *) expr_const;
@@ -297,10 +298,10 @@ rpnp_t   *rpn_parse(
     while (*expr) {
         if ((rpnp = (rpnp_t *) rrd_realloc(rpnp, (++steps + 2) *
                                            sizeof(rpnp_t))) == NULL) {
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             return NULL;
         }
-    
+
         else if ((sscanf(expr, "%lf%n", &rpnp[steps].val, &pos) == 1)
                  && (expr[pos] == ',')) {
             rpnp[steps].op = OP_NUMBER;
@@ -382,7 +383,7 @@ rpnp_t   *rpn_parse(
         }
 
         else {
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             free(rpnp);
             return NULL;
         }
@@ -392,13 +393,13 @@ rpnp_t   *rpn_parse(
         if (*expr == ',')
             expr++;
         else {
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             free(rpnp);
             return NULL;
         }
     }
     rpnp[steps + 1].op = OP_END;
-    setlocale(LC_NUMERIC,old_locale);
+    setlocale(LC_NUMERIC, old_locale);
     return rpnp;
 }
 
index 06f4de1..3cfe845 100644 (file)
@@ -137,7 +137,7 @@ extern    "C" {
     const char *const file_name,
     rrd_t *rrd,
     unsigned rdwr);
-    void rrd_dontneed(
+    void      rrd_dontneed(
     rrd_file_t *rrd_file,
     rrd_t *rrd);
     int       rrd_close(
index f5bea46..4638199 100644 (file)
@@ -105,7 +105,8 @@ int rrd_tune(
     while (1) {
         int       option_index = 0;
         int       opt;
-        char *old_locale = "";
+        char     *old_locale = "";
+
         opt = getopt_long(argc, argv, "h:i:a:d:r:p:n:w:f:x:y:z:v:b:",
                           long_options, &option_index);
         if (opt == EOF)
@@ -114,17 +115,17 @@ int rrd_tune(
         optcnt++;
         switch (opt) {
         case 'h':
-            old_locale = setlocale(LC_NUMERIC,"C");
+            old_locale = setlocale(LC_NUMERIC, "C");
             if ((matches =
                  sscanf(optarg, DS_NAM_FMT ":%ld", ds_nam,
                         &heartbeat)) != 2) {
                 rrd_set_error("invalid arguments for heartbeat");
                 rrd_free(&rrd);
                 rrd_close(rrd_file);
-                setlocale(LC_NUMERIC,old_locale);
+                setlocale(LC_NUMERIC, old_locale);
                 return -1;
             }
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             if ((ds = ds_match(&rrd, ds_nam)) == -1) {
                 rrd_free(&rrd);
                 rrd_close(rrd_file);
@@ -134,16 +135,16 @@ int rrd_tune(
             break;
 
         case 'i':
-            old_locale = setlocale(LC_NUMERIC,"C");
+            old_locale = setlocale(LC_NUMERIC, "C");
             if ((matches =
                  sscanf(optarg, DS_NAM_FMT ":%lf", ds_nam, &min)) < 1) {
                 rrd_set_error("invalid arguments for minimum ds value");
                 rrd_free(&rrd);
                 rrd_close(rrd_file);
-                setlocale(LC_NUMERIC,old_locale);
+                setlocale(LC_NUMERIC, old_locale);
                 return -1;
             }
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             if ((ds = ds_match(&rrd, ds_nam)) == -1) {
                 rrd_free(&rrd);
                 rrd_close(rrd_file);
@@ -156,16 +157,16 @@ int rrd_tune(
             break;
 
         case 'a':
-            old_locale = setlocale(LC_NUMERIC,"C");
+            old_locale = setlocale(LC_NUMERIC, "C");
             if ((matches =
                  sscanf(optarg, DS_NAM_FMT ":%lf", ds_nam, &max)) < 1) {
                 rrd_set_error("invalid arguments for maximum ds value");
                 rrd_free(&rrd);
                 rrd_close(rrd_file);
-                setlocale(LC_NUMERIC,old_locale);
+                setlocale(LC_NUMERIC, old_locale);
                 return -1;
             }
-            setlocale(LC_NUMERIC,old_locale);
+            setlocale(LC_NUMERIC, old_locale);
             if ((ds = ds_match(&rrd, ds_nam)) == -1) {
                 rrd_free(&rrd);
                 rrd_close(rrd_file);