mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-25 00:13:24 +00:00
hash.[ch]:
slight api change: the getkey and free functions now take a user data parameter (which is an aditional parameter to Hash_New. cmd.c, cvar.c, quakefs.c: clean up the resulting errors. pr_edict.c: use hash tables for lookups of function, global and field definitions. should speed things up a bit, ESPECIALLY when type checking is enabled.
This commit is contained in:
parent
aad21e3c00
commit
f40b361fb3
8 changed files with 78 additions and 50 deletions
|
@ -821,7 +821,7 @@ Cmd_CmdList_f (void)
|
|||
}
|
||||
|
||||
static void
|
||||
cmd_alias_free (void *_a)
|
||||
cmd_alias_free (void *_a, void *unused)
|
||||
{
|
||||
cmdalias_t *a = (cmdalias_t*)_a;
|
||||
free (a->value);
|
||||
|
@ -829,14 +829,14 @@ cmd_alias_free (void *_a)
|
|||
}
|
||||
|
||||
static char *
|
||||
cmd_alias_get_key (void *_a)
|
||||
cmd_alias_get_key (void *_a, void *unused)
|
||||
{
|
||||
cmdalias_t *a = (cmdalias_t*)_a;
|
||||
return a->name;
|
||||
}
|
||||
|
||||
static char *
|
||||
cmd_get_key (void *c)
|
||||
cmd_get_key (void *c, void *unused)
|
||||
{
|
||||
cmd_function_t *cmd = (cmd_function_t*)c;
|
||||
return cmd->name;
|
||||
|
@ -851,8 +851,8 @@ cmd_get_key (void *c)
|
|||
void
|
||||
Cmd_Init_Hash (void)
|
||||
{
|
||||
cmd_hash = Hash_NewTable (1021, cmd_get_key, 0);
|
||||
cmd_alias_hash = Hash_NewTable (1021, cmd_alias_get_key, cmd_alias_free);
|
||||
cmd_hash = Hash_NewTable (1021, cmd_get_key, 0, 0);
|
||||
cmd_alias_hash = Hash_NewTable (1021, cmd_alias_get_key, cmd_alias_free, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue