mark unused arguments in the same way throughout the code
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 7 Apr 2010 13:01:39 +0000 (13:01 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 7 Apr 2010 13:01:39 +0000 (13:01 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@2067 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_daemon.c
src/rrd_fetch_libdbi.c
src/rrd_getopt.c
src/rrd_graph.c
src/rrd_open.c

index 2480958..3be6e78 100644 (file)
@@ -73,6 +73,7 @@
 
 #include "rrd.h"
 #include "rrd_client.h"
 
 #include "rrd.h"
 #include "rrd_client.h"
+#include "unused.h"
 
 #include <stdlib.h>
 
 
 #include <stdlib.h>
 
     syslog ((severity), __VA_ARGS__); \
   } while (0)
 
     syslog ((severity), __VA_ARGS__); \
   } while (0)
 
-#ifndef __GNUC__
-# define __attribute__(x) /**/
-#endif
-
 /*
  * Types
  */
 /*
  * Types
  */
@@ -155,12 +152,12 @@ typedef struct listen_socket_s listen_socket_t;
 struct command_s;
 typedef struct command_s command_t;
 /* note: guard against "unused" warnings in the handlers */
 struct command_s;
 typedef struct command_s command_t;
 /* note: guard against "unused" warnings in the handlers */
-#define DISPATCH_PROTO listen_socket_t *sock   __attribute__((unused)),\
-                       time_t now              __attribute__((unused)),\
-                       char  *buffer           __attribute__((unused)),\
-                       size_t buffer_size      __attribute__((unused))
+#define DISPATCH_PROTO listen_socket_t UNUSED(*sock),\
+                       time_t UNUSED(now),\
+                       char  UNUSED(*buffer),\
+                       size_t UNUSED(buffer_size)
 
 
-#define HANDLER_PROTO  command_t *cmd          __attribute__((unused)),\
+#define HANDLER_PROTO  command_t UNUSED(*cmd),\
                        DISPATCH_PROTO
 
 struct command_s {
                        DISPATCH_PROTO
 
 struct command_s {
@@ -303,23 +300,23 @@ static void sig_common (const char *sig) /* {{{ */
   pthread_cond_broadcast(&queue_cond);
 } /* }}} void sig_common */
 
   pthread_cond_broadcast(&queue_cond);
 } /* }}} void sig_common */
 
-static void sig_int_handler (int s __attribute__((unused))) /* {{{ */
+static void sig_int_handler (int UNUSED(s)) /* {{{ */
 {
   sig_common("INT");
 } /* }}} void sig_int_handler */
 
 {
   sig_common("INT");
 } /* }}} void sig_int_handler */
 
-static void sig_term_handler (int s __attribute__((unused))) /* {{{ */
+static void sig_term_handler (int UNUSED(s)) /* {{{ */
 {
   sig_common("TERM");
 } /* }}} void sig_term_handler */
 
 {
   sig_common("TERM");
 } /* }}} void sig_term_handler */
 
-static void sig_usr1_handler (int s __attribute__((unused))) /* {{{ */
+static void sig_usr1_handler (int UNUSED(s)) /* {{{ */
 {
   config_flush_at_shutdown = 1;
   sig_common("USR1");
 } /* }}} void sig_usr1_handler */
 
 {
   config_flush_at_shutdown = 1;
   sig_common("USR1");
 } /* }}} void sig_usr1_handler */
 
-static void sig_usr2_handler (int s __attribute__((unused))) /* {{{ */
+static void sig_usr2_handler (int UNUSED(s)) /* {{{ */
 {
   config_flush_at_shutdown = 0;
   sig_common("USR2");
 {
   config_flush_at_shutdown = 0;
   sig_common("USR2");
@@ -844,7 +841,7 @@ static int flush_old_values (int max_age)
   return (0);
 } /* int flush_old_values */
 
   return (0);
 } /* int flush_old_values */
 
-static void *flush_thread_main (void *args __attribute__((unused))) /* {{{ */
+static void *flush_thread_main (void UNUSED(*args)) /* {{{ */
 {
   struct timeval now;
   struct timespec next_flush;
 {
   struct timeval now;
   struct timespec next_flush;
@@ -897,7 +894,7 @@ static void *flush_thread_main (void *args __attribute__((unused))) /* {{{ */
   return NULL;
 } /* void *flush_thread_main */
 
   return NULL;
 } /* void *flush_thread_main */
 
-static void *queue_thread_main (void *args __attribute__((unused))) /* {{{ */
+static void *queue_thread_main (void UNUSED(*args)) /* {{{ */
 {
   pthread_mutex_lock (&cache_lock);
 
 {
   pthread_mutex_lock (&cache_lock);
 
@@ -2707,7 +2704,7 @@ static int close_listen_sockets (void) /* {{{ */
   return (0);
 } /* }}} int close_listen_sockets */
 
   return (0);
 } /* }}} int close_listen_sockets */
 
-static void *listen_thread_main (void *args __attribute__((unused))) /* {{{ */
+static void *listen_thread_main (void UNUSED(*args)) /* {{{ */
 {
   struct pollfd *pollfds;
   int pollfds_num;
 {
   struct pollfd *pollfds;
   int pollfds_num;
index 0e8bc93..7ca809e 100644 (file)
@@ -1,4 +1,5 @@
 #include "rrd_tool.h"
 #include "rrd_tool.h"
+#include "unused.h"
 #include <dbi/dbi.h>
 #include <time.h>
 
 #include <dbi/dbi.h>
 #include <time.h>
 
@@ -365,7 +366,7 @@ static int _inline_unescape (char* string) {
 int
 rrd_fetch_fn_libdbi(
     const char     *filename,  /* name of the rrd */
 int
 rrd_fetch_fn_libdbi(
     const char     *filename,  /* name of the rrd */
-    enum cf_en     cf_idx __attribute__((unused)), /* consolidation function */
+    enum cf_en     UNUSED(cf_idx), /* consolidation function */
     time_t         *start,
     time_t         *end,       /* which time frame do you want ?
                                * will be changed to represent reality */
     time_t         *start,
     time_t         *end,       /* which time frame do you want ?
                                * will be changed to represent reality */
index f973471..a74ff88 100644 (file)
@@ -274,7 +274,8 @@ static char *const *original_argv;
    to getopt is that one passed to the process.  */
 static void store_args(
     int argc,
    to getopt is that one passed to the process.  */
 static void store_args(
     int argc,
-    char *const *argv) __attribute__ ((unused));
+    char *const *argv);
+
 static void store_args(
     int argc,
     char *const *argv)
 static void store_args(
     int argc,
     char *const *argv)
index f5a63c3..c680545 100644 (file)
@@ -846,24 +846,24 @@ int data_fetch(
         }
         if (!skip) {
             unsigned long ft_step = im->gdes[i].step;   /* ft_step will record what we got from fetch */
         }
         if (!skip) {
             unsigned long ft_step = im->gdes[i].step;   /* ft_step will record what we got from fetch */
-            const char *daemon;
+            const char *rrd_daemon;
             int status;
 
             if (im->gdes[i].daemon[0] != 0)
             int status;
 
             if (im->gdes[i].daemon[0] != 0)
-                daemon = im->gdes[i].daemon;
+                rrd_daemon = im->gdes[i].daemon;
             else
             else
-                daemon = im->daemon_addr;
+                rrd_daemon = im->daemon_addr;
 
             /* "daemon" may be NULL. ENV_RRDCACHED_ADDRESS is evaluated in that
              * case. If "daemon" holds the same value as in the previous
              * iteration, no actual new connection is established - the
              * existing connection is re-used. */
 
             /* "daemon" may be NULL. ENV_RRDCACHED_ADDRESS is evaluated in that
              * case. If "daemon" holds the same value as in the previous
              * iteration, no actual new connection is established - the
              * existing connection is re-used. */
-            rrdc_connect (daemon);
+            rrdc_connect (rrd_daemon);
 
             /* If connecting was successfull, use the daemon to query the data.
              * If there is no connection, for example because no daemon address
              * was specified, (try to) use the local file directly. */
 
             /* If connecting was successfull, use the daemon to query the data.
              * If there is no connection, for example because no daemon address
              * was specified, (try to) use the local file directly. */
-            if (rrdc_is_connected (daemon))
+            if (rrdc_is_connected (rrd_daemon))
             {
                 status = rrdc_fetch (im->gdes[i].rrd,
                         cf_to_string (im->gdes[i].cf),
             {
                 status = rrdc_fetch (im->gdes[i].rrd,
                         cf_to_string (im->gdes[i].cf),
index 820b547..9f4f6e2 100644 (file)
@@ -686,7 +686,7 @@ ssize_t rrd_write(
 /* this is a leftover from the old days, it serves no purpose
    and is therefore turned into a no-op */
 void rrd_flush(
 /* this is a leftover from the old days, it serves no purpose
    and is therefore turned into a no-op */
 void rrd_flush(
-    rrd_file_t *rrd_file  __attribute__((unused)))
+    rrd_file_t UNUSED(*rrd_file))
 {
 }
 
 {
 }
 
@@ -748,10 +748,10 @@ void rrd_freemem(
  * aligning RRAs within stripes, or other performance enhancements
  */
 void rrd_notify_row(
  * aligning RRAs within stripes, or other performance enhancements
  */
 void rrd_notify_row(
-    rrd_file_t *rrd_file  __attribute__((unused)),
-    int rra_idx  __attribute__((unused)),
-    unsigned long rra_row  __attribute__((unused)),
-    time_t rra_time  __attribute__((unused)))
+    rrd_file_t UNUSED(*rrd_file),
+    int UNUSED(rra_idx),
+    unsigned long UNUSED(rra_row),
+    time_t UNUSED(rra_time))
 {
 }
 
 {
 }
 
@@ -763,8 +763,8 @@ void rrd_notify_row(
  * don't change to a new disk block at the same time
  */
 unsigned long rrd_select_initial_row(
  * don't change to a new disk block at the same time
  */
 unsigned long rrd_select_initial_row(
-    rrd_file_t *rrd_file  __attribute__((unused)),
-    int rra_idx  __attribute__((unused)),
+    rrd_file_t UNUSED(*rrd_file),
+    int UNUSED(rra_idx),
     rra_def_t *rra
     )
 {
     rra_def_t *rra
     )
 {