Mercurial > hg > octave-kai > gnulib-hg
changeset 1038:b12d8086ca7a
(ZALLOC): Take Ht parameter instead of relying on one being in scope.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Sat, 20 Sep 1997 19:38:29 +0000 |
parents | b24d08ec1fa3 |
children | 4d7cd20a6c87 |
files | lib/hash.c |
diffstat | 1 files changed, 4 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ } else { - new = (HASH_ENT *) ZALLOC (sizeof (HASH_ENT)); + new = (HASH_ENT *) ZALLOC (ht, sizeof (HASH_ENT)); } return new; }