Fix warnings about shadowed variables, and use -Wshadow in maintainer mode.
authorMichael Poole <mdpoole@troilus.org>
Fri, 6 Mar 2009 12:17:20 +0000 (07:17 -0500)
committerMichael Poole <mdpoole@troilus.org>
Fri, 6 Mar 2009 12:17:20 +0000 (07:17 -0500)
Inspired by a bug in modmcd.c's check_alias_args() spotted by the eagle
eyes of gix.

(I will omit list the function-by-function change log -- most of it is very
mechanical, and involves renaming paramaters and local variables that used
to shadow standard Unix functions.)

19 files changed:
configure.in
src/chanserv.c
src/hash.h
src/heap.c
src/log.c
src/main-common.c
src/main.c
src/md5.c
src/mod-helpserv.c
src/mod-memoserv.c
src/modcmd.c
src/nickserv.c
src/opserv.c
src/proto-bahamut.c
src/proto-common.c
src/proto-p10.c
src/sar.c
src/timeq.c
src/tools.c

index 8239c6068ac46cd25662fc39bacdfd0b9274104d..b7b8b470838c7addae39e1e90d588b52c1dc7e15 100644 (file)
@@ -357,7 +357,7 @@ fi
 MY_SUBDIRS="$MY_SUBDIRS src"
 CFLAGS="$CFLAGS $ANSI_SRC -W -Wall"
 if test "z$USE_MAINTAINER_MODE" = zyes ; then
-  CFLAGS="$CFLAGS -Werror -ansi"
+  CFLAGS="$CFLAGS -Werror -Wshadow -ansi"
 fi
 
 AC_DEFINE_UNQUOTED(CODENAME, "${CODENAME}", [Code name for this release])
index 7f21d44e98ff66888cd1efa1badec826438cc450..8ff71ab5796816dfcd9eb94b76cffdcc7505b295 100644 (file)
@@ -1117,18 +1117,18 @@ register_channel(struct chanNode *cNode, char *registrar)
 }
 
 static struct userData*
-add_channel_user(struct chanData *channel, struct handle_info *handle, unsigned short access, unsigned long seen, const char *info)
+add_channel_user(struct chanData *channel, struct handle_info *handle, unsigned short access_level, unsigned long seen, const char *info)
 {
     struct userData *ud;
 
-    if(access > UL_OWNER)
+    if(access_level > UL_OWNER)
         return NULL;
 
     ud = calloc(1, sizeof(*ud));
     ud->channel = channel;
     ud->handle = handle;
     ud->seen = seen;
-    ud->access = access;
+    ud->access = access_level;
     ud->info = info ? strdup(info) : NULL;
 
     ud->prev = NULL;
@@ -2544,7 +2544,7 @@ static CHANSERV_FUNC(cmd_adduser)
     struct userData *actee;
     struct userData *actor, *real_actor;
     struct handle_info *handle;
-    unsigned short access, override = 0;
+    unsigned short access_level, override = 0;
 
     REQUIRE_PARAMS(3);
 
@@ -2554,8 +2554,8 @@ static CHANSERV_FUNC(cmd_adduser)
         return 0;
     }
 
-    access = user_level_from_name(argv[2], UL_OWNER);
-    if(!access)
+    access_level = user_level_from_name(argv[2], UL_OWNER);
+    if(!access_level)
     {
         reply("CSMSG_INVALID_ACCESS", argv[2]);
         return 0;
@@ -2564,14 +2564,14 @@ static CHANSERV_FUNC(cmd_adduser)
     actor = GetChannelUser(channel->channel_info, user->handle_info);
     real_actor = GetChannelAccess(channel->channel_info, user->handle_info);
 
-    if(actor->access <= access)
+    if(actor->access <= access_level)
     {
         reply("CSMSG_NO_BUMP_ACCESS");
         return 0;
     }
 
     /* Trying to add someone with equal/more access? */
-    if (!real_actor || real_actor->access <= access)
+    if (!real_actor || real_actor->access <= access_level)
         override = CMD_LOG_OVERRIDE;
 
     if(!(handle = modcmd_get_handle_info(user, argv[1])))
@@ -2583,9 +2583,9 @@ static CHANSERV_FUNC(cmd_adduser)
         return 0;
     }
 
-    actee = add_channel_user(channel->channel_info, handle, access, 0, NULL);
+    actee = add_channel_user(channel->channel_info, handle, access_level, 0, NULL);
     scan_user_presence(actee, NULL);
-    reply("CSMSG_ADDED_USER", handle->handle, channel->name, access);
+    reply("CSMSG_ADDED_USER", handle->handle, channel->name, access_level);
     return 1 | override;
 }
 
@@ -2657,7 +2657,7 @@ static CHANSERV_FUNC(cmd_deluser)
     struct handle_info *handle;
     struct userData *victim;
     struct userData *actor, *real_actor;
-    unsigned short access, override = 0;
+    unsigned short access_level, override = 0;
     char *chan_name;
 
     REQUIRE_PARAMS(2);
@@ -2676,13 +2676,13 @@ static CHANSERV_FUNC(cmd_deluser)
 
     if(argc > 2)
     {
-        access = user_level_from_name(argv[1], UL_OWNER);
-        if(!access)
+        access_level = user_level_from_name(argv[1], UL_OWNER);
+        if(!access_level)
         {
             reply("CSMSG_INVALID_ACCESS", argv[1]);
             return 0;
         }
-        if(access != victim->access)
+        if(access_level != victim->access)
         {
             reply("CSMSG_INCORRECT_ACCESS", handle->handle, victim->access, argv[1]);
             return 0;
@@ -2690,7 +2690,7 @@ static CHANSERV_FUNC(cmd_deluser)
     }
     else
     {
-        access = victim->access;
+        access_level = victim->access;
     }
 
     if((actor->access <= victim->access) && !IsHelping(user))
@@ -2707,7 +2707,7 @@ static CHANSERV_FUNC(cmd_deluser)
 
     chan_name = strdup(channel->name);
     del_channel_user(victim, 1);
-    reply("CSMSG_DELETED_USER", handle->handle, access, chan_name);
+    reply("CSMSG_DELETED_USER", handle->handle, access_level, chan_name);
     free(chan_name);
     return 1 | override;
 }
@@ -3933,9 +3933,9 @@ cmd_list_users(struct userNode *user, struct chanNode *channel, unsigned int arg
     ary[3] = "Status";
     for(matches = 1; matches < lData.table.length; ++matches)
     {
-        struct userData *uData = lData.users[matches-1];
         char seen[INTERVALLEN];
 
+        uData = lData.users[matches-1];
         ary = malloc(lData.table.width*sizeof(**lData.table.contents));
         lData.table.contents[matches] = ary;
         ary[0] = strtab(uData->access);
@@ -5716,31 +5716,31 @@ static int
 channel_multiple_option(enum charOption option, struct userNode *user, struct chanNode *channel, int argc, char *argv[], struct svccmd *cmd)
 {
     struct chanData *cData = channel->channel_info;
-    int count = charOptions[option].count, index;
+    int count = charOptions[option].count, idx;
 
     if(argc > 1)
     {
-        index = atoi(argv[1]);
+        idx = atoi(argv[1]);
 
-        if(!isdigit(argv[1][0]) || (index < 0) || (index >= count))
+        if(!isdigit(argv[1][0]) || (idx < 0) || (idx >= count))
         {
-            reply("CSMSG_INVALID_NUMERIC", index);
+            reply("CSMSG_INVALID_NUMERIC", idx);
             /* Show possible values. */
-            for(index = 0; index < count; index++)
-                reply(charOptions[option].format_name, index, user_find_message(user, charOptions[option].values[index].format_name));
+            for(idx = 0; idx < count; idx++)
+                reply(charOptions[option].format_name, idx, user_find_message(user, charOptions[option].values[idx].format_name));
             return 0;
         }
 
-        cData->chOpts[option] = charOptions[option].values[index].value;
+        cData->chOpts[option] = charOptions[option].values[idx].value;
     }
     else
     {
         /* Find current option value. */
       find_value:
-        for(index = 0;
-            (index < count) && (cData->chOpts[option] != charOptions[option].values[index].value);
-            index++);
-        if(index == count)
+        for(idx = 0;
+            (idx < count) && (cData->chOpts[option] != charOptions[option].values[idx].value);
+            idx++);
+        if(idx == count)
         {
             /* Somehow, the option value is corrupt; reset it to the default. */
             cData->chOpts[option] = charOptions[option].default_value;
@@ -5748,7 +5748,7 @@ channel_multiple_option(enum charOption option, struct userNode *user, struct ch
         }
     }
 
-    reply(charOptions[option].format_name, index, user_find_message(user, charOptions[option].values[index].format_name));
+    reply(charOptions[option].format_name, idx, user_find_message(user, charOptions[option].values[idx].format_name));
     return 1;
 }
 
@@ -6098,19 +6098,19 @@ static CHANSERV_FUNC(cmd_giveownership)
 static CHANSERV_FUNC(cmd_suspend)
 {
     struct handle_info *hi;
-    struct userData *self, *real_self, *target;
+    struct userData *actor, *real_actor, *target;
     unsigned int override = 0;
 
     REQUIRE_PARAMS(2);
     if(!(hi = modcmd_get_handle_info(user, argv[1]))) return 0;
-    self = GetChannelUser(channel->channel_info, user->handle_info);
-    real_self = GetChannelAccess(channel->channel_info, user->handle_info);
+    actor = GetChannelUser(channel->channel_info, user->handle_info);
+    real_actor = GetChannelAccess(channel->channel_info, user->handle_info);
     if(!(target = GetTrueChannelAccess(channel->channel_info, hi)))
     {
         reply("CSMSG_NO_CHAN_USER", hi->handle, channel->name);
         return 0;
     }
-    if(target->access >= self->access)
+    if(target->access >= actor->access)
     {
         reply("MSG_USER_OUTRANKED", hi->handle);
         return 0;
@@ -6125,7 +6125,7 @@ static CHANSERV_FUNC(cmd_suspend)
         target->present = 0;
         target->seen = now;
     }
-    if(!real_self || target->access >= real_self->access)
+    if(!real_actor || target->access >= real_actor->access)
         override = CMD_LOG_OVERRIDE;
     target->flags |= USER_SUSPENDED;
     reply("CSMSG_USER_SUSPENDED", hi->handle, channel->name);
@@ -6135,19 +6135,19 @@ static CHANSERV_FUNC(cmd_suspend)
 static CHANSERV_FUNC(cmd_unsuspend)
 {
     struct handle_info *hi;
-    struct userData *self, *real_self, *target;
+    struct userData *actor, *real_actor, *target;
     unsigned int override = 0;
 
     REQUIRE_PARAMS(2);
     if(!(hi = modcmd_get_handle_info(user, argv[1]))) return 0;
-    self = GetChannelUser(channel->channel_info, user->handle_info);
-    real_self = GetChannelAccess(channel->channel_info, user->handle_info);
+    actor = GetChannelUser(channel->channel_info, user->handle_info);
+    real_actor = GetChannelAccess(channel->channel_info, user->handle_info);
     if(!(target = GetTrueChannelAccess(channel->channel_info, hi)))
     {
         reply("CSMSG_NO_CHAN_USER", hi->handle, channel->name);
         return 0;
     }
-    if(target->access >= self->access)
+    if(target->access >= actor->access)
     {
         reply("MSG_USER_OUTRANKED", hi->handle);
         return 0;
@@ -6157,7 +6157,7 @@ static CHANSERV_FUNC(cmd_unsuspend)
         reply("CSMSG_NOT_SUSPENDED", hi->handle);
         return 0;
     }
-    if(!real_self || target->access >= real_self->access)
+    if(!real_actor || target->access >= real_actor->access)
         override = CMD_LOG_OVERRIDE;
     target->flags &= ~USER_SUSPENDED;
     scan_user_presence(target, NULL);
@@ -6170,7 +6170,7 @@ static MODCMD_FUNC(cmd_deleteme)
     struct handle_info *hi;
     struct userData *target;
     const char *confirm_string;
-    unsigned short access;
+    unsigned short access_level;
     char *channel_name;
 
     hi = user->handle_info;
@@ -6190,10 +6190,10 @@ static MODCMD_FUNC(cmd_deleteme)
         reply("CSMSG_CONFIRM_DELETEME", confirm_string);
         return 0;
     }
-    access = target->access;
+    access_level = target->access;
     channel_name = strdup(channel->name);
     del_channel_user(target, 1);
-    reply("CSMSG_DELETED_YOU", access, channel_name);
+    reply("CSMSG_DELETED_YOU", access_level, channel_name);
     free(channel_name);
     return 1;
 }
@@ -6201,7 +6201,7 @@ static MODCMD_FUNC(cmd_deleteme)
 static void
 chanserv_refresh_topics(UNUSED_ARG(void *data))
 {
-    unsigned int refresh_num = (now - self->link) / chanserv_conf.refresh_period;
+    unsigned int refresh_num = (now - self->link_time) / chanserv_conf.refresh_period;
     struct chanData *cData;
     char opt;
 
@@ -6628,28 +6628,28 @@ handle_auth(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle))
 
     for(ii = 0; ii < user->channels.used; ++ii)
     {
-        struct chanNode *channel = user->channels.list[ii]->channel;
+        struct chanNode *chan = user->channels.list[ii]->channel;
         struct banData *ban;
 
         if((user->channels.list[ii]->modes & (MODE_CHANOP|MODE_VOICE))
-           || !channel->channel_info
-           || IsSuspended(channel->channel_info))
+           || !chan->channel_info
+           || IsSuspended(chan->channel_info))
             continue;
-        for(jj = 0; jj < channel->banlist.used; ++jj)
-            if(user_matches_glob(user, channel->banlist.list[jj]->ban, MATCH_USENICK))
+        for(jj = 0; jj < chan->banlist.used; ++jj)
+            if(user_matches_glob(user, chan->banlist.list[jj]->ban, MATCH_USENICK))
                 break;
-        if(jj < channel->banlist.used)
+        if(jj < chan->banlist.used)
             continue;
-        for(ban = channel->channel_info->bans; ban; ban = ban->next)
+        for(ban = chan->channel_info->bans; ban; ban = ban->next)
         {
             char kick_reason[MAXLEN];
             if(!user_matches_glob(user, ban->mask, MATCH_USENICK | MATCH_VISIBLE))
                 continue;
             change.args[0].mode = MODE_BAN;
             change.args[0].u.hostmask = ban->mask;
-            mod_chanmode_announce(chanserv, channel, &change);
+            mod_chanmode_announce(chanserv, chan, &change);
             sprintf(kick_reason, "(%s) %s", ban->owner, ban->reason);
-            KickChannelUser(user, channel, chanserv, kick_reason);
+            KickChannelUser(user, chan, chanserv, kick_reason);
             ban->triggered = now;
             break;
         }
@@ -7034,7 +7034,6 @@ chanserv_conf_read(void)
             /* delimiter */
             NULL
         };
-        unsigned int ii;
         strlist = alloc_string_list(ArrayLength(list)-1);
         for(ii=0; list[ii]; ii++)
             string_list_append(strlist, strdup(list[ii]));
@@ -7133,7 +7132,7 @@ user_read_helper(const char *key, struct record_data *rd, struct chanData *chan)
     struct userData *uData;
     char *seen, *inf, *flags;
     unsigned long last_seen;
-    unsigned short access;
+    unsigned short access_level;
 
     if(rd->type != RECDB_OBJECT || !dict_size(rd->d.object))
     {
@@ -7141,8 +7140,8 @@ user_read_helper(const char *key, struct record_data *rd, struct chanData *chan)
         return;
     }
 
-    access = atoi(database_get_data(rd->d.object, KEY_LEVEL, RECDB_QSTRING));
-    if(access > UL_OWNER)
+    access_level = atoi(database_get_data(rd->d.object, KEY_LEVEL, RECDB_QSTRING));
+    if(access_level > UL_OWNER)
     {
         log_module(CS_LOG, LOG_ERROR, "Invalid access level for %s in %s.", key, chan->channel->name);
         return;
@@ -7159,7 +7158,7 @@ user_read_helper(const char *key, struct record_data *rd, struct chanData *chan)
         return;
     }
 
-    uData = add_channel_user(chan, handle, access, last_seen, inf);
+    uData = add_channel_user(chan, handle, access_level, last_seen, inf);
     uData->flags = flags ? strtoul(flags, NULL, 0) : 0;
 }
 
index 0611f841ee79637b3153275c7116ae18f9ec5cd0..71b925182bba7f945faff809e66b2fbb0e2c7891 100644 (file)
@@ -170,7 +170,7 @@ struct modeNode {
 struct server {
     char name[SERVERNAMEMAX+1];
     unsigned long boot;
-    unsigned long link;
+    unsigned long link_time;
     char description[SERVERDESCRIPTMAX+1];
 #ifdef WITH_PROTOCOL_P10
     char numeric[COMBO_NUMERIC_LEN+1];
index dce909a4bda827fcba499752da3bbece199248d3..ad97dacc02448b16e949dc23917980d8df2f15c1 100644 (file)
@@ -55,23 +55,24 @@ heap_new(comparator_f comparator)
  *  its value).
  */
 static void
-heap_heapify_up(heap_t heap, unsigned int index)
+heap_heapify_up(heap_t heap, unsigned int idx)
 {
     int res;
     unsigned int parent;
     void *last_key, *last_data;
-    last_key = heap->data[index*2];
-    last_data = heap->data[index*2+1];
-    while (index > 0) {
-        parent = (index - 1) >> 1;
+
+    last_key = heap->data[idx*2];
+    last_data = heap->data[idx*2+1];
+    while (idx > 0) {
+        parent = (idx - 1) >> 1;
         res = heap->comparator(last_key, heap->data[parent*2]);
         if (res > 0) break;
-        heap->data[index*2] = heap->data[parent*2];
-        heap->data[index*2+1] = heap->data[parent*2+1];
-        index = parent;
+        heap->data[idx*2] = heap->data[parent*2];
+        heap->data[idx*2+1] = heap->data[parent*2+1];
+        idx = parent;
     }
-    heap->data[index*2] = last_key;
-    heap->data[index*2+1] = last_data;
+    heap->data[idx*2] = last_key;
+    heap->data[idx*2+1] = last_data;
 }
 
 /*
@@ -131,20 +132,20 @@ heap_heapify_down(heap_t heap, int pos)
 }
 
 /*
- * Remove the element at "index" from the heap (preserving the heap ordering).
+ * Remove the element at "idx" from the heap (preserving the heap ordering).
  */
 static void
-heap_remove(heap_t heap, unsigned int index)
+heap_remove(heap_t heap, unsigned int idx)
 {
     /* sanity check */
-    if (heap->data_used <= index) return;
-    /* swap index with last element */
+    if (heap->data_used <= idx) return;
+    /* swap idx with last element */
     heap->data_used--;
-    heap->data[index*2] = heap->data[heap->data_used*2];
-    heap->data[index*2+1] = heap->data[heap->data_used*2+1];
-    /* heapify down if index has children */
-    if (heap->data_used >= 2*index+1) heap_heapify_down(heap, index);
-    if ((index > 0) && (index < heap->data_used)) heap_heapify_up(heap, index);
+    heap->data[idx*2] = heap->data[heap->data_used*2];
+    heap->data[idx*2+1] = heap->data[heap->data_used*2+1];
+    /* heapify down if idx has children */
+    if (heap->data_used >= 2*idx+1) heap_heapify_down(heap, idx);
+    if ((idx > 0) && (idx < heap->data_used)) heap_heapify_up(heap, idx);
 }
 
 /*
index 736360d91582709ddab4422dbdf9142d5b7b45f1..4ea72cf54516ec3db300be79423f2ec74d99bb0f 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -148,14 +148,14 @@ logList_join(struct logList *target, const struct logList *source)
     target->size += source->used;
     target->list = realloc(target->list, target->size * sizeof(target->list[0]));
     for (ii = 0; ii < source->used; ++ii, ++jj) {
-        int dup;
-        for (dup = 0, kk = 0; kk < jj; kk++) {
+        int is_duplicate;
+        for (is_duplicate = 0, kk = 0; kk < jj; kk++) {
             if (target->list[kk] == source->list[ii]) {
-                dup = 1;
+                is_duplicate = 1;
                 break;
             }
         }
-        if (dup) {
+        if (is_duplicate) {
             jj--;
             target->used--;
             continue;
@@ -319,14 +319,14 @@ log_parse_sevset(char *buffer, char targets[LOG_NUM_SEVERITIES])
 static void
 log_parse_cross(const char *buffer, struct string_list *types, char sevset[LOG_NUM_SEVERITIES])
 {
-    char *dup, *sep;
+    char *buffer_copy, *sep;
 
-    dup = strdup(buffer);
-    sep = strchr(dup, '.');
+    buffer_copy = strdup(buffer);
+    sep = strchr(buffer_copy, '.');
     *sep++ = 0;
-    log_parse_logset(dup, types);
+    log_parse_logset(buffer_copy, types);
     log_parse_sevset(sep, sevset);
-    free(dup);
+    free(buffer_copy);
 }
 
 static void
@@ -832,51 +832,51 @@ ldFile_open(const char *args) {
 }
 
 static void
-ldFile_reopen(struct logDestination *self_) {
-    struct logDest_file *self = (struct logDest_file*)self_;
-    fclose(self->output);
-    self->output = fopen(self->fname, "a");
+ldFile_reopen(struct logDestination *dest_) {
+    struct logDest_file *dest = (struct logDest_file*)dest_;
+    fclose(dest->output);
+    dest->output = fopen(dest->fname, "a");
 }
 
 static void
-ldFile_close(struct logDestination *self_) {
-    struct logDest_file *self = (struct logDest_file*)self_;
-    fclose(self->output);
-    free(self->fname);
-    free(self);
+ldFile_close(struct logDestination *dest_) {
+    struct logDest_file *dest = (struct logDest_file*)dest_;
+    fclose(dest->output);
+    free(dest->fname);
+    free(dest);
 }
 
 static void
-ldFile_audit(struct logDestination *self_, UNUSED_ARG(struct log_type *type), struct logEntry *entry) {
-    struct logDest_file *self = (struct logDest_file*)self_;
-    fputs(entry->default_desc, self->output);
-    fputc('\n', self->output);
-    fflush(self->output);
+ldFile_audit(struct logDestination *dest_, UNUSED_ARG(struct log_type *type), struct logEntry *entry) {
+    struct logDest_file *dest = (struct logDest_file*)dest_;
+    fputs(entry->default_desc, dest->output);
+    fputc('\n', dest->output);
+    fflush(dest->output);
 }
 
 static void
-ldFile_replay(struct logDestination *self_, UNUSED_ARG(struct log_type *type), int is_write, const char *line) {
-    struct logDest_file *self = (struct logDest_file*)self_;
+ldFile_replay(struct logDestination *dest_, UNUSED_ARG(struct log_type *type), int is_write, const char *line) {
+    struct logDest_file *dest = (struct logDest_file*)dest_;
     struct string_buffer sbuf;
     memset(&sbuf, 0, sizeof(sbuf));
     log_format_timestamp(now, &sbuf);
     string_buffer_append_string(&sbuf, is_write ? "W: " : "   ");
     string_buffer_append_string(&sbuf, line);
-    fputs(sbuf.list, self->output);
-    fputc('\n', self->output);
+    fputs(sbuf.list, dest->output);
+    fputc('\n', dest->output);
     free(sbuf.list);
-    fflush(self->output);
+    fflush(dest->output);
 }
 
 static void
-ldFile_module(struct logDestination *self_, struct log_type *type, enum log_severity sev, const char *message) {
-    struct logDest_file *self = (struct logDest_file*)self_;
+ldFile_module(struct logDestination *dest_, struct log_type *type, enum log_severity sev, const char *message) {
+    struct logDest_file *dest = (struct logDest_file*)dest_;
     struct string_buffer sbuf;
     memset(&sbuf, 0, sizeof(sbuf));
     log_format_timestamp(now, &sbuf);
-    fprintf(self->output, "%s (%s:%s) %s\n", sbuf.list, type->name, log_severity_names[sev], message);
+    fprintf(dest->output, "%s (%s:%s) %s\n", sbuf.list, type->name, log_severity_names[sev], message);
     free(sbuf.list);
-    fflush(self->output);
+    fflush(dest->output);
 }
 
 static struct logDest_vtable ldFile_vtbl = {
@@ -912,22 +912,22 @@ ldStd_open(const char *args) {
 }
 
 static void
-ldStd_close(struct logDestination *self_) {
-    struct logDest_file *self = (struct logDest_file*)self_;
-    free(self->fname);
-    free(self);
+ldStd_close(struct logDestination *dest_) {
+    struct logDest_file *dest = (struct logDest_file*)dest_;
+    free(dest->fname);
+    free(dest);
 }
 
 static void
-ldStd_replay(struct logDestination *self_, UNUSED_ARG(struct log_type *type), int is_write, const char *line) {
-    struct logDest_file *self = (struct logDest_file*)self_;
-    fprintf(self->output, "%s%s\n", is_write ? "W: " : "   ", line);
+ldStd_replay(struct logDestination *dest_, UNUSED_ARG(struct log_type *type), int is_write, const char *line) {
+    struct logDest_file *dest = (struct logDest_file*)dest_;
+    fprintf(dest->output, "%s%s\n", is_write ? "W: " : "   ", line);
 }
 
 static void
-ldStd_module(struct logDestination *self_, UNUSED_ARG(struct log_type *type), enum log_severity sev, const char *message) {
-    struct logDest_file *self = (struct logDest_file*)self_;
-    fprintf(self->output, "%s: %s\n", log_severity_names[sev], message);
+ldStd_module(struct logDestination *dest_, UNUSED_ARG(struct log_type *type), enum log_severity sev, const char *message) {
+    struct logDest_file *dest = (struct logDest_file*)dest_;
+    fprintf(dest->output, "%s: %s\n", log_severity_names[sev], message);
 }
 
 static struct logDest_vtable ldStd_vtbl = {
@@ -958,29 +958,29 @@ ldIrc_open(const char *args) {
 }
 
 static void
-ldIrc_close(struct logDestination *self_) {
-    struct logDest_irc *self = (struct logDest_irc*)self_;
-    free(self->target);
-    free(self);
+ldIrc_close(struct logDestination *dest_) {
+    struct logDest_irc *dest = (struct logDest_irc*)dest_;
+    free(dest->target);
+    free(dest);
 }
 
 static void
-ldIrc_audit(struct logDestination *self_, UNUSED_ARG(struct log_type *type), struct logEntry *entry) {
-    struct logDest_irc *self = (struct logDest_irc*)self_;
+ldIrc_audit(struct logDestination *dest_, UNUSED_ARG(struct log_type *type), struct logEntry *entry) {
+    struct logDest_irc *dest = (struct logDest_irc*)dest_;
 
     if (entry->channel_name) {
-        send_target_message(4, self->target, entry->bot, "(%s", strchr(strchr(entry->default_desc, ' '), ':')+1);
+        send_target_message(4, dest->target, entry->bot, "(%s", strchr(strchr(entry->default_desc, ' '), ':')+1);
     } else {
-        send_target_message(4, self->target, entry->bot, "%s", strchr(entry->default_desc, ')')+2);
+        send_target_message(4, dest->target, entry->bot, "%s", strchr(entry->default_desc, ')')+2);
     }
 }
 
 static void
-ldIrc_module(struct logDestination *self_, struct log_type *type, enum log_severity sev, const char *message) {
-    struct logDest_irc *self = (struct logDest_irc*)self_;
+ldIrc_module(struct logDestination *dest_, struct log_type *type, enum log_severity sev, const char *message) {
+    struct logDest_irc *dest = (struct logDest_irc*)dest_;
     extern struct userNode *opserv;
 
-    send_target_message(4, self->target, opserv, "%s %s: %s\n", type->name, log_severity_names[sev], message);
+    send_target_message(4, dest->target, opserv, "%s %s: %s\n", type->name, log_severity_names[sev], message);
 }
 
 static struct logDest_vtable ldIrc_vtbl = {
index 1c8d06212aa4e5d6f2c3298d13bb543fae32e4f3..229088b7b3155add24428b768b37ac59295f14df 100644 (file)
@@ -532,7 +532,7 @@ conf_rlimits(void)
 #endif
 
 static void
-usage(char *self)
+usage(char *exe_name)
 {
     /* We can assume we have getopt_long(). */
     printf("Usage: %s [-c config] [-r log] [-d] [-f] [-v|-h]\n"
@@ -543,7 +543,7 @@ usage(char *self)
            " -k, --check          checks the configuration file's syntax.\n"
            " -r, --replay         replay a log file (for debugging).\n"
            " -v, --version        prints this program's version.\n"
-           , self);
+           , exe_name);
 }
 
 static void
index ec0bde8985d4bb2e3d416581c1dd002fe27ab27b..6db248274f77b7177c4fcc8231ea6777fe63d7f9 100644 (file)
@@ -101,7 +101,8 @@ gc_warn_proc(char *msg, GC_word arg)
 
 int main(int argc, char *argv[])
 {
-    int daemon, debug;
+    int run_as_daemon;
+    int debug;
     pid_t pid = 0;
     FILE *file_out;
     struct sigaction sv;
@@ -112,7 +113,7 @@ int main(int argc, char *argv[])
     GC_enable_incremental();
 #endif
 
-    daemon = 1;
+    run_as_daemon = 1;
     debug = 0;
     tools_init();
 
@@ -168,7 +169,7 @@ int main(int argc, char *argv[])
                 debug = 1;
                 break;
             case 'f':
-                daemon = 0;
+                run_as_daemon = 0;
                 break;
             case 'v':
                 version();
@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
 
     conf_register_reload(uplink_compile);
 
-    if (daemon) {
+    if (run_as_daemon) {
         /* Attempt to fork into the background if daemon mode is on. */
         pid = fork();
         if (pid < 0) {
@@ -223,7 +224,7 @@ int main(int argc, char *argv[])
         fclose(file_out);
     }
 
-    if (daemon) {
+    if (run_as_daemon) {
         /* Close these since we should not use them from now on. */
         fclose(stdin);
         fclose(stdout);
index 4f8ce80e1eb356d0902210249955fcf14c3e43d6..fe5495fe8a580360aee4926a650c69ad0d086654 100644 (file)
--- a/src/md5.c
+++ b/src/md5.c
@@ -111,10 +111,10 @@ MD5_CTX *context;                                        /* context */
 unsigned char *input;                                /* input block */
 unsigned int inputLen;                     /* length of input block */
 {
-  unsigned int i, index, partLen;
+  unsigned int i, idx, partLen;
 
   /* Compute number of bytes mod 64 */
-  index = (unsigned int)((context->count[0] >> 3) & 0x3F);
+  idx = (unsigned int)((context->count[0] >> 3) & 0x3F);
 
   /* Update number of bits */
   if ((context->count[0] += ((UINT4)inputLen << 3))
@@ -122,23 +122,23 @@ unsigned int inputLen;                     /* length of input block */
       context->count[1]++;
   context->count[1] += ((UINT4)inputLen >> 29);
 
-  partLen = 64 - index;
+  partLen = 64 - idx;
 
   /* Transform as many times as possible. */
   if (inputLen >= partLen) {
-      memcpy((POINTER)&context->buffer[index], (POINTER)input, partLen);
+      memcpy((POINTER)&context->buffer[idx], (POINTER)input, partLen);
       MD5Transform (context->state, context->buffer);
 
       for (i = partLen; i + 63 < inputLen; i += 64)
           MD5Transform (context->state, &input[i]);
 
-      index = 0;
+      idx = 0;
   }
   else
     i = 0;
 
   /* Buffer remaining input */
-  memcpy((POINTER)&context->buffer[index], (POINTER)&input[i],
+  memcpy((POINTER)&context->buffer[idx], (POINTER)&input[i],
   inputLen-i);
 }
 
@@ -150,14 +150,14 @@ unsigned char digest[16];                         /* message digest */
 MD5_CTX *context;                                       /* context */
 {
   unsigned char bits[8];
-  unsigned int index, padLen;
+  unsigned int idx, padLen;
 
   /* Save number of bits */
   Encode (bits, context->count, 8);
 
   /* Pad out to 56 mod 64. */
-  index = (unsigned int)((context->count[0] >> 3) & 0x3f);
-  padLen = (index < 56) ? (56 - index) : (120 - index);
+  idx = (unsigned int)((context->count[0] >> 3) & 0x3f);
+  padLen = (idx < 56) ? (56 - idx) : (120 - idx);
   MD5Update (context, PADDING, padLen);
 
   /* Append length (before padding) */
@@ -354,20 +354,20 @@ cryptpass(const char *pass, char *buffer)
 }
 
 int
-checkpass(const char *pass, const char *crypt)
+checkpass(const char *pass, const char *crypted)
 {
-    char new_crypt[MD5_CRYPT_LENGTH], hseed[9];
+    char new_crypted[MD5_CRYPT_LENGTH], hseed[9];
     int seed;
 
-    if (crypt[0] == '$') {
+    if (crypted[0] == '$') {
         /* new-style crypt, use "seed" after '$' */
-        strncpy(hseed, crypt+1, 8);
+        strncpy(hseed, crypted+1, 8);
         hseed[8] = 0;
         seed = strtoul(hseed, NULL, 16);
     } else {
         /* old-style crypt, use "seed" of 0 */
         seed = 0;
     }
-    cryptpass_real(pass, new_crypt, seed);
-    return !strcmp(crypt, new_crypt);
+    cryptpass_real(pass, new_crypted, seed);
+    return !strcmp(crypted, new_crypted);
 }
index be2a7623e0180ea94ea1242a9c7478bb20e28fd0..08010cc37ec2c231d961e119e0a0a16665f4b272 100644 (file)
@@ -848,7 +848,7 @@ static struct helpserv_request * smart_get_request(struct helpserv_bot *hs, stru
 
 static struct helpserv_request * create_request(struct userNode *user, struct helpserv_bot *hs, int from_join) {
     struct helpserv_request *req = calloc(1, sizeof(struct helpserv_request));
-    char lbuf[3][MAX_LINE_SIZE], unh[INTERVALLEN];
+    char lbuf[3][MAX_LINE_SIZE], req_id[INTERVALLEN];
     struct helpserv_reqlist *reqlist, *hand_reqlist;
     const unsigned int from_opserv = 0;
     const char *fmt;
@@ -856,8 +856,8 @@ static struct helpserv_request * create_request(struct userNode *user, struct he
     assert(req);
 
     req->id = ++hs->last_requestid;
-    sprintf(unh, "%lu", req->id);
-    dict_insert(hs->requests, strdup(unh), req);
+    sprintf(req_id, "%lu", req->id);
+    dict_insert(hs->requests, strdup(req_id), req);
 
     if (hs->id_wrap) {
         unsigned long i;
@@ -951,9 +951,9 @@ static struct helpserv_request * create_request(struct userNode *user, struct he
         sprintf(lbuf[0], fmt, req->id);
     }
     if (req != hs->unhandled) {
-        intervalString(unh, now - hs->unhandled->opened, user->handle_info);
+        intervalString(req_id, now - hs->unhandled->opened, user->handle_info);
         fmt = user_find_message(user, "HSMSG_REQ_UNHANDLED_TIME");
-        sprintf(lbuf[1], fmt, unh);
+        sprintf(lbuf[1], fmt, req_id);
     } else {
         fmt = user_find_message(user, "HSMSG_REQ_NO_UNHANDLED");
         sprintf(lbuf[1], "%s", fmt);
@@ -3721,10 +3721,10 @@ static void helpserv_conf_read(void) {
 }
 
 static struct helpserv_cmd *
-helpserv_define_func(const char *name, helpserv_func_t *func, enum helpserv_level access, long flags) {
+helpserv_define_func(const char *name, helpserv_func_t *func, enum helpserv_level level, long flags) {
     struct helpserv_cmd *cmd = calloc(1, sizeof(struct helpserv_cmd));
 
-    cmd->access = access;
+    cmd->access = level;
     cmd->weight = 1.0;
     cmd->func = func;
     cmd->flags = flags;
@@ -3793,9 +3793,9 @@ static void handle_part(struct modeNode *mn, UNUSED_ARG(const char *reason)) {
 
                 if ((hs->persist_types[PERSIST_T_HELPER] == PERSIST_PART)
                     && (req->helper == hs_user)) {
-                    char reason[CHANNELLEN + 8];
-                    sprintf(reason, "parted %s", mn->channel->name);
-                    helpserv_page_helper_gone(hs, req, reason);
+                    char our_reason[CHANNELLEN + 8];
+                    sprintf(our_reason, "parted %s", mn->channel->name);
+                    helpserv_page_helper_gone(hs, req, our_reason);
                 }
             }
 
index 7b1dc3df4ade77077fce32b303f62c2b3d55c9b1..d580b6650e986d59087771aaa44131896aa8bfdd 100644 (file)
@@ -167,10 +167,10 @@ do_expire(void)
 {
     dict_iterator_t it;
     for (it = dict_first(memos); it; it = iter_next(it)) {
-        struct memo_account *acct = iter_data(it);
+        struct memo_account *account = iter_data(it);
         unsigned int ii;
-        for (ii = 0; ii < acct->sent.used; ++ii) {
-            struct memo *memo = acct->sent.list[ii];
+        for (ii = 0; ii < account->sent.used; ++ii) {
+            struct memo *memo = account->sent.list[ii];
             if ((now - memo->sent) > memoserv_conf.message_expiry) {
                 delete_memo(memo);
                 memosExpired++;
@@ -209,19 +209,19 @@ add_memo(unsigned long sent, struct memo_account *recipient, struct memo_account
 }
 
 static int
-memoserv_can_send(struct userNode *bot, struct userNode *user, struct memo_account *acct)
+memoserv_can_send(struct userNode *bot, struct userNode *user, struct memo_account *account)
 {
     extern struct userData *_GetChannelUser(struct chanData *channel, struct handle_info *handle, int override, int allow_suspended);
     struct userData *dest;
 
     if (!user->handle_info)
         return 0;
-    if (!(acct->flags & MEMO_DENY_NONCHANNEL))
+    if (!(account->flags & MEMO_DENY_NONCHANNEL))
         return 1;
-    for (dest = acct->handle->channels; dest; dest = dest->u_next)
+    for (dest = account->handle->channels; dest; dest = dest->u_next)
         if (_GetChannelUser(dest->channel, user->handle_info, 1, 0))
             return 1;
-    send_message(user, bot, "MSMSG_CANNOT_SEND", acct->handle->handle);
+    send_message(user, bot, "MSMSG_CANNOT_SEND", account->handle->handle);
     return 0;
 }
 
index da6826a71d88042c561195261f784fa3751f5623..53bb49004c489850afbf2ff6202f71c726357430 100644 (file)
@@ -137,7 +137,7 @@ struct userData *_GetChannelUser(struct chanData *channel, struct handle_info *h
 static struct modcmd_flag {
     const char *name;
     unsigned int flag;
-} flags[] = {
+} modcmd_flags[] = {
     { "acceptchan", MODCMD_ACCEPT_CHANNEL },
     { "acceptpluschan", MODCMD_ACCEPT_PCHANNEL },
     { "authed", MODCMD_REQUIRE_AUTHED },
@@ -323,7 +323,7 @@ svccmd_configure(struct svccmd *cmd, struct userNode *user, struct userNode *bot
                 return 0;
             }
             value++;
-            flag = bsearch(value, flags, ArrayLength(flags)-1, sizeof(flags[0]), flags_bsearch);
+            flag = bsearch(value, modcmd_flags, ArrayLength(modcmd_flags)-1, sizeof(modcmd_flags[0]), flags_bsearch);
             if (!flag) {
                 if (user)
                     send_message(user, bot, "MCMSG_UNKNOWN_FLAG", end, value);
@@ -990,9 +990,9 @@ check_alias_args(char *argv[], unsigned int argc) {
             continue;
         } else if (isdigit(argv[arg][1])) {
             char *end_num;
-            unsigned long arg;
+            unsigned long tmp;
 
-            arg = strtoul(argv[arg]+1, &end_num, 10);
+            tmp = strtoul(argv[arg]+1, &end_num, 10);
             switch (end_num[0]) {
             case 0:
                 continue;
@@ -1385,18 +1385,19 @@ modcmd_describe_command(struct userNode *user, struct svccmd *cmd, struct svccmd
         snprintf(buf1, sizeof(buf1), "%s.%s", target->command->parent->name, target->command->name);
         reply("MCMSG_COMMAND_BINDING", target->name, buf1);
     }
-    for (ii = buf1_used = buf2_used = 0; flags[ii].name; ++ii) {
-        if (target->flags & flags[ii].flag) {
+    for (ii = buf1_used = buf2_used = 0; modcmd_flags[ii].name; ++ii) {
+        const struct modcmd_flag *flag = &modcmd_flags[ii];
+        if (target->flags & flag->flag) {
             if (buf1_used)
                 buf1[buf1_used++] = ',';
-            len = strlen(flags[ii].name);
-            memcpy(buf1 + buf1_used, flags[ii].name, len);
+            len = strlen(flag->name);
+            memcpy(buf1 + buf1_used, flag->name, len);
             buf1_used += len;
-        } else if (target->effective_flags & flags[ii].flag) {
+        } else if (target->effective_flags & flag->flag) {
             if (buf2_used)
                 buf2[buf2_used++] = ',';
-            len = strlen(flags[ii].name);
-            memcpy(buf2 + buf2_used, flags[ii].name, len);
+            len = strlen(flag->name);
+            memcpy(buf2 + buf2_used, flag->name, len);
             buf2_used += len;
         }
     }
@@ -1685,20 +1686,20 @@ static MODCMD_FUNC(cmd_showcommands) {
         if (show_opserv_level)
             tbl.contents[ii+1][1] = strtab(svccmd->min_opserv_level);
         if (show_channel_access) {
-            const char *access;
+            const char *access_name;
             int flags = svccmd->effective_flags;
             if (flags & MODCMD_REQUIRE_HELPING)
-                access = "helping";
+                access_name = "helping";
             else if (flags & MODCMD_REQUIRE_STAFF) {
                 if (flags & MODCMD_REQUIRE_OPER)
-                    access = "oper";
+                    access_name = "oper";
                 else if (flags & MODCMD_REQUIRE_NETWORK_HELPER)
-                    access = "net.helper";
+                    access_name = "net.helper";
                 else
-                    access = "staff";
+                    access_name = "staff";
             } else
-                access = strtab(svccmd->min_channel_access);
-            tbl.contents[ii+1][1+show_opserv_level] = access;
+                access_name = strtab(svccmd->min_channel_access);
+            tbl.contents[ii+1][1+show_opserv_level] = access_name;
         }
     }
     svccmd_list_clean(&commands);
@@ -1923,11 +1924,12 @@ modcmd_saxdb_write_command(struct saxdb_context *ctx, struct svccmd *cmd) {
         saxdb_write_int(ctx, "channel_access", cmd->min_channel_access);
     if (cmd->flags != template->flags) {
         if (cmd->flags) {
-            for (nn=pos=0; flags[nn].name; ++nn) {
-                if (cmd->flags & flags[nn].flag) {
+            for (nn=pos=0; modcmd_flags[nn].name; ++nn) {
+                const struct modcmd_flag *flag = &modcmd_flags[nn];
+                if (cmd->flags & flag->flag) {
                     buf[pos++] = '+';
-                    len = strlen(flags[nn].name);
-                    memcpy(buf+pos, flags[nn].name, len);
+                    len = strlen(flag->name);
+                    memcpy(buf+pos, flag->name, len);
                     pos += len;
                     buf[pos++] = ',';
                 }
@@ -2101,7 +2103,7 @@ modcmd_conf_read(void) {
 
 void
 modcmd_init(void) {
-    qsort(flags, ArrayLength(flags)-1, sizeof(flags[0]), flags_qsort);
+    qsort(modcmd_flags, ArrayLength(modcmd_flags)-1, sizeof(modcmd_flags[0]), flags_qsort);
     modules = dict_new();
     dict_set_free_data(modules, free_module);
     services = dict_new();
index 5a5c7f5a770334dd526c1c87e794a4e39db0df69..c4fe61883031c051af57f59fab2592e177eff5f6 100644 (file)
@@ -957,9 +957,9 @@ set_user_handle_info(struct userNode *user, struct handle_info *hi, int stamp)
 
         if (stamp) {
             if (!nickserv_conf.disable_nicks) {
-                struct nick_info *ni;
-                for (ni = hi->nicks; ni; ni = ni->next) {
-                    if (!irccasecmp(user->nick, ni->nick)) {
+                struct nick_info *ni2;
+                for (ni2 = hi->nicks; ni2; ni2 = ni2->next) {
+                    if (!irccasecmp(user->nick, ni2->nick)) {
                         user->modes |= FLAGS_REGNICK;
                         break;
                     }
@@ -1458,20 +1458,20 @@ static NICKSERV_FUNC(cmd_handleinfo)
     }
 
     if (hi->channels) {
-        struct userData *channel, *next;
+        struct userData *chan, *next;
         char *name;
 
-        for (channel = hi->channels; channel; channel = next) {
-            next = channel->u_next;
-            name = channel->channel->channel->name;
+        for (chan = hi->channels; chan; chan = next) {
+            next = chan->u_next;
+            name = chan->channel->channel->name;
             herelen = strlen(name);
             if (pos + herelen + 7 > ArrayLength(buff)) {
-                next = channel;
+                next = chan;
                 goto print_chans_buff;
             }
-            if (IsUserSuspended(channel))
+            if (IsUserSuspended(chan))
                 buff[pos++] = '-';
-            pos += sprintf(buff+pos, "%d:%s ", channel->access, name);
+            pos += sprintf(buff+pos, "%d:%s ", chan->access, name);
             if (next == NULL) {
               print_chans_buff:
                 buff[pos-1] = 0;
@@ -3485,7 +3485,7 @@ nickserv_db_read_handle(const char *handle, dict_t obj)
     struct string_list *masks, *slist;
     struct handle_info *hi;
     struct userNode *authed_users;
-    struct userData *channels;
+    struct userData *channel_list;
     unsigned long id;
     unsigned int ii;
     dict_t subdb;
@@ -3499,13 +3499,13 @@ nickserv_db_read_handle(const char *handle, dict_t obj)
     }
     if ((hi = get_handle_info(handle))) {
         authed_users = hi->users;
-        channels = hi->channels;
+        channel_list = hi->channels;
         hi->users = NULL;
         hi->channels = NULL;
         dict_remove(nickserv_handle_dict, hi->handle);
     } else {
         authed_users = NULL;
-        channels = NULL;
+        channel_list = NULL;
     }
     hi = register_handle(handle, str, id);
     if (authed_users) {
@@ -3515,7 +3515,7 @@ nickserv_db_read_handle(const char *handle, dict_t obj)
             authed_users = authed_users->next_authed;
         }
     }
-    hi->channels = channels;
+    hi->channels = channel_list;
     masks = database_get_data(obj, KEY_MASKS, RECDB_STRING_LIST);
     hi->masks = masks ? string_list_copy(masks) : alloc_string_list(1);
     str = database_get_data(obj, KEY_MAXLOGINS, RECDB_QSTRING);
@@ -3618,13 +3618,13 @@ nickserv_db_read_handle(const char *handle, dict_t obj)
             const char *setter;
             const char *text;
             const char *set;
-            const char *id;
+            const char *note_id;
             dict_t notedb;
 
-            id = iter_key(it);
+            note_id = iter_key(it);
             notedb = GET_RECORD_OBJECT((struct record_data*)iter_data(it));
             if (!notedb) {
-                log_module(NS_LOG, LOG_ERROR, "Malformed note %s for account %s; ignoring note.", id, hi->handle);
+                log_module(NS_LOG, LOG_ERROR, "Malformed note %s for account %s; ignoring note.", note_id, hi->handle);
                 continue;
             }
             expires = database_get_data(notedb, KEY_NOTE_EXPIRES, RECDB_QSTRING);
@@ -3632,14 +3632,14 @@ nickserv_db_read_handle(const char *handle, dict_t obj)
             text = database_get_data(notedb, KEY_NOTE_NOTE, RECDB_QSTRING);
             set = database_get_data(notedb, KEY_NOTE_SET, RECDB_QSTRING);
             if (!setter || !text || !set) {
-                log_module(NS_LOG, LOG_ERROR, "Missing field(s) from note %s for account %s; ignoring note.", id, hi->handle);
+                log_module(NS_LOG, LOG_ERROR, "Missing field(s) from note %s for account %s; ignoring note.", note_id, hi->handle);
                 continue;
             }
             note = calloc(1, sizeof(*note) + strlen(text));
             note->next = NULL;
             note->expires = expires ? strtoul(expires, NULL, 10) : 0;
             note->set = strtoul(set, NULL, 10);
-            note->id = strtoul(id, NULL, 10);
+            note->id = strtoul(note_id, NULL, 10);
             safestrncpy(note->setter, setter, sizeof(note->setter));
             strcpy(note->note, text);
             if (last_note)
index 25a48daa0966f67558db0ca70fc0f30a1920c24e..608ff403ba676bf44a5962d983f3e04de9431ff3 100644 (file)
@@ -1478,7 +1478,7 @@ static MODCMD_FUNC(cmd_stats_network2) {
 #endif
         tbl.contents[nn][1] = buffer;
         ofs = strlen(buffer) + 1;
-        intervalString(buffer + ofs, now - server->link, user->handle_info);
+        intervalString(buffer + ofs, now - server->link_time, user->handle_info);
         if (server->self_burst)
             strcat(buffer + ofs, " Bursting");
         tbl.contents[nn][2] = buffer + ofs;
@@ -2093,18 +2093,18 @@ static MODCMD_FUNC(cmd_addbad)
     /* Scan for existing channels that match the new bad word. */
     if (!bad_found) {
         for (it = dict_first(channels); it; it = iter_next(it)) {
-            struct chanNode *channel = iter_data(it);
+            struct chanNode *chan = iter_data(it);
 
-            if (!opserv_bad_channel(channel->name))
+            if (!opserv_bad_channel(chan->name))
                 continue;
-            channel->bad_channel = 1;
-            if (channel->name[0] == '#')
-                opserv_shutdown_channel(channel, "OSMSG_ILLEGAL_REASON");
+            chan->bad_channel = 1;
+            if (chan->name[0] == '#')
+                opserv_shutdown_channel(chan, "OSMSG_ILLEGAL_REASON");
             else {
                 unsigned int nn;
-                for (nn=0; nn<channel->members.used; nn++) {
-                    struct userNode *user = channel->members.list[nn]->user;
-                    DelUser(user, cmd->parent->bot, 1, "OSMSG_ILLEGAL_KILL_REASON");
+                for (nn = 0; nn < chan->members.used; nn++) {
+                    struct userNode *victim = chan->members.list[nn]->user;
+                    DelUser(victim, cmd->parent->bot, 1, "OSMSG_ILLEGAL_KILL_REASON");
                 }
             }
         }
@@ -3207,7 +3207,7 @@ opserv_discrim_create(struct userNode *user, unsigned int argc, char *argv[], in
 static int
 discrim_match(discrim_t discrim, struct userNode *user)
 {
-    unsigned int access, i;
+    unsigned int level, i;
 
     if ((user->timestamp < discrim->min_ts)
         || (user->timestamp > discrim->max_ts)
@@ -3229,9 +3229,9 @@ discrim_match(discrim_t discrim, struct userNode *user)
     for(i = 0; i < discrim->channel_count; i++)
         if (!GetUserMode(discrim->channels[i], user))
             return 0;
-    access = user->handle_info ? user->handle_info->opserv_level : 0;
-    if ((access < discrim->min_level)
-        || (access > discrim->max_level)) {
+    level = user->handle_info ? user->handle_info->opserv_level : 0;
+    if ((level < discrim->min_level)
+        || (level > discrim->max_level)) {
         return 0;
     }
     if (discrim->min_clones > 1) {
index eae05c6f7398e884c3813c61c008c76cfacd4de2..8f25c0bfbd607290f6f63ed25b2bbf71443d0970 100644 (file)
@@ -41,7 +41,7 @@ static void privmsg_user_helper(struct userNode *un, void *data);
 void irc_svsmode(struct userNode *target, char *modes, unsigned long stamp);
 
 struct server *
-AddServer(struct server *uplink, const char *name, int hops, unsigned long boot, unsigned long link, UNUSED_ARG(const char *numeric), const char *description) {
+AddServer(struct server *uplink, const char *name, int hops, unsigned long boot, unsigned long link_time, UNUSED_ARG(const char *numeric), const char *description) {
     struct server* sNode;
 
     sNode = calloc(1, sizeof(*sNode));
@@ -49,7 +49,7 @@ AddServer(struct server *uplink, const char *name, int hops, unsigned long boot,
     safestrncpy(sNode->name, name, sizeof(sNode->name));
     sNode->hops = hops;
     sNode->boot = boot;
-    sNode->link = link;
+    sNode->link_time = link_time;
     sNode->users = dict_new();
     safestrncpy(sNode->description, description, sizeof(sNode->description));
     serverList_init(&sNode->children);
index 4477fad41d5ab53d948ce2810ef8d4eb48300147..3a14c68bdc0670b0371028711c61d30fa8d20273 100644 (file)
@@ -105,7 +105,7 @@ void replay_event_loop(void)
     while (!quit_services) {
         if (!replay_connected) {
             /* this time fudging is to get some of the logging right */
-            self->link = self->boot = now;
+            self->link_time = self->boot = now;
             cManager.uplink->state = AUTHENTICATING;
             irc_introduce(cManager.uplink->password);
             replay_connected = 1;
index 681231e81ee57cfcfd3a10eead95c024f7e230be..dbf0bd0a34245ee4d3414541ee63398ace8dce5f 100644 (file)
@@ -369,10 +369,10 @@ irc_server(struct server *srv)
     if (srv == self) {
         /* The +s, ignored by Run's ircu, means "service" to Undernet's ircu */
         putsock(P10_SERVER " %s %d %lu %lu J10 %s%s +s6 :%s",
-                srv->name, srv->hops+1, srv->boot, srv->link, srv->numeric, extranum, srv->description);
+                srv->name, srv->hops+1, srv->boot, srv->link_time, srv->numeric, extranum, srv->description);
     } else {
         putsock("%s " P10_SERVER " %s %d %lu %lu %c10 %s%s +s6 :%s",
-                self->numeric, srv->name, srv->hops+1, srv->boot, srv->link, (srv->self_burst ? 'J' : 'P'), srv->numeric, extranum, srv->description);
+                self->numeric, srv->name, srv->hops+1, srv->boot, srv->link_time, (srv->self_burst ? 'J' : 'P'), srv->numeric, extranum, srv->description);
     }
 }
 
@@ -631,14 +631,14 @@ irc_pong_asll(const char *who, const char *orig_ts)
 {
     char *delim;
     struct timeval orig;
-    struct timeval now;
+    struct timeval sys_now;
     int diff;
 
     orig.tv_sec = strtoul(orig_ts, &delim, 10);
     orig.tv_usec = (*delim == '.') ? strtoul(delim + 1, NULL, 10) : 0;
-    gettimeofday(&now, NULL);
-    diff = (now.tv_sec - orig.tv_sec) * 1000 + (now.tv_usec - orig.tv_usec) / 1000;
-    putsock("%s " P10_PONG " %s %s %d %lu.%06lu", self->numeric, who, orig_ts, diff, (unsigned long)now.tv_sec, (unsigned long)now.tv_usec);
+    gettimeofday(&sys_now, NULL);
+    diff = (sys_now.tv_sec - orig.tv_sec) * 1000 + (sys_now.tv_usec - orig.tv_usec) / 1000;
+    putsock("%s " P10_PONG " %s %s %d %lu.%06lu", self->numeric, who, orig_ts, diff, (unsigned long)sys_now.tv_sec, (unsigned long)sys_now.tv_usec);
 }
 
 void
@@ -1016,7 +1016,7 @@ static CMD_FUNC(cmd_server)
              * Alternately, we are same age, but we accept their time
              * since we are linking to them. */
             self->boot = srv->boot;
-            ioset_set_time(srv->link);
+            ioset_set_time(srv->link_time);
         }
     }
     if (srv == self->uplink) {
@@ -1912,7 +1912,7 @@ make_numeric(struct server *svr, int local_num, char *outbuf)
 }
 
 struct server *
-AddServer(struct server *uplink, const char *name, int hops, unsigned long boot, unsigned long link, const char *numeric, const char *description)
+AddServer(struct server *uplink, const char *name, int hops, unsigned long boot, unsigned long link_time, const char *numeric, const char *description)
 {
     struct server* sNode;
     int slen, mlen;
@@ -1944,7 +1944,7 @@ AddServer(struct server *uplink, const char *name, int hops, unsigned long boot,
     sNode->num_mask = base64toint(numeric+slen, mlen);
     sNode->hops = hops;
     sNode->boot = boot;
-    sNode->link = link;
+    sNode->link_time = link_time;
     strncpy(sNode->numeric, numeric, slen);
     safestrncpy(sNode->description, description, sizeof(sNode->description));
     sNode->users = calloc(sNode->num_mask+1, sizeof(*sNode->users));
@@ -2723,51 +2723,51 @@ mod_chanmode_format(struct mod_chanmode *change, char *outbuff)
 static int
 clear_chanmode(struct chanNode *channel, const char *modes)
 {
-    unsigned int remove;
+    unsigned int cleared;
 
-    for (remove = 0; *modes; modes++) {
+    for (cleared = 0; *modes; modes++) {
         switch (*modes) {
-        case 'o': remove |= MODE_CHANOP; break;
-        case 'v': remove |= MODE_VOICE; break;
-        case 'p': remove |= MODE_PRIVATE; break;
-        case 's': remove |= MODE_SECRET; break;
-        case 'm': remove |= MODE_MODERATED; break;
-        case 't': remove |= MODE_TOPICLIMIT; break;
-        case 'i': remove |= MODE_INVITEONLY; break;
-        case 'n': remove |= MODE_NOPRIVMSGS; break;
+        case 'o': cleared |= MODE_CHANOP; break;
+        case 'v': cleared |= MODE_VOICE; break;
+        case 'p': cleared |= MODE_PRIVATE; break;
+        case 's': cleared |= MODE_SECRET; break;
+        case 'm': cleared |= MODE_MODERATED; break;
+        case 't': cleared |= MODE_TOPICLIMIT; break;
+        case 'i': cleared |= MODE_INVITEONLY; break;
+        case 'n': cleared |= MODE_NOPRIVMSGS; break;
         case 'k':
-            remove |= MODE_KEY;
+            cleared |= MODE_KEY;
             channel->key[0] = '\0';
             break;
         case 'A':
-            remove |= MODE_APASS;
+            cleared |= MODE_APASS;
             channel->apass[0] = '\0';
             break;
         case 'U':
-            remove |= MODE_UPASS;
+            cleared |= MODE_UPASS;
             channel->upass[0] = '\0';
             break;
         case 'l':
-            remove |= MODE_LIMIT;
+            cleared |= MODE_LIMIT;
             channel->limit = 0;
             break;
-        case 'b': remove |= MODE_BAN; break;
-        case 'D': remove |= MODE_DELAYJOINS; break;
-        case 'r': remove |= MODE_REGONLY; break;
-        case 'c': remove |= MODE_NOCOLORS; break;
-        case 'C': remove |= MODE_NOCTCPS; break;
-        case 'z': remove |= MODE_REGISTERED; break;
+        case 'b': cleared |= MODE_BAN; break;
+        case 'D': cleared |= MODE_DELAYJOINS; break;
+        case 'r': cleared |= MODE_REGONLY; break;
+        case 'c': cleared |= MODE_NOCOLORS; break;
+        case 'C': cleared |= MODE_NOCTCPS; break;
+        case 'z': cleared |= MODE_REGISTERED; break;
         }
     }
 
-    if (!remove)
+    if (!cleared)
         return 1;
 
     /* Remove simple modes. */
-    channel->modes &= ~remove;
+    channel->modes &= ~cleared;
 
     /* If removing bans, kill 'em all. */
-    if ((remove & MODE_BAN) && channel->banlist.used) {
+    if ((cleared & MODE_BAN) && channel->banlist.used) {
         unsigned int i;
         for (i=0; i<channel->banlist.used; i++)
             free(channel->banlist.list[i]);
@@ -2775,8 +2775,8 @@ clear_chanmode(struct chanNode *channel, const char *modes)
     }
 
     /* Remove member modes. */
-    if ((remove & (MODE_CHANOP | MODE_VOICE)) && channel->members.used) {
-        int mask = ~(remove & (MODE_CHANOP | MODE_VOICE));
+    if ((cleared & (MODE_CHANOP | MODE_VOICE)) && channel->members.used) {
+        int mask = ~(cleared & (MODE_CHANOP | MODE_VOICE));
         unsigned int i;
 
         for (i = 0; i < channel->members.used; i++)
index 43cc638fafe5a15e7a7e042518a1d0791c5a7530..4b150017e79bd661c52c1533d587e7a456d1d0b7 100644 (file)
--- a/src/sar.c
+++ b/src/sar.c
@@ -1576,7 +1576,6 @@ sar_getname(const struct sockaddr *sa, unsigned int salen, int flags, sar_name_c
 
     if (flags & SNI_NUMERICHOST) {
         const char *servname;
-        unsigned int len;
         char host[SAR_NTOP_MAX], servbuf[16];
 
         /* If appropriate, try to look up service name. */
index b5a6624c26a2e2dc608044ed422d50d3309fc079..767bc12ea4412809d35b6e98d1072a85dd59a4a3 100644 (file)
@@ -47,11 +47,11 @@ timeq_init(void)
 unsigned long
 timeq_next(void)
 {
-    void *time;
+    void *timep;
     if (!timeq)
         return ~0;
-    heap_peek(timeq, &time, 0);
-    return (unsigned long)time;
+    heap_peek(timeq, &timep, 0);
+    return (unsigned long)timep;
 }
 
 void
index 10fb8d0fbec2ddcd986e343b6847f40953aa21ff..a6bb07350926624813bea51db21a84ec6f78cf1d 100644 (file)
@@ -316,6 +316,8 @@ irc_pton(irc_in_addr_t *addr, unsigned char *bits, const char *input)
         uint32_t ip4;
         pos = irc_pton_ip4(input, bits, &ip4);
         if (pos) {
+/* glibc's htons() macro is not -Wshadow-safe. */
+#undef htons
             addr->in6[5] = htons(65535);
             addr->in6[6] = htons(ntohl(ip4) >> 16);
             addr->in6[7] = htons(ntohl(ip4) & 65535);