diff options
author | bar@bar.mysql.r18.ru <> | 2002-10-10 16:52:22 +0500 |
---|---|---|
committer | bar@bar.mysql.r18.ru <> | 2002-10-10 16:52:22 +0500 |
commit | a0dd5febfcdb93247df45f3d0d6f674dda59311c (patch) | |
tree | e790007e93397bb7bde6736323e58af58b68ba77 /mysys/hash.c | |
parent | 11a93ede41aa6546f2f0af21bc12b83d382189be (diff) | |
download | mariadb-git-a0dd5febfcdb93247df45f3d0d6f674dda59311c.tar.gz |
Move hash_sort and hash_caseup into CHARSET_INFO for all charsets
Diffstat (limited to 'mysys/hash.c')
-rw-r--r-- | mysys/hash.c | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/mysys/hash.c b/mysys/hash.c index 43e6981f79d..2ef17be5341 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -32,7 +32,6 @@ static uint hash_mask(uint hashnr,uint buffmax,uint maxlength); static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink); static uint calc_hashnr(CHARSET_INFO *cs,const byte *key,uint length); -static uint calc_hashnr_caseup(CHARSET_INFO *cs, const byte *key,uint length); static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length); @@ -60,12 +59,7 @@ _hash_init(HASH *hash,CHARSET_INFO *charset, hash->flags=flags; hash->charset=charset; if (flags & HASH_CASE_INSENSITIVE) - { - if (charset->hash_caseup) - hash->calc_hashnr=charset->hash_caseup; - else - hash->calc_hashnr=calc_hashnr_caseup; - } + hash->calc_hashnr=charset->hash_caseup; else hash->calc_hashnr=calc_hashnr; DBUG_RETURN(0); @@ -132,22 +126,6 @@ static uint calc_hashnr(CHARSET_INFO *cs __attribute__((unused)), return((uint) nr); } - /* Calc hashvalue for a key, case indepenently */ - -static uint calc_hashnr_caseup(CHARSET_INFO *cs, const byte *key,uint length) -{ - register uint nr=1, nr2=4; - register uchar *map=cs->to_upper; - - while (length--) - { - nr^= (((nr & 63)+nr2)* - ((uint) (uchar) map[(uchar)*key++])) + (nr << 8); - nr2+=3; - } - return((uint) nr); -} - #else /* @@ -175,18 +153,6 @@ uint calc_hashnr(CHARSET_INFO *cs, const byte *key, uint len) return (hash); } -uint calc_hashnr_caseup(CHARSET_INFO *cs, const byte *key, uint len) -{ - const byte *end=key+len; - uint hash; - for (hash = 0; key < end; key++) - { - hash *= 16777619; - hash ^= (uint) (uchar) my_toupper(cs,*key); - } - return (hash); -} - #endif |