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:
Panu Matilainen 2008-11-07 12:03:54 +02:00
parent 844cec311f
commit 6404a00063
1 changed files with 5 additions and 7 deletions

View File

@ -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) {