Exit if we run out of memory initializing hash tables. There's no sane way to recover.

This commit is contained in:
Dianne Skoll
2024-12-09 18:10:03 -05:00
parent 84dd73f023
commit 6b05d772f0
4 changed files with 23 additions and 11 deletions
+5 -2
View File
@@ -53,8 +53,11 @@ static int VarCompareFunc(void *a, void *b)
void
InitVars(void)
{
hash_table_init(&VHashTbl, offsetof(Var, link),
VarHashFunc, VarCompareFunc);
if (hash_table_init(&VHashTbl, offsetof(Var, link),
VarHashFunc, VarCompareFunc) < 0) {
fprintf(stderr, "Unable to initialize variable hash table: Out of memory. Exiting.\n");
exit(1);
}
}
static double