"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/cpluff/kazlib/hash.c" between
xbmc-18.7.1-Leia.tar.gz and xbmc-18.8-Leia.tar.gz

About: XBMC is a software media player and entertainment hub for digital media that plays almost all popular audio and video formats around (new name "Kodi").

hash.c  (xbmc-18.7.1-Leia):hash.c  (xbmc-18.8-Leia)
skipping to change at line 63 skipping to change at line 63
#define compare hash_compare #define compare hash_compare
#define function hash_function #define function hash_function
#define allocnode hash_allocnode #define allocnode hash_allocnode
#define freenode hash_freenode #define freenode hash_freenode
#define context hash_context #define context hash_context
#define mask hash_mask #define mask hash_mask
#define dynamic hash_dynamic #define dynamic hash_dynamic
#define table hash_table #define table hash_table
#define chain hash_chain #define chain hash_chain
#define hash_lookup cpluff_hash_lookup
static hnode_t *hnode_alloc(void *context); static hnode_t *hnode_alloc(void *context);
static void hnode_free(hnode_t *node, void *context); static void hnode_free(hnode_t *node, void *context);
static hash_val_t hash_fun_default(const void *key); static hash_val_t hash_fun_default(const void *key);
static int hash_comp_default(const void *key1, const void *key2); static int hash_comp_default(const void *key1, const void *key2);
CP_HIDDEN int hash_val_t_bit; CP_HIDDEN int hash_val_t_bit;
/* /*
* Compute the number of bits in the hash_val_t type. We know that hash_val_t * Compute the number of bits in the hash_val_t type. We know that hash_val_t
skipping to change at line 560 skipping to change at line 561
* we descend down the chain, we can compare hash values first and only if * we descend down the chain, we can compare hash values first and only if
* hash values match do we perform a full key comparison. * hash values match do we perform a full key comparison.
* 2. To locate the chain from among 2^N chains, we look at the lower N bits of * 2. To locate the chain from among 2^N chains, we look at the lower N bits of
* the hash value by anding them with the current mask. * the hash value by anding them with the current mask.
* 3. Looping through the chain, we compare the stored hash value inside each * 3. Looping through the chain, we compare the stored hash value inside each
* node against our computed hash. If they match, then we do a full * node against our computed hash. If they match, then we do a full
* comparison between the unhashed keys. If these match, we have located the * comparison between the unhashed keys. If these match, we have located the
* entry. * entry.
*/ */
CP_HIDDEN hnode_t *hash_lookup(hash_t *hash, const void *key) CP_HIDDEN hnode_t *cpluff_hash_lookup(hash_t *hash, const void *key)
{ {
hash_val_t hkey, chain; hash_val_t hkey, chain;
hnode_t *nptr; hnode_t *nptr;
hkey = hash->function(key); /* 1 */ hkey = hash->function(key); /* 1 */
chain = hkey & hash->mask; /* 2 */ chain = hkey & hash->mask; /* 2 */
for (nptr = hash->table[chain]; nptr; nptr = nptr->next) { /* 3 */ for (nptr = hash->table[chain]; nptr; nptr = nptr->next) { /* 3 */
if (nptr->hkey == hkey && hash->compare(nptr->key, key) == 0) if (nptr->hkey == hkey && hash->compare(nptr->key, key) == 0)
return nptr; return nptr;
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)