X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgl_anyhash_list2.h;h=d7191168669d8c243a22af1b61f457c9cd4f18e3;hb=8badccbd46d6cbd0f1fa2014e01ce8a7cae2b272;hp=eb8d6e9771028a8a2c2611601602d52f07483a81;hpb=0a51cf1590113188ff1dc78dc79d2924c262a865;p=gnulib.git diff --git a/lib/gl_anyhash_list2.h b/lib/gl_anyhash_list2.h index eb8d6e977..d71911686 100644 --- a/lib/gl_anyhash_list2.h +++ b/lib/gl_anyhash_list2.h @@ -100,8 +100,7 @@ hash_resize (gl_list_t list, size_t estimate) { gl_hash_entry_t *old_table = list->table; /* Allocate the new table. */ - gl_hash_entry_t *new_table = - (gl_hash_entry_t *) xzalloc (new_size * sizeof (gl_hash_entry_t)); + gl_hash_entry_t *new_table = XCALLOC (new_size, gl_hash_entry_t); size_t i; /* Iterate through the entries of the old table. */ @@ -113,9 +112,9 @@ hash_resize (gl_list_t list, size_t estimate) { 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; }