mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-30 16:30:43 +00:00
Catch symtab operations with an invalid symtab.
Just via a simple segfault, but it's better than silently missing incorrect usage.
This commit is contained in:
parent
49cc4fed0c
commit
9cb0ca6fed
1 changed files with 4 additions and 4 deletions
|
@ -94,11 +94,11 @@ symbol_t *
|
||||||
symtab_lookup (symtab_t *symtab, const char *name)
|
symtab_lookup (symtab_t *symtab, const char *name)
|
||||||
{
|
{
|
||||||
symbol_t *symbol;
|
symbol_t *symbol;
|
||||||
while (symtab) {
|
do {
|
||||||
if ((symbol = Hash_Find (symtab->tab, name)))
|
if ((symbol = Hash_Find (symtab->tab, name)))
|
||||||
return symbol;
|
return symbol;
|
||||||
symtab = symtab->parent;
|
symtab = symtab->parent;
|
||||||
}
|
} while (symtab);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ symtab_flat_copy (symtab_t *symtab, symtab_t *parent)
|
||||||
symbol_t *symbol;
|
symbol_t *symbol;
|
||||||
|
|
||||||
newtab = new_symtab (parent, stab_local);
|
newtab = new_symtab (parent, stab_local);
|
||||||
while (symtab) {
|
do {
|
||||||
for (symbol = symtab->symbols; symbol; symbol = symbol->next) {
|
for (symbol = symtab->symbols; symbol; symbol = symbol->next) {
|
||||||
if (Hash_Find (newtab->tab, symbol->name))
|
if (Hash_Find (newtab->tab, symbol->name))
|
||||||
continue;
|
continue;
|
||||||
|
@ -171,7 +171,7 @@ symtab_flat_copy (symtab_t *symtab, symtab_t *parent)
|
||||||
// Set the tail pointer so symbols in ancestor tables come before
|
// Set the tail pointer so symbols in ancestor tables come before
|
||||||
// those in decendent tables.
|
// those in decendent tables.
|
||||||
newtab->symtail = &newtab->symbols;
|
newtab->symtail = &newtab->symbols;
|
||||||
}
|
} while (symtab);
|
||||||
// Reset the tail pointer so any symbols added to newtab come after
|
// Reset the tail pointer so any symbols added to newtab come after
|
||||||
// those copied from the input symbol table chain.
|
// those copied from the input symbol table chain.
|
||||||
for (symbol = newtab->symbols; symbol && symbol->next;
|
for (symbol = newtab->symbols; symbol && symbol->next;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue