Make adding an identical error symbol not fail

A test case was also added which test that adding an error symbol
with same error code and message as one added before will not fail
This commit is contained in:
Emilio Perez
2023-09-01 16:11:50 +02:00
committed by zimoch
parent c680b9bebd
commit e6dab90bf4
2 changed files with 16 additions and 2 deletions
+6 -1
View File
@@ -105,7 +105,12 @@ int errSymbolAdd(long errNum, const char *name)
/* search for last node (NULL) of hashnode linked list */
while (pNextNode) {
if (pNextNode->errNum == errNum) {
return S_err_codeExists;
if(strcmp(name, pNextNode->message)) {
return S_err_codeExists;
}
else {
return 0;
}
}
phashnode = &pNextNode->hashnode;
pNextNode = *phashnode;