mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
make a local copy of the builtins table being register as it might need to
be modified
This commit is contained in:
parent
187cef1d28
commit
7885d9ce25
1 changed files with 8 additions and 0 deletions
|
@ -93,6 +93,7 @@ void
|
|||
PR_RegisterBuiltins (progs_t *pr, builtin_t *builtins)
|
||||
{
|
||||
builtin_t *bi;
|
||||
int count;
|
||||
|
||||
if (!pr->builtin_hash) {
|
||||
pr->builtin_hash = Hash_NewTable (1021, builtin_get_key, 0, pr);
|
||||
|
@ -101,6 +102,13 @@ PR_RegisterBuiltins (progs_t *pr, builtin_t *builtins)
|
|||
builtin_compare);
|
||||
}
|
||||
|
||||
// count = 1 for terminator
|
||||
for (bi = builtins, count = 1; bi->name; bi++)
|
||||
count++;
|
||||
bi = malloc (count * sizeof (builtin_t));
|
||||
memcpy (bi, builtins, count * sizeof (builtin_t));
|
||||
builtins = bi;
|
||||
|
||||
while (builtins->name) {
|
||||
if (builtins->binum == 0 || builtins->binum >= PR_AUTOBUILTIN)
|
||||
PR_Error (pr, "bad builtin number: %s = #%d", builtins->name,
|
||||
|
|
Loading…
Reference in a new issue