Use std::string for PURGE args

This commit is contained in:
Rangi42
2024-02-27 19:55:37 -05:00
committed by Sylvie
parent 0bed84174b
commit 962398969b
3 changed files with 14 additions and 20 deletions

View File

@@ -199,16 +199,16 @@ static bool isReferenced(struct Symbol const *sym)
}
// Purge a symbol
void sym_Purge(char const *symName)
void sym_Purge(std::string const &symName)
{
struct Symbol *sym = sym_FindScopedValidSymbol(symName);
struct Symbol *sym = sym_FindScopedValidSymbol(symName.c_str());
if (!sym) {
error("'%s' not defined\n", symName);
error("'%s' not defined\n", symName.c_str());
} else if (sym->isBuiltin) {
error("Built-in symbol '%s' cannot be purged\n", symName);
error("Built-in symbol '%s' cannot be purged\n", symName.c_str());
} else if (isReferenced(sym)) {
error("Symbol \"%s\" is referenced and thus cannot be purged\n", symName);
error("Symbol \"%s\" is referenced and thus cannot be purged\n", symName.c_str());
} else {
// Do not keep a reference to the label's name after purging it
if (sym->name == labelScope)