+2006-10-10 Bruno Haible <bruno@clisp.org>
+
+ Fix a gcc -Wshadow warning.
+ * lib/gl_anyhash_list2.h (hash_resize): Rename local variable 'index'
+ to 'bucket'.
+ * lib/gl_anylinked_list2.h (gl_linked_search_from_to,
+ gl_linked_indexof_from_to): Likewise.
+ * lib/gl_linkedhash_list.c (add_to_bucket, remove_from_bucket):
+ Likewise.
+ * lib/gl_anytreehash_list1.h (add_to_bucket, remove_from_bucket):
+ Likewise.
+ * lib/gl_anytreehash_list2.h (gl_tree_search_from_to): Likewise.
+ Reported by Eric Blake.
+
2006-10-09 Paul Eggert <eggert@cs.ucla.edu>
* lib/filemode.h [HAVE_DECL_STRMODE]: Include unistd.h too,
{
gl_hash_entry_t next = node->hash_next;
/* Add the entry to the new table. */
- size_t index = node->hashcode % new_size;
- node->hash_next = new_table[index];
- new_table[index] = node;
+ size_t bucket = node->hashcode % new_size;
+ node->hash_next = new_table[bucket];
+ new_table[bucket] = node;
node = next;
}
(list->base.hashcode_fn != NULL
? list->base.hashcode_fn (elt)
: (size_t)(uintptr_t) elt);
- size_t index = hashcode % list->table_size;
+ size_t bucket = hashcode % list->table_size;
gl_listelement_equals_fn equals = list->base.equals_fn;
if (!list->base.allow_duplicates)
gl_list_node_t found = NULL;
gl_list_node_t node;
- for (node = (gl_list_node_t) list->table[index];
+ for (node = (gl_list_node_t) list->table[bucket];
node != NULL;
node = (gl_list_node_t) node->h.hash_next)
if (node->h.hashcode == hashcode
gl_list_node_t first_match = NULL;
gl_list_node_t node;
- for (node = (gl_list_node_t) list->table[index];
+ for (node = (gl_list_node_t) list->table[bucket];
node != NULL;
node = (gl_list_node_t) node->h.hash_next)
if (node->h.hashcode == hashcode
(list->base.hashcode_fn != NULL
? list->base.hashcode_fn (elt)
: (size_t)(uintptr_t) elt);
- size_t index = hashcode % list->table_size;
+ size_t bucket = hashcode % list->table_size;
gl_listelement_equals_fn equals = list->base.equals_fn;
gl_list_node_t node;
if (!list->base.allow_duplicates)
{
/* Look for the first match in the hash bucket. */
- for (node = (gl_list_node_t) list->table[index];
+ for (node = (gl_list_node_t) list->table[bucket];
node != NULL;
node = (gl_list_node_t) node->h.hash_next)
if (node->h.hashcode == hashcode
bool multiple_matches = false;
gl_list_node_t first_match = NULL;
- for (node = (gl_list_node_t) list->table[index];
+ for (node = (gl_list_node_t) list->table[bucket];
node != NULL;
node = (gl_list_node_t) node->h.hash_next)
if (node->h.hashcode == hashcode
static void
add_to_bucket (gl_list_t list, gl_list_node_t new_node)
{
- size_t index = new_node->h.hashcode % list->table_size;
+ size_t bucket = new_node->h.hashcode % list->table_size;
/* If no duplicates are allowed, multiple nodes are not needed. */
if (list->base.allow_duplicates)
gl_listelement_equals_fn equals = list->base.equals_fn;
gl_hash_entry_t *entryp;
- for (entryp = &list->table[index]; *entryp != NULL; entryp = &(*entryp)->hash_next)
+ for (entryp = &list->table[bucket]; *entryp != NULL; entryp = &(*entryp)->hash_next)
{
gl_hash_entry_t entry = *entryp;
}
}
/* If no duplicates are allowed, multiple nodes are not needed. */
- new_node->h.hash_next = list->table[index];
- list->table[index] = &new_node->h;
+ new_node->h.hash_next = list->table[bucket];
+ list->table[bucket] = &new_node->h;
}
/* Remove a node from the hash table structure.
static void
remove_from_bucket (gl_list_t list, gl_list_node_t old_node)
{
- size_t index = old_node->h.hashcode % list->table_size;
+ size_t bucket = old_node->h.hashcode % list->table_size;
if (list->base.allow_duplicates)
{
gl_listelement_equals_fn equals = list->base.equals_fn;
gl_hash_entry_t *entryp;
- for (entryp = &list->table[index]; ; entryp = &(*entryp)->hash_next)
+ for (entryp = &list->table[bucket]; ; entryp = &(*entryp)->hash_next)
{
gl_hash_entry_t entry = *entryp;
/* If no duplicates are allowed, multiple nodes are not needed. */
gl_hash_entry_t *entryp;
- for (entryp = &list->table[index]; ; entryp = &(*entryp)->hash_next)
+ for (entryp = &list->table[bucket]; ; entryp = &(*entryp)->hash_next)
{
if (*entryp == &old_node->h)
{
(list->base.hashcode_fn != NULL
? list->base.hashcode_fn (elt)
: (size_t)(uintptr_t) elt);
- size_t index = hashcode % list->table_size;
+ size_t bucket = hashcode % list->table_size;
gl_listelement_equals_fn equals = list->base.equals_fn;
gl_hash_entry_t entry;
if (list->base.allow_duplicates)
{
- for (entry = list->table[index]; entry != NULL; entry = entry->hash_next)
+ for (entry = list->table[bucket]; entry != NULL; entry = entry->hash_next)
if (entry->hashcode == hashcode)
{
if (((struct gl_multiple_nodes *) entry)->magic == MULTIPLE_NODES_MAGIC)
else
{
/* If no duplicates are allowed, multiple nodes are not needed. */
- for (entry = list->table[index]; entry != NULL; entry = entry->hash_next)
+ for (entry = list->table[bucket]; entry != NULL; entry = entry->hash_next)
if (entry->hashcode == hashcode)
{
gl_list_node_t node = (struct gl_list_node_impl *) entry;
static inline void
add_to_bucket (gl_list_t list, gl_list_node_t node)
{
- size_t index = node->h.hashcode % list->table_size;
+ size_t bucket = node->h.hashcode % list->table_size;
- node->h.hash_next = list->table[index];
- list->table[index] = &node->h;
+ node->h.hash_next = list->table[bucket];
+ list->table[bucket] = &node->h;
}
/* Remove a node from the hash table structure. */
static inline void
remove_from_bucket (gl_list_t list, gl_list_node_t node)
{
- size_t index = node->h.hashcode % list->table_size;
+ size_t bucket = node->h.hashcode % list->table_size;
gl_hash_entry_t *p;
- for (p = &list->table[index]; ; p = &(*p)->hash_next)
+ for (p = &list->table[bucket]; ; p = &(*p)->hash_next)
{
if (*p == &node->h)
{