summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2017-11-10 13:40:12 -0500
committerRich Felker <dalias@aerifal.cx>2017-11-10 13:40:12 -0500
commit0df5b39a1e9c8aaf480e3f8667d7967e08bbef2b (patch)
tree7a6fe59c38e4b0265943178dad3518486ad9cba0 /src
parent9eb6dd5165b803715f82b9f5d4b557878f77a580 (diff)
downloadmusl-0df5b39a1e9c8aaf480e3f8667d7967e08bbef2b.tar.gz
simplify/optimize iconv utf-8 case
the special case where mbrtowc returns 0 but consumed 1 byte of input does not need to be considered, because the short-circuit for low bytes already covered that case.
Diffstat (limited to 'src')
-rw-r--r--src/locale/iconv.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/locale/iconv.c b/src/locale/iconv.c
index af0d8283..fd51b73e 100644
--- a/src/locale/iconv.c
+++ b/src/locale/iconv.c
@@ -195,11 +195,10 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
switch (type) {
case UTF_8:
- if (c < 128) break; // optimization
+ if (c < 128) break;
l = mbrtowc_utf8(&wc, *in, *inb, &st);
- if (!l) l++;
- else if (l == (size_t)-1) goto ilseq;
- else if (l == (size_t)-2) goto starved;
+ if (l == (size_t)-1) goto ilseq;
+ if (l == (size_t)-2) goto starved;
c = wc;
break;
case US_ASCII: