diff options
author | unknown <jimw@mysql.com> | 2005-06-01 11:30:59 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-06-01 11:30:59 -0700 |
commit | e6ec99442dc14c4a23460da00979776b152c588a (patch) | |
tree | 1592d2c8e578b3e67acbd0a3ecd8e7645e4b5846 /mysys/hash.c | |
parent | 853a55ad215db4f44bee4281de57054bf2f7da17 (diff) | |
download | mariadb-git-e6ec99442dc14c4a23460da00979776b152c588a.tar.gz |
Fix hashcmp() to handle special case of zero length, which
resulted in the hostname cache being ineffective. Based on
patch from Jeremy Cole of Yahoo! (Bug #10931)
mysys/hash.c:
Fix hashcmp() to handle length == 0 as in 4.0, and document the
function, including this special case.
Diffstat (limited to 'mysys/hash.c')
-rw-r--r-- | mysys/hash.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/mysys/hash.c b/mysys/hash.c index b829f19dfc8..ffebdf76144 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -262,7 +262,25 @@ static void movelink(HASH_LINK *array,uint find,uint next_link,uint newlink) return; } - /* Compare a key in a record to a whole key. Return 0 if identical */ +/* + Compare a key in a record to a whole key. Return 0 if identical + + SYNOPSIS + hashcmp() + hash hash table + pos position of hash record to use in comparison + key key for comparison + length length of key + + NOTES: + If length is 0, comparison is done using the length of the + record being compared against. + + RETURN + < 0 key of record < key + = 0 key of record == key + > 0 key of record > key + */ static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length) { @@ -270,7 +288,7 @@ static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length) byte *rec_key= (byte*) hash_key(hash,pos->data,&rec_keylength,1); return ((length && length != rec_keylength) || my_strnncoll(hash->charset, (uchar*) rec_key, rec_keylength, - (uchar*) key, length)); + (uchar*) key, rec_keylength)); } |