bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

warnings with gl_anylinked_list


From: Eric Blake
Subject: warnings with gl_anylinked_list
Date: Mon, 9 Oct 2006 20:44:22 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

OK to install the following to silence -Wshadow?

In file included from gl_linkedhash_list.c:89:
gl_anylinked_list2.h: In function `gl_linked_indexof_from_to':
gl_anylinked_list2.h:431: warning: declaration of 'index' shadows a previous 
local
gl_anylinked_list2.h:388: warning: shadowed declaration is here
gl_anylinked_list2.h:458: warning: declaration of 'index' shadows a previous 
local
gl_anylinked_list2.h:388: warning: shadowed declaration is here

2006-10-09  Eric Blake  <address@hidden>

        * lib/gl_anylinked_list2.h (gl_linked_indexof_from_to): Avoid
        -Wshadow warnings.

Index: lib/gl_anylinked_list2.h
===================================================================
RCS file: /sources/gnulib/gnulib/lib/gl_anylinked_list2.h,v
retrieving revision 1.5
diff -u -r1.5 gl_anylinked_list2.h
--- lib/gl_anylinked_list2.h    6 Oct 2006 12:06:07 -0000       1.5
+++ lib/gl_anylinked_list2.h    9 Oct 2006 20:43:16 -0000
@@ -428,21 +428,21 @@
          {
            /* We need the match with the smallest index.  But we don't have
               a fast mapping node -> index.  So we have to walk the list.  */
-           size_t index;
+           size_t index1;
 
-           index = start_index;
+           index1 = start_index;
            node = list->root.next;
            for (; start_index > 0; start_index--)
              node = node->next;
 
            for (;
-                index < end_index;
-                node = node->next, index++)
+                index1 < end_index;
+                node = node->next, index1++)
              if (node->h.hashcode == hashcode
                  && (equals != NULL
                      ? equals (elt, node->value)
                      : elt == node->value))
-               return index;
+               return index1;
            /* The matches must have all been at indices < start_index or
               >= end_index.  */
            return (size_t)(-1);
@@ -455,13 +455,13 @@
       return (size_t)(-1);
     else
       {
-       size_t index = 0;
+       size_t index1 = 0;
 
        for (; node->prev != &list->root; node = node->prev)
-         index++;
+         index1++;
 
-       if (index >= start_index && index < end_index)
-         return index;
+       if (index1 >= start_index && index1 < end_index)
+         return index1;
        else
          return (size_t)(-1);
       }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]