aboutsummaryrefslogtreecommitdiff
path: root/iconvdata/ibm935.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-10-26 10:44:50 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-10-26 13:05:48 +0200
commitb9deb8ce2a72de8f74361ea10dd4c4b116458518 (patch)
tree8c953fc6bf1bde2a361d93f8b61be4243cdb6d33 /iconvdata/ibm935.c
parent68fc2ccc1aebc15b92e596b2bdc5605da1e25f3c (diff)
downloadglibc-b9deb8ce2a72de8f74361ea10dd4c4b116458518.tar
glibc-b9deb8ce2a72de8f74361ea10dd4c4b116458518.tar.gz
glibc-b9deb8ce2a72de8f74361ea10dd4c4b116458518.tar.bz2
glibc-b9deb8ce2a72de8f74361ea10dd4c4b116458518.zip
iconv: Avoid writable data and relocations in IBM charsets
The IBM930, IBM933, IBM935 and IBM939 converters defined lookup tables which were not constant. They also contained an unnecessary pointer indirection.
Diffstat (limited to 'iconvdata/ibm935.c')
-rw-r--r--iconvdata/ibm935.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/iconvdata/ibm935.c b/iconvdata/ibm935.c
index 2d3065e54c..d6574e89e2 100644
--- a/iconvdata/ibm935.c
+++ b/iconvdata/ibm935.c
@@ -190,7 +190,6 @@ enum
uint32_t ch = get32 (inptr); \
const struct gap *rp1 = __ucs4_to_ibm935sb_idx; \
const struct gap *rp2 = __ucs4_to_ibm935db_idx; \
- const char *cp; \
\
if (__glibc_unlikely (ch >= 0xffff)) \
{ \
@@ -203,14 +202,16 @@ enum
++rp1; \
\
/* Use the UCS4 table for single byte. */ \
+ unsigned char sbconv; \
if (__builtin_expect (ch < rp1->start, 0) \
- || (cp = __ucs4_to_ibm935sb[ch + rp1->idx], \
- __builtin_expect (cp[0], L'\1') == L'\0' && ch != '\0')) \
+ || (sbconv = __ucs4_to_ibm935sb[ch + rp1->idx], \
+ __builtin_expect (sbconv, L'\1') == L'\0' && ch != '\0')) \
{ \
/* Use the UCS4 table for double byte. */ \
while (ch > rp2->end) \
++rp2; \
\
+ const char *cp; \
if (__builtin_expect (ch < rp2->start, 0) \
|| (cp = __ucs4_to_ibm935db[ch + rp2->idx], \
__builtin_expect (cp[0], L'\1')==L'\0' && ch != '\0')) \
@@ -258,7 +259,7 @@ enum
result = __GCONV_FULL_OUTPUT; \
break; \
} \
- *outptr++ = cp[0]; \
+ *outptr++ = sbconv; \
} \
\
/* Now that we wrote the output increment the input pointer. */ \