From 0985c90ce98aafc20e7282c01e0382e624428198 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 28 Apr 2003 16:04:22 +0000 Subject: [PATCH] hash.h: write some docs on mixing (eg) Hash_Add and Hash_DelElement sv_user.c: fix a warning --- include/QF/hash.h | 8 +++++++- qw/source/sv_user.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/QF/hash.h b/include/QF/hash.h index a577e43e2..fa2245941 100644 --- a/include/QF/hash.h +++ b/include/QF/hash.h @@ -47,6 +47,8 @@ typedef struct hashtab_s hashtab_t; returns a pointer to the hash table (to be passed to the other functions) or 0 on error. + Hash_Add, Hash_Find, Hash_FindList and Hash_Del use gk and strcmp. + multiple inserions of the same key are fine; later insertions override previous ones until the later one is removed (Hash_Del). */ @@ -54,11 +56,15 @@ hashtab_t *Hash_NewTable (int tsize, const char *(*gk)(void*,void*), void (*f)(void*,void*), void *ud); /* - change the hash and compare functions used by the Has_*Element functions. + change the hash and compare functions used by the Hash_*Element functions. the default hash function just returns the address of the element, and the default compare just compares the addresses. compare is to return 0 for not equal and non-0 otherwise. + With suitably crafted gh and cmp functions, Hash_*Element functions can + be mixed with the non-element functions, but by default the results will + be undefined. + gh takes the same parameters as gk above cmp is element 1, element 2, userdata */ diff --git a/qw/source/sv_user.c b/qw/source/sv_user.c index b9a037634..c9bc3f254 100644 --- a/qw/source/sv_user.c +++ b/qw/source/sv_user.c @@ -1281,7 +1281,7 @@ PF_AddUserCommand (progs_t *pr) ucmd_t *cmd; cmd = SV_AddUserCommand (name, call_qc_hook, P_INT (pr, 2) ? UCMD_NO_REDIRECT : 0, - P_FUNCTION (pr, 1), + (void *) P_FUNCTION (pr, 1), NULL); if (!cmd)