diff options
author | Bruno Haible <bruno@clisp.org> | 2005-10-07 11:29:05 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:12:53 +0200 |
commit | cb0eac2f6599a31e25af1bc14b50f18f22b06103 (patch) | |
tree | 39a0264f04fc23e9d65388a5dddc64783724b4f5 /gettext-tools/lib/hash.c | |
parent | 2cd9afbab88b05391c2ed8d47e0327614c46d5f3 (diff) | |
download | external_gettext-cb0eac2f6599a31e25af1bc14b50f18f22b06103.zip external_gettext-cb0eac2f6599a31e25af1bc14b50f18f22b06103.tar.gz external_gettext-cb0eac2f6599a31e25af1bc14b50f18f22b06103.tar.bz2 |
Make it possible for the hash value to point to the statically stored
hash key.
Diffstat (limited to 'gettext-tools/lib/hash.c')
-rw-r--r-- | gettext-tools/lib/hash.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gettext-tools/lib/hash.c b/gettext-tools/lib/hash.c index 2a96210..21374f2 100644 --- a/gettext-tools/lib/hash.c +++ b/gettext-tools/lib/hash.c @@ -262,9 +262,10 @@ resize (hash_table *htab) /* Try to insert the pair (KEY[0..KEYLEN-1], DATA) in the hash table. - Return 0 if successful, or -1 if there is already an entry with the given - key. */ -int + Return non-NULL (more precisely, the address of the KEY inside the table's + memory pool) if successful, or NULL if there is already an entry with the + given key. */ +const void * hash_insert_entry (hash_table *htab, const void *key, size_t keylen, void *data) @@ -275,7 +276,7 @@ hash_insert_entry (hash_table *htab, if (table[idx].used) /* We don't want to overwrite the old value. */ - return -1; + return NULL; else { /* An empty bucket has been found. */ @@ -284,7 +285,7 @@ hash_insert_entry (hash_table *htab, if (100 * htab->filled > 75 * htab->size) /* Table is filled more than 75%. Resize the table. */ resize (htab); - return 0; + return keycopy; } } |