mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-08 10:21:40 +00:00
[qfcc] Initialize overloaded function tables early
This fixes a rather old segfault bug uncovered by the macro testing.
This commit is contained in:
parent
e86444eff8
commit
748bd377c6
1 changed files with 5 additions and 7 deletions
|
@ -250,11 +250,6 @@ get_function (const char *name, const type_t *type, int overload, int create)
|
|||
const char *full_name;
|
||||
overloaded_function_t *func;
|
||||
|
||||
if (!overloaded_functions) {
|
||||
overloaded_functions = Hash_NewTable (1021, ol_func_get_key, 0, 0, 0);
|
||||
function_map = Hash_NewTable (1021, func_map_get_key, 0, 0, 0);
|
||||
}
|
||||
|
||||
name = save_string (name);
|
||||
|
||||
full_name = save_string (va (0, "%s|%s", name, encode_params (type)));
|
||||
|
@ -929,8 +924,11 @@ function_parms (function_t *f, byte *parm_size)
|
|||
void
|
||||
clear_functions (void)
|
||||
{
|
||||
if (overloaded_functions)
|
||||
if (overloaded_functions) {
|
||||
Hash_FlushTable (overloaded_functions);
|
||||
if (function_map)
|
||||
Hash_FlushTable (function_map);
|
||||
} else {
|
||||
overloaded_functions = Hash_NewTable (1021, ol_func_get_key, 0, 0, 0);
|
||||
function_map = Hash_NewTable (1021, func_map_get_key, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue