diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-07-19 13:02:14 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-07-19 13:02:14 +0400 |
commit | e2ac4098ed507957ba6dac9b408d31054a8e6b6d (patch) | |
tree | c0213f7d7dad51e96117afe64ae46c1e9364c513 /strings/ctype-ujis.c | |
parent | ab58493db22d870cb6a470d6b0551cfc70dd09f3 (diff) | |
download | mariadb-git-e2ac4098ed507957ba6dac9b408d31054a8e6b6d.tar.gz |
Simplify caseup() and casedn() in charsets
After the MDEV-13118 fix there's no code in the server that
wants caseup/casedn to change the argument in place for simple
charsets. Let's remove this logic and always return the result in a
new string for all charsets, both simple and complex.
1. Removing the optimization that *some* character sets used in casedn()
and caseup(), which allowed (and required) to change the case in-place,
overwriting the string passed as the "src" argument.
Now all CHARSET_INFO's work in the same way:
non of them change the source string in-place, all of them now convert
case from the source string to the destination string, leaving
the source string untouched.
2. Adding "const" qualifier to the "char *src" parameter
to caseup() and casedn().
3. Removing duplicate implementations in ctype-mb.c.
Now both caseup() and casedn() implementations for all CJK character sets
use internally the same function my_casefold_mb()
(the former my_casefold_mb_varlen()).
4. Removing the "unused" attribute from parameters of some my_case{up|dn}_xxx()
implementations, as the affected parameters are now *used* in the code.
Previously these parameters were used only in DBUG_ASSERT().
Diffstat (limited to 'strings/ctype-ujis.c')
-rw-r--r-- | strings/ctype-ujis.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index e7dbefe6c1d..25f8881d819 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -67179,12 +67179,12 @@ get_case_info_for_ch(CHARSET_INFO *cs, uint plane, uint page, uint offs) */ static size_t my_casefold_ujis(CHARSET_INFO *cs, - char *src, size_t srclen, + const char *src, size_t srclen, char *dst, size_t dstlen __attribute__((unused)), const uchar * const map, size_t is_upper) { - char *srcend= src + srclen, *dst0= dst; + const char *srcend= src + srclen, *dst0= dst; while (src < srcend) { @@ -67226,7 +67226,7 @@ my_casefold_ujis(CHARSET_INFO *cs, LOWER() */ size_t -my_casedn_ujis(CHARSET_INFO * cs, char *src, size_t srclen, +my_casedn_ujis(CHARSET_INFO * cs, const char *src, size_t srclen, char *dst, size_t dstlen) { DBUG_ASSERT(dstlen >= srclen * cs->casedn_multiply); @@ -67239,7 +67239,7 @@ my_casedn_ujis(CHARSET_INFO * cs, char *src, size_t srclen, UPPER() */ size_t -my_caseup_ujis(CHARSET_INFO * cs, char *src, size_t srclen, +my_caseup_ujis(CHARSET_INFO * cs, const char *src, size_t srclen, char *dst, size_t dstlen) { DBUG_ASSERT(dstlen >= srclen * cs->caseup_multiply); |