Reset return values to zero + NULL's on not found in hash GetEntry()
- avoids having to separately check for return value in some cases and accidents from not resetting the values in caller - in line with headerGet() behavior
This commit is contained in:
parent
844cec311f
commit
6404a00063
|
@ -136,18 +136,16 @@ int HASHPREFIX(GetEntry)(HASHTYPE ht, HTKEYTYPE key, HTDATATYPE** data,
|
|||
int * dataCount, HTKEYTYPE* tableKey)
|
||||
{
|
||||
Bucket b;
|
||||
|
||||
if ((b = HASHPREFIX(findEntry)(ht, key)) == NULL)
|
||||
return 0;
|
||||
int rc = ((b = HASHPREFIX(findEntry)(ht, key)) != NULL);
|
||||
|
||||
if (data)
|
||||
*data = b->data;
|
||||
*data = rc ? b->data : NULL;
|
||||
if (dataCount)
|
||||
*dataCount = b->dataCount;
|
||||
*dataCount = rc ? b->dataCount : 0;
|
||||
if (tableKey)
|
||||
*tableKey = b->key;
|
||||
*tableKey = rc ? b->key : NULL;
|
||||
|
||||
return 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
void HASHPREFIX(PrintStats)(HASHTYPE ht) {
|
||||
|
|
Loading…
Reference in New Issue