mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Separate union members for EQUS and MACROs
This commit is contained in:
@@ -164,8 +164,8 @@ static void assignStringSymbol(struct Symbol *sym, char const *value)
|
||||
fatalerror("No memory for string equate: %s\n", strerror(errno));
|
||||
|
||||
sym->type = SYM_EQUS;
|
||||
sym->macro.value = string;
|
||||
sym->macro.size = strlen(string);
|
||||
sym->equs.value = string;
|
||||
sym->equs.size = strlen(string);
|
||||
}
|
||||
|
||||
struct Symbol *sym_FindExactSymbol(char const *symName)
|
||||
@@ -233,8 +233,8 @@ void sym_Purge(char const *symName)
|
||||
if (sym->name == labelScope)
|
||||
sym_SetCurrentSymbolScope(NULL);
|
||||
|
||||
// FIXME: this leaks sym->macro.value for SYM_EQUS and SYM_MACRO, but this can't
|
||||
// free(sym->macro.value) because the expansion may be purging itself.
|
||||
// FIXME: this leaks sym->equs.value for SYM_EQUS and sym->macro.value for SYM_MACRO,
|
||||
// but this can't free either of them because the expansion may be purging itself.
|
||||
hash_RemoveElement(symbols, sym->name);
|
||||
// TODO: ideally, also unref the file stack nodes
|
||||
free(sym);
|
||||
@@ -401,8 +401,8 @@ struct Symbol *sym_RedefString(char const *symName, char const *value)
|
||||
}
|
||||
|
||||
updateSymbolFilename(sym);
|
||||
// FIXME: this leaks the previous sym->macro.value value, but this can't
|
||||
// free(sym->macro.value) because the expansion may be redefining itself.
|
||||
// FIXME: this leaks the previous sym->equs.value, but this can't free(sym->equs.value)
|
||||
// because the expansion may be redefining itself.
|
||||
assignStringSymbol(sym, value);
|
||||
|
||||
return sym;
|
||||
|
||||
Reference in New Issue
Block a user