Use automatic allocation for symbol names

This commit is contained in:
Rangi42
2024-02-28 19:56:29 -05:00
committed by Sylvie
parent 826512730c
commit ef1c1440a0
6 changed files with 42 additions and 45 deletions

View File

@@ -16,8 +16,8 @@ std::map<std::string, struct Symbol *> symbols;
void sym_AddSymbol(struct Symbol *symbol)
{
// Check if the symbol already exists
if (struct Symbol *other = sym_GetSymbol(*symbol->name); other) {
fprintf(stderr, "error: \"%s\" both in %s from ", symbol->name->c_str(),
if (struct Symbol *other = sym_GetSymbol(symbol->name); other) {
fprintf(stderr, "error: \"%s\" both in %s from ", symbol->name.c_str(),
symbol->objFileName);
dumpFileStack(symbol->src);
fprintf(stderr, "(%" PRIu32 ") and in %s from ",
@@ -28,7 +28,7 @@ void sym_AddSymbol(struct Symbol *symbol)
}
// If not, add it
symbols[*symbol->name] = symbol;
symbols[symbol->name] = symbol;
}
struct Symbol *sym_GetSymbol(std::string const &name)