mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
hash.h:
write some docs on mixing (eg) Hash_Add and Hash_DelElement sv_user.c: fix a warning
This commit is contained in:
parent
a43d20fffa
commit
0985c90ce9
2 changed files with 8 additions and 2 deletions
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue