diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-03-01 10:19:42 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-03-01 10:19:42 +0100 |
commit | 8dce8ecfda303e15daf2832d90de024a6acf8e7e (patch) | |
tree | 2373fe6c4574fb7cdc1ac0a28336f6e207393acc /strings | |
parent | 45236704e871fcd9a23887464a8ff934c827b84f (diff) | |
download | mariadb-git-8dce8ecfda303e15daf2832d90de024a6acf8e7e.tar.gz |
minor cleanup
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-bin.c | 15 | ||||
-rw-r--r-- | strings/ctype-mb.c | 8 | ||||
-rw-r--r-- | strings/ctype-ucs2.c | 12 |
3 files changed, 14 insertions, 21 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 52dae7912af..71dc78d7593 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -276,18 +276,17 @@ void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *key, size_t len, ulong *nr1, ulong *nr2) { - const uchar *pos = key; /* Remove trailing spaces. We have to do this to be able to compare 'A ' and 'A' as identical */ - key= skip_trailing_space(key, len); + const uchar *end = skip_trailing_space(key, len); - for (; pos < (uchar*) key ; pos++) + for (; key < end ; key++) { nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * - ((uint)*pos)) + (nr1[0] << 8); + ((uint)*key)) + (nr1[0] << 8); nr2[0]+=3; } } @@ -296,14 +295,12 @@ void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *key, size_t len,ulong *nr1, ulong *nr2) { - const uchar *pos = key; + const uchar *end = key + len; - key+= len; - - for (; pos < (uchar*) key ; pos++) + for (; key < end ; key++) { nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * - ((uint)*pos)) + (nr1[0] << 8); + ((uint)*key)) + (nr1[0] << 8); nr2[0]+=3; } } diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index c6f280dfc17..f4e70fd1dd5 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -680,18 +680,16 @@ void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *key, size_t len,ulong *nr1, ulong *nr2) { - const uchar *pos = key; - /* Remove trailing spaces. We have to do this to be able to compare 'A ' and 'A' as identical */ - key= skip_trailing_space(key, len); + const uchar *end = skip_trailing_space(key, len); - for (; pos < (uchar*) key ; pos++) + for (; key < end ; key++) { nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * - ((uint)*pos)) + (nr1[0] << 8); + ((uint)*key)) + (nr1[0] << 8); nr2[0]+=3; } } diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 1a99b32c761..a7f948ebe3a 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -3311,17 +3311,15 @@ static void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *key, size_t len,ulong *nr1, ulong *nr2) { - const uchar *pos = key; - - key+= len; + const uchar *end = key + len; - while (key > pos+1 && key[-1] == ' ' && key[-2] == '\0') - key-= 2; + while (end > key+1 && end[-1] == ' ' && end[-2] == '\0') + end-= 2; - for (; pos < (uchar*) key ; pos++) + for (; key < (uchar*) end ; key++) { nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * - ((uint)*pos)) + (nr1[0] << 8); + ((uint)*key)) + (nr1[0] << 8); nr2[0]+=3; } } |