diff options
author | jbj <devnull@localhost> | 2001-11-06 22:46:26 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-11-06 22:46:26 +0000 |
commit | e680cce3e8a80425586c6e2448f57a48606d220b (patch) | |
tree | 663ce322c8de2bca7fa05171e76e30d9ca80c7ab /rpmdb/rpmhash.c | |
parent | 0724785fb3a9b4d4fc1d10c6e6238b70f9752c56 (diff) | |
download | librpm-tizen-e680cce3e8a80425586c6e2448f57a48606d220b.tar.gz librpm-tizen-e680cce3e8a80425586c6e2448f57a48606d220b.tar.bz2 librpm-tizen-e680cce3e8a80425586c6e2448f57a48606d220b.zip |
- fix: harmless typo in db3 chroot hack.
- fix: big-endian's with sizeof(time_t) != sizeof(int_32) mtime broken.
- fix: add Korean message catalogs (#54473).
- add RPHNPLATFORM and PLATFORM tags.
- linear search on added package provides is dumb.
- discarding entire signature header when using --addsign is dumb.
CVS patchset: 5159
CVS date: 2001/11/06 22:46:26
Diffstat (limited to 'rpmdb/rpmhash.c')
-rw-r--r-- | rpmdb/rpmhash.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/rpmdb/rpmhash.c b/rpmdb/rpmhash.c index 6abe75cdf..4af583246 100644 --- a/rpmdb/rpmhash.c +++ b/rpmdb/rpmhash.c @@ -10,20 +10,24 @@ typedef /*@owned@*/ const void * voidptr; -/** */ -struct hashBucket { +typedef struct hashBucket_s * hashBucket; + +/** + */ +struct hashBucket_s { voidptr key; /*!< hash key */ /*@owned@*/ voidptr * data; /*!< pointer to hashed data */ int dataCount; /*!< length of data (0 if unknown) */ -/*@dependent@*/struct hashBucket * next;/*!< pointer to next item in bucket */ +/*@dependent@*/hashBucket next; /*!< pointer to next item in bucket */ }; -/** */ +/** + */ struct hashTable_s { int numBuckets; /*!< number of hash buckets */ int keySize; /*!< size of key (0 if unknown) */ int freeData; /*!< should data be freed when table is destroyed? */ - struct hashBucket ** buckets; /*!< hash bucket array */ + hashBucket * buckets; /*!< hash bucket array */ hashFunctionType fn; /*!< generate hash value for key */ hashEqualityType eq; /*!< compare hash keys for equality */ }; @@ -35,11 +39,11 @@ struct hashTable_s { * @return pointer to hash bucket of key (or NULL) */ static /*@shared@*/ /*@null@*/ -struct hashBucket *findEntry(hashTable ht, const void * key) +hashBucket findEntry(hashTable ht, const void * key) /*@*/ { unsigned int hash; - struct hashBucket * b; + hashBucket b; /*@-modunconnomods@*/ hash = ht->fn(key) % ht->numBuckets; @@ -76,8 +80,8 @@ unsigned int hashFunctionString(const void * string) return ((((unsigned)len) << 16) + (((unsigned)sum) << 8) + xorValue); } -hashTable htCreate(int numBuckets, int keySize, int freeData, hashFunctionType fn, - hashEqualityType eq) +hashTable htCreate(int numBuckets, int keySize, int freeData, + hashFunctionType fn, hashEqualityType eq) { hashTable ht; @@ -86,8 +90,10 @@ hashTable htCreate(int numBuckets, int keySize, int freeData, hashFunctionType f ht->buckets = xcalloc(numBuckets, sizeof(*ht->buckets)); ht->keySize = keySize; ht->freeData = freeData; + /*@-assignexpose@*/ ht->fn = fn; ht->eq = eq; + /*@=assignexpose@*/ return ht; } @@ -95,7 +101,7 @@ hashTable htCreate(int numBuckets, int keySize, int freeData, hashFunctionType f void htAddEntry(hashTable ht, const void * key, const void * data) { unsigned int hash; - struct hashBucket * b; + hashBucket b; hash = ht->fn(key) % ht->numBuckets; b = ht->buckets[hash]; @@ -126,7 +132,7 @@ void htAddEntry(hashTable ht, const void * key, const void * data) void htFree(hashTable ht) { - struct hashBucket * b, * n; + hashBucket b, n; int i; for (i = 0; i < ht->numBuckets; i++) { @@ -154,7 +160,7 @@ void htFree(hashTable ht) int htHasEntry(hashTable ht, const void * key) { - struct hashBucket * b; + hashBucket b; if (!(b = findEntry(ht, key))) return 0; else return 1; } @@ -162,7 +168,7 @@ int htHasEntry(hashTable ht, const void * key) int htGetEntry(hashTable ht, const void * key, const void *** data, int * dataCount, const void ** tableKey) { - struct hashBucket * b; + hashBucket b; if ((b = findEntry(ht, key)) == NULL) return 1; |