summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-09-20 19:38:29 +0000
committerJim Meyering <jim@meyering.net>1997-09-20 19:38:29 +0000
commit2dd7796da0cb4355149771e7f726fe8562cd1f8a (patch)
treed1de69dfcf676c653133be76b25df8b7e15a6458 /lib
parent20539121db16a3bc07e42d9657122526d4d0483c (diff)
downloadcoreutils-2dd7796da0cb4355149771e7f726fe8562cd1f8a.tar.xz
(ZALLOC): Take Ht parameter instead of relying on one being in scope.
Diffstat (limited to 'lib')
-rw-r--r--lib/hash.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/hash.c b/lib/hash.c
index 48c04e58d..74ea74210 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -1,12 +1,4 @@
-/* Global assumptions:
- - ANSI C
- - a certain amount of library support, at least <stdlib.h>
- - C ints are at least 32-bits long
- */
-
-/* Things to do:
- - add a sample do_all function for listing the hash table.
- */
+/* A generic hash table package. */
#include <stdio.h>
#include <stdlib.h>
@@ -15,11 +7,9 @@
#include "hash.h"
#ifdef USE_OBSTACK
-/* This macro assumes that there is an HT with an initialized
- HT_OBSTACK in scope. */
-# define ZALLOC(n) obstack_alloc (&(ht->ht_obstack), (n))
+# define ZALLOC(Ht, N) obstack_alloc (&(ht->ht_obstack), (N))
#else
-# define ZALLOC(n) malloc ((n))
+# define ZALLOC(Ht, N) malloc ((N))
#endif
#define BUCKET_HEAD(ht, idx) ((ht)->hash_table[(idx)])
@@ -78,7 +68,7 @@ hash_allocate_entry (HT *ht)
}
else
{
- new = (HASH_ENT *) ZALLOC (sizeof (HASH_ENT));
+ new = (HASH_ENT *) ZALLOC (ht, sizeof (HASH_ENT));
}
return new;
}