From 9555ca05b885574dd884fd757be571d68f93e84c Mon Sep 17 00:00:00 2001 From: Emilio Perez Date: Wed, 8 Mar 2023 17:29:50 +0000 Subject: [PATCH] error: statically allocate error symbol hash table This will allow calling errSymbolAdd before errSymBld, therefore, a function adding error symbols can now be run before iocInit or errlogInit --- modules/libcom/src/error/errSymLib.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/libcom/src/error/errSymLib.c b/modules/libcom/src/error/errSymLib.c index deb59d4f8..b7475ca59 100644 --- a/modules/libcom/src/error/errSymLib.c +++ b/modules/libcom/src/error/errSymLib.c @@ -39,7 +39,7 @@ typedef struct errnumnode { long pad; } ERRNUMNODE; -static ERRNUMNODE **hashtable; +static ERRNUMNODE *hashtable[NHASH]; static int initialized = 0; extern ERRSYMTAB_ID errSymTbl; @@ -59,9 +59,6 @@ int errSymBld(void) if (initialized) return(0); - hashtable = (ERRNUMNODE**)callocMustSucceed - (NHASH, sizeof(ERRNUMNODE*),"errSymBld"); - for (i = 0; i < errSymTbl->nsymbols; i++, errArray++) { if (errSymbolAdd(errArray->errNum, errArray->name)) { fprintf(stderr, "errSymBld: ERROR - errSymbolAdd() failed \n");