From e542ec8682f2929f31efb85d04ac4667d6a85ff0 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 7 Nov 2008 11:52:24 +0200 Subject: [PATCH] Reverse hash GetEntry() return code vs found/not found - be in line with hash HasEntry() and other similar functions - internal-only function with just one place actually checking the return --- lib/fprint.c | 4 ++-- lib/rpmhash.C | 4 ++-- lib/rpmhash.H | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/fprint.c b/lib/fprint.c index 418f61c..e5de558 100644 --- a/lib/fprint.c +++ b/lib/fprint.c @@ -54,8 +54,8 @@ static const struct fprintCacheEntry_s * cacheContainsDirectory( const struct fprintCacheEntry_s ** data; if (rpmFpEntryHashGetEntry(cache->ht, dirName, &data, NULL, NULL)) - return NULL; - return data[0]; + return data[0]; + return NULL; } /** diff --git a/lib/rpmhash.C b/lib/rpmhash.C index 2d7cfde..a32a7d4 100644 --- a/lib/rpmhash.C +++ b/lib/rpmhash.C @@ -138,7 +138,7 @@ int HASHPREFIX(GetEntry)(HASHTYPE ht, HTKEYTYPE key, HTDATATYPE** data, Bucket b; if ((b = HASHPREFIX(findEntry)(ht, key)) == NULL) - return 1; + return 0; if (data) *data = b->data; @@ -147,7 +147,7 @@ int HASHPREFIX(GetEntry)(HASHTYPE ht, HTKEYTYPE key, HTDATATYPE** data, if (tableKey) *tableKey = b->key; - return 0; + return 1; } void HASHPREFIX(PrintStats)(HASHTYPE ht) { diff --git a/lib/rpmhash.H b/lib/rpmhash.H index 324cbc8..3e5c007 100644 --- a/lib/rpmhash.H +++ b/lib/rpmhash.H @@ -64,7 +64,7 @@ void HASHPREFIX(AddEntry)(HASHTYPE ht, HTKEYTYPE key, HTDATATYPE data); * @retval data address to store data value from bucket * @retval dataCount address to store data value size from bucket * @retval tableKey address to store key value from bucket (may be NULL) - * @return 0 on success, 1 if the item is not found. + * @return 1 on success, 0 if the item is not found. */ RPM_GNUC_INTERNAL int HASHPREFIX(GetEntry)(HASHTYPE ht, HTKEYTYPE key, -- 2.7.4