summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-02-25 18:19:55 +0100
committerSergei Golubchik <serg@mariadb.org>2016-02-25 18:19:55 +0100
commit00d1db7a38b17d4512a6ba5147926608aca5624d (patch)
treec2b28145304e9eacf79fcabaeb962a20d79fec93 /strings
parent0485328d030f4b742dac7b667e8ed099beb9e9f2 (diff)
parent0251232f8c3bca33b4dd15d6668105f3de9d024d (diff)
downloadmariadb-git-00d1db7a38b17d4512a6ba5147926608aca5624d.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype.c28
-rw-r--r--strings/my_vsnprintf.c2
2 files changed, 17 insertions, 13 deletions
diff --git a/strings/ctype.c b/strings/ctype.c
index f871a219245..620c7e13503 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -1030,19 +1030,18 @@ my_charset_is_ascii_compatible(CHARSET_INFO *cs)
@return Number of bytes copied to 'to' string
*/
-static uint32
-my_convert_internal(char *to, uint32 to_length,
- CHARSET_INFO *to_cs,
- const char *from, uint32 from_length,
- CHARSET_INFO *from_cs, uint *errors)
+uint32
+my_convert_using_func(char *to, uint32 to_length,
+ CHARSET_INFO *to_cs, my_charset_conv_wc_mb wc_mb,
+ const char *from, uint32 from_length,
+ CHARSET_INFO *from_cs, my_charset_conv_mb_wc mb_wc,
+ uint *errors)
{
int cnvres;
my_wc_t wc;
const uchar *from_end= (const uchar*) from + from_length;
char *to_start= to;
uchar *to_end= (uchar*) to + to_length;
- my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
- my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
uint error_count= 0;
while (1)
@@ -1119,8 +1118,11 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
immediately switch to slow mb_wc->wc_mb method.
*/
if ((to_cs->state | from_cs->state) & MY_CS_NONASCII)
- return my_convert_internal(to, to_length, to_cs,
- from, from_length, from_cs, errors);
+ return my_convert_using_func(to, to_length,
+ to_cs, to_cs->cset->wc_mb,
+ from, from_length,
+ from_cs, from_cs->cset->mb_wc,
+ errors);
length= length2= MY_MIN(to_length, from_length);
@@ -1152,9 +1154,11 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
uint32 copied_length= length2 - length;
to_length-= copied_length;
from_length-= copied_length;
- return copied_length + my_convert_internal(to, to_length, to_cs,
- from, from_length, from_cs,
- errors);
+ return copied_length + my_convert_using_func(to, to_length, to_cs,
+ to_cs->cset->wc_mb,
+ from, from_length, from_cs,
+ from_cs->cset->mb_wc,
+ errors);
}
}
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 1584a9e2cef..4178b20789d 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -831,7 +831,7 @@ void my_strerror(char *buf, size_t len, int nr)
(defined _XOPEN_SOURCE && (_XOPEN_SOURCE >= 600))) && \
! defined _GNU_SOURCE
strerror_r(nr, buf, len); /* I can build with or without GNU */
-#elif defined _GNU_SOURCE
+#elif defined(__GLIBC__) && defined (_GNU_SOURCE)
char *r= strerror_r(nr, buf, len);
if (r != buf) /* Want to help, GNU? */
strmake(buf, r, len - 1); /* Then don't. */