ref: 7c8eba9fd2e7e5c56d54aac4cd0bb707a93da098
parent: 23effcc3f0121f384d9addc50f539ed36b092fa2
author: ISSOtm <[email protected]>
date: Tue Mar 10 20:23:56 EDT 2020
Remove error message causing segfault This was utterly stupid. The check right above ensured that `sym` was NULL, ergo that the argument to `yyerror` *would* segfault. The only two call sites cannot pass a non-NULL pointer anyways, which I'm betting is why this went unnoticed. I did what an optimizing compiler would do anyways: remove the dead code.
--- a/include/asm/symbol.h
+++ b/include/asm/symbol.h
@@ -75,6 +75,14 @@
return sym->isExported;
}
+/*
+ * Get a string equate's value
+ */
+static inline char *sym_GetStringValue(struct sSymbol const *sym)
+{
+ return sym->pMacro;
+}
+
int32_t sym_GetValue(struct sSymbol const *sym);
uint32_t sym_CalcHash(const char *s);
void sym_SetExportAll(bool set);
--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -250,19 +250,6 @@
}
/*
- * Get a string equate's value
- */
-char *sym_GetStringValue(struct sSymbol const *sym)
-{
- if (sym != NULL)
- return sym->pMacro;
-
- yyerror("String symbol '%s' not defined", sym->tzName);
-
- return NULL;
-}
-
-/*
* Return a constant symbols value
*/
uint32_t sym_GetConstantValue(char const *s)