summaryrefslogtreecommitdiff
path: root/locale/programs/simple-hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'locale/programs/simple-hash.c')
-rw-r--r--locale/programs/simple-hash.c58
1 files changed, 15 insertions, 43 deletions
diff --git a/locale/programs/simple-hash.c b/locale/programs/simple-hash.c
index a4412f9787..a79539a1c9 100644
--- a/locale/programs/simple-hash.c
+++ b/locale/programs/simple-hash.c
@@ -1,5 +1,5 @@
/* Implement simple hashing table with string based keys.
- Copyright (C) 1994-2015 Free Software Foundation, Inc.
+ Copyright (C) 1994-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, October 1994.
@@ -66,9 +66,7 @@ static int is_prime (unsigned long int candidate);
int
-init_hash (htab, init_size)
- hash_table *htab;
- unsigned long int init_size;
+init_hash (hash_table *htab, unsigned long int init_size)
{
/* We need the size to be a prime. */
init_size = next_prime (init_size);
@@ -88,8 +86,7 @@ init_hash (htab, init_size)
int
-delete_hash (htab)
- hash_table *htab;
+delete_hash (hash_table *htab)
{
free (htab->table);
obstack_free (&htab->mem_pool, NULL);
@@ -98,11 +95,7 @@ delete_hash (htab)
int
-insert_entry (htab, key, keylen, data)
- hash_table *htab;
- const void *key;
- size_t keylen;
- void *data;
+insert_entry (hash_table *htab, const void *key, size_t keylen, void *data)
{
unsigned long int hval = compute_hashval (key, keylen);
hash_entry *table = (hash_entry *) htab->table;
@@ -121,13 +114,8 @@ insert_entry (htab, key, keylen, data)
}
static void
-insert_entry_2 (htab, key, keylen, hval, idx, data)
- hash_table *htab;
- const void *key;
- size_t keylen;
- unsigned long int hval;
- size_t idx;
- void *data;
+insert_entry_2 (hash_table *htab, const void *key, size_t keylen,
+ unsigned long int hval, size_t idx, void *data)
{
hash_entry *table = (hash_entry *) htab->table;
@@ -176,11 +164,8 @@ insert_entry_2 (htab, key, keylen, hval, idx, data)
int
-find_entry (htab, key, keylen, result)
- const hash_table *htab;
- const void *key;
- size_t keylen;
- void **result;
+find_entry (const hash_table *htab, const void *key, size_t keylen,
+ void **result)
{
hash_entry *table = (hash_entry *) htab->table;
size_t idx = lookup (htab, key, keylen, compute_hashval (key, keylen));
@@ -194,11 +179,7 @@ find_entry (htab, key, keylen, result)
int
-set_entry (htab, key, keylen, newval)
- hash_table *htab;
- const void *key;
- size_t keylen;
- void *newval;
+set_entry (hash_table *htab, const void *key, size_t keylen, void *newval)
{
hash_entry *table = (hash_entry *) htab->table;
size_t idx = lookup (htab, key, keylen, compute_hashval (key, keylen));
@@ -212,12 +193,8 @@ set_entry (htab, key, keylen, newval)
int
-iterate_table (htab, ptr, key, keylen, data)
- const hash_table *htab;
- void **ptr;
- const void **key;
- size_t *keylen;
- void **data;
+iterate_table (const hash_table *htab, void **ptr, const void **key,
+ size_t *keylen, void **data)
{
if (*ptr == NULL)
{
@@ -244,11 +221,8 @@ iterate_table (htab, ptr, key, keylen, data)
[Knuth] The Art of Computer Programming, part3 (6.4) */
static size_t
-lookup (htab, key, keylen, hval)
- const hash_table *htab;
- const void *key;
- size_t keylen;
- unsigned long int hval;
+lookup (const hash_table *htab, const void *key, size_t keylen,
+ unsigned long int hval)
{
unsigned long int hash;
size_t idx;
@@ -287,8 +261,7 @@ lookup (htab, key, keylen, hval)
unsigned long int
-next_prime (seed)
- unsigned long int seed;
+next_prime (unsigned long int seed)
{
/* Make it definitely odd. */
seed |= 1;
@@ -301,8 +274,7 @@ next_prime (seed)
static int
-is_prime (candidate)
- unsigned long int candidate;
+is_prime (unsigned long int candidate)
{
/* No even number and none less than 10 will be passed here. */
unsigned long int divn = 3;