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
+7 -4
View File
@@ -53,10 +53,13 @@ static int CompareUserFuncs(void *a, void *b)
void
InitUserFunctions(void)
{
hash_table_init(&FuncHash,
offsetof(UserFunc, link),
HashUserFunc,
CompareUserFuncs);
if (hash_table_init(&FuncHash,
offsetof(UserFunc, link),
HashUserFunc,
CompareUserFuncs) < 0) {
fprintf(stderr, "Unable to initialize function hash table: Out of memory. Exiting.\n");
exit(1);
}
}
/***************************************************************/