From: Ruben Kerkhof Date: Tue, 1 Mar 2016 18:57:21 +0000 (+0100) Subject: Fix a few issues found by -Wshadow X-Git-Tag: collectd-5.5.2~6^2~30^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=89fc8d1d16779841bd693020d9035aa5f35f127d;p=collectd.git Fix a few issues found by -Wshadow --- diff --git a/src/bind.c b/src/bind.c index f9cf79ec..28d28b68 100644 --- a/src/bind.c +++ b/src/bind.c @@ -726,8 +726,6 @@ static int bind_xml_stats_search_zones (int version, xmlDoc *doc, /* {{{ */ for (i = 0; i < zone_nodes->nodesetval->nodeNr; i++) { - xmlNode *node; - node = zone_nodes->nodesetval->nodeTab[i]; assert (node != NULL); diff --git a/src/collectdctl.c b/src/collectdctl.c index 0b8d0c1e..478f2a4b 100644 --- a/src/collectdctl.c +++ b/src/collectdctl.c @@ -551,14 +551,14 @@ int main (int argc, char **argv) { int status; while (42) { - int c; + int n; - c = getopt (argc, argv, "s:h"); + n = getopt (argc, argv, "s:h"); - if (c == -1) + if (n == -1) break; - switch (c) { + switch (n) { case 's': snprintf (address, sizeof (address), "unix:%s", optarg); address[sizeof (address) - 1] = '\0'; diff --git a/src/liboconfig/oconfig.c b/src/liboconfig/oconfig.c index 936e3733..bb36c5e6 100644 --- a/src/liboconfig/oconfig.c +++ b/src/liboconfig/oconfig.c @@ -45,8 +45,6 @@ oconfig_item_t *oconfig_parse_fh (FILE *fh) yyset_in (fh); if (NULL == c_file) { - int status; - status = snprintf (file, sizeof (file), "", fileno (fh)); if ((status < 0) || (status >= sizeof (file))) { diff --git a/src/logfile.c b/src/logfile.c index 63448cb6..a7cda3a1 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -196,7 +196,7 @@ static int logfile_notification (const notification_t *n, #define APPEND(bufptr, buflen, key, value) \ if ((buflen > 0) && (strlen (value) > 0)) { \ - int status = ssnprintf (bufptr, buflen, ", %s = %s", key, value); \ + status = ssnprintf (bufptr, buflen, ", %s = %s", key, value); \ if (status > 0) { \ bufptr += status; \ buflen -= status; \ diff --git a/src/notify_email.c b/src/notify_email.c index 24c66ec0..76d48d44 100644 --- a/src/notify_email.c +++ b/src/notify_email.c @@ -293,7 +293,6 @@ static int notify_email_notification (const notification_t *n, /* Initiate a connection to the SMTP server and transfer the message. */ if (!smtp_start_session (session)) { - char buf[MAXSTRING]; ERROR ("notify_email plugin: SMTP server problem: %s", smtp_strerror (smtp_errno (), buf, sizeof buf)); pthread_mutex_unlock (&session_lock); diff --git a/src/ntpd.c b/src/ntpd.c index f192a826..a8f6c318 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -160,16 +160,16 @@ struct resp_pkt /* l_fp to double */ #define M_LFPTOD(r_i, r_uf, d) \ do { \ - register int32_t i; \ - register uint32_t f; \ + register int32_t ri; \ + register uint32_t rf; \ \ - i = (r_i); \ - f = (r_uf); \ - if (i < 0) { \ - M_NEG(i, f); \ - (d) = -((double) i + ((double) f) / 4294967296.0); \ + ri = (r_i); \ + rf = (r_uf); \ + if (ri < 0) { \ + M_NEG(ri, rf); \ + (d) = -((double) ri + ((double) rf) / 4294967296.0); \ } else { \ - (d) = (double) i + ((double) f) / 4294967296.0; \ + (d) = (double) ri + ((double) rf) / 4294967296.0; \ } \ } while (0) diff --git a/src/perl.c b/src/perl.c index d247dc0e..945e2258 100644 --- a/src/perl.c +++ b/src/perl.c @@ -2079,7 +2079,7 @@ static int perl_shutdown (void) return 0; if (NULL == aTHX) { - c_ithread_t *t = NULL; + t = NULL; pthread_mutex_lock (&perl_threads->mutex); t = c_ithread_create (perl_threads->head->interp); diff --git a/src/plugin.c b/src/plugin.c index 6d3d3c95..9c455417 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -1458,7 +1458,6 @@ int plugin_unregister_notification (const char *name) void plugin_init_all (void) { char const *chain_name; - long write_threads_num; llentry_t *le; int status; diff --git a/src/python.c b/src/python.c index 44292f90..d16f739c 100644 --- a/src/python.c +++ b/src/python.c @@ -386,7 +386,7 @@ static int cpy_write_callback(const data_set_t *ds, const value_list_t *value_li } dict = PyDict_New(); /* New reference. */ if (value_list->meta) { - int i, num; + int num; char **table; meta_data_t *meta = value_list->meta; diff --git a/src/utils_cache.c b/src/utils_cache.c index 5598f687..8e915883 100644 --- a/src/utils_cache.c +++ b/src/utils_cache.c @@ -737,7 +737,6 @@ int uc_get_history_by_name (const char *name, if (ce->history_length < num_steps) { gauge_t *tmp; - size_t i; tmp = realloc (ce->history, sizeof (*ce->history) * num_steps * ce->values_num);