Mercurial > hg > octave-kai > gnulib-hg
diff lib/hash.h @ 1032:0b6b7e10fe5f
use HASH_H, not _hash_h_ in #ifndef
fix comment: hash_rehash does *not* use hash_key_freer
(HASH_INSERT_NEW_ITEM): Take new arg: Failp.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Wed, 17 Sep 1997 17:04:21 +0000 (1997-09-17) |
parents | e34b8e81638f |
children | aa231bb87550 |
line wrap: on
line diff
--- a/lib/hash.h +++ b/lib/hash.h @@ -1,16 +1,26 @@ -#ifndef _hash_h_ -# define _hash_h_ 1 +#ifndef HASH_H +# define HASH_H 1 + +# if HAVE_CONFIG_H +# include <config.h> +# endif # include <stdio.h> -# include <stdlib.h> # include <assert.h> +# ifdef STDC_HEADERS +# include <stdlib.h> +# else +void free (); +char *malloc (); +# endif + +# define USE_OBSTACK # ifdef USE_OBSTACK # include "obstack.h" # endif -# include "xalloc.h" -# define obstack_chunk_alloc xmalloc +# define obstack_chunk_alloc malloc # define obstack_chunk_free free struct hash_ent @@ -27,12 +37,11 @@ struct HT { /* User-supplied function for freeing keys. It is specified in - hash_initialize. If non-null, it is used by hash_free, - hash_clear, and hash_rehash. You should specify `free' here - only if you want these functions to free all of your `key' - data. This is typically the case when your key is simply - an auxilliary struct that you have malloc'd to aggregate - several values. */ + hash_initialize. If non-null, it is used by hash_free and + hash_clear. You should specify `free' here only if you want + these functions to free all of your `key' data. This is typically + the case when your key is simply an auxilliary struct that you + have malloc'd to aggregate several values. */ Hash_key_freer_type hash_key_freer; /* User-supplied hash function that hashes entry E to an integer @@ -147,15 +156,13 @@ /* This interface to hash_insert_if_absent is used frequently enough to merit a macro here. */ -# define HASH_INSERT_NEW_ITEM(ht, item) \ +# define HASH_INSERT_NEW_ITEM(Ht, Item, Failp) \ do \ { \ - void *already; \ - int _failed; \ - already = hash_insert_if_absent ((ht), (item), &_failed); \ - assert (already == NULL); \ - assert (!_failed); \ + void *_already; \ + _already = hash_insert_if_absent ((Ht), (Item), Failp); \ + assert (_already == NULL); \ } \ while (0) -#endif /* _hash_h_ */ +#endif /* HASH_H */