new_hash, _hash_new - allocate a new hash |
#include <hash.h> #define new_hash(pool,key_type,value_type) _hash_new ((pool), sizeof (key_type), sizeof (value_type)) hash _hash_new (pool, size_t key_size, size_t value_size); |
Allocate a new hash in pool mapping key_type to value_type. You can map both simple types like int and also aggregate types like structures and unions. However, beware of aggregate types that might contain 'holes' because of alignment -- such types will probably not work as you expect, particularly if used as keys. |
If you wish to have a hash which maps strings to something, then calling new_hash(pool, char *, char *) (for example) will not do what you expect. You are better to use either a sash (string to string hash) or a shash (string to anything hash) instead (see new_sash(3) and new_shash(3)). |
Richard Jones <rich@annexia.org> |
GNU LGPL (see http://www.gnu.org/) |
c2lib-1.2.13 |