aboutsummaryrefslogtreecommitdiffstats
path: root/enc
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-11 08:49:38 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-11 08:49:38 +0000
commitf2a187981e9c01a4ed4162b1543b2238f57a1bf8 (patch)
tree58b9c4d94df446d436931e2ece7d56ae206ad241 /enc
parent4df152d27983336435d6631719dd7e9e6916181a (diff)
downloadruby-f2a187981e9c01a4ed4162b1543b2238f57a1bf8.tar.gz
* enc/iso_8859_4.c, enc/iso_8859_10.c, enc/iso_8859_14.c,
enc/iso_8859_15.c, enc/iso_8859_16.c: Replace case-by-case code with lookup in ENC_ISO_8859_xx_TO_LOWER_CASE table. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc')
-rw-r--r--enc/iso_8859_10.c5
-rw-r--r--enc/iso_8859_14.c15
-rw-r--r--enc/iso_8859_15.c11
-rw-r--r--enc/iso_8859_16.c15
-rw-r--r--enc/iso_8859_4.c9
5 files changed, 5 insertions, 50 deletions
diff --git a/enc/iso_8859_10.c b/enc/iso_8859_10.c
index 569c26c264..d302c78023 100644
--- a/enc/iso_8859_10.c
+++ b/enc/iso_8859_10.c
@@ -252,10 +252,7 @@ case_map (OnigCaseFoldType* flagP, const OnigUChar** pp,
else if ((EncISO_8859_10_CtypeTable[code] & BIT_CTYPE_UPPER)
&& (flags & (ONIGENC_CASE_DOWNCASE|ONIGENC_CASE_FOLD))) {
flags |= ONIGENC_CASE_MODIFIED;
- if (code>=0xA0 && code<=0xBF)
- code += 0x10;
- else
- code += 0x20;
+ code = ENC_ISO_8859_10_TO_LOWER_CASE(code);
}
else if ((EncISO_8859_10_CtypeTable[code]&BIT_CTYPE_LOWER)
&& (flags&ONIGENC_CASE_UPCASE)) {
diff --git a/enc/iso_8859_14.c b/enc/iso_8859_14.c
index 708204b662..3d172e0ba4 100644
--- a/enc/iso_8859_14.c
+++ b/enc/iso_8859_14.c
@@ -254,20 +254,7 @@ case_map (OnigCaseFoldType* flagP, const OnigUChar** pp,
else if ((EncISO_8859_14_CtypeTable[code] & BIT_CTYPE_UPPER)
&& (flags & (ONIGENC_CASE_DOWNCASE|ONIGENC_CASE_FOLD))) {
flags |= ONIGENC_CASE_MODIFIED;
- if (code == 0xA1 || code == 0xA4 || code == 0xB0 || code == 0xB2 || code == 0xB4 || code == 0xBD)
- code += 0x1;
- else if(code == 0xA6)
- code += 0x5;
- else if(code == 0xAF)
- code += 0x50;
- else if(code == 0xB7)
- code += 0x2;
- else if(code == 0xBB)
- code += 0x4;
- else if(code == 0xA8 || code == 0xAA || code == 0xAC)
- code += 0x10;
- else
- code += 0x20;
+ code = ENC_ISO_8859_14_TO_LOWER_CASE(code);
}
else if ((EncISO_8859_14_CtypeTable[code]&BIT_CTYPE_LOWER)
&& (flags&ONIGENC_CASE_UPCASE)) {
diff --git a/enc/iso_8859_15.c b/enc/iso_8859_15.c
index 5180383331..4e6f76ed2b 100644
--- a/enc/iso_8859_15.c
+++ b/enc/iso_8859_15.c
@@ -248,16 +248,7 @@ case_map (OnigCaseFoldType* flagP, const OnigUChar** pp,
else if ((EncISO_8859_15_CtypeTable[code] & BIT_CTYPE_UPPER)
&& (flags & (ONIGENC_CASE_DOWNCASE|ONIGENC_CASE_FOLD))) {
flags |= ONIGENC_CASE_MODIFIED;
- if (code==0xA6)
- code += 2;
- else if (code==0xB4)
- code += 4;
- else if (code==0xBC)
- code += 1;
- else if (code==0xBE)
- code += 0x41;
- else
- code += 0x20;
+ code = ENC_ISO_8859_15_TO_LOWER_CASE(code);
}
else if ((EncISO_8859_15_CtypeTable[code]&BIT_CTYPE_LOWER)
&& (flags&ONIGENC_CASE_UPCASE)) {
diff --git a/enc/iso_8859_16.c b/enc/iso_8859_16.c
index 4f768cd9f0..8527b00cf2 100644
--- a/enc/iso_8859_16.c
+++ b/enc/iso_8859_16.c
@@ -249,20 +249,7 @@ case_map (OnigCaseFoldType* flagP, const OnigUChar** pp,
else if ((EncISO_8859_16_CtypeTable[code] & BIT_CTYPE_UPPER)
&& (flags & (ONIGENC_CASE_DOWNCASE|ONIGENC_CASE_FOLD))) {
flags |= ONIGENC_CASE_MODIFIED;
- if (code==0xA1 || code==0xBC)
- code++;
- else if (code==0xA3 || code==0xAA || code==0xAF)
- code += 0x10;
- else if (code==0xA6 || code==0xAC)
- code += 0x02;
- else if (code==0xB2)
- code += 0x07;
- else if (code==0xB4)
- code += 0x04;
- else if (code==0xBE)
- code += 0x41;
- else
- code += 0x20;
+ code = ENC_ISO_8859_16_TO_LOWER_CASE(code);
}
else if ((EncISO_8859_16_CtypeTable[code]&BIT_CTYPE_LOWER)
&& (flags&ONIGENC_CASE_UPCASE)) {
diff --git a/enc/iso_8859_4.c b/enc/iso_8859_4.c
index ea529a10da..06a57ef7aa 100644
--- a/enc/iso_8859_4.c
+++ b/enc/iso_8859_4.c
@@ -250,14 +250,7 @@ case_map(OnigCaseFoldType* flagP, const OnigUChar** pp,
else if ((EncISO_8859_4_CtypeTable[code] & BIT_CTYPE_UPPER)
&& (flags & (ONIGENC_CASE_DOWNCASE|ONIGENC_CASE_FOLD))) {
flags |= ONIGENC_CASE_MODIFIED;
- if (code>=0xA0 && code<=0xBF) {
- if (code==0xBD)
- code += 0x02;
- else
- code += 0x10;
- }
- else
- code += 0x20;
+ code = ENC_ISO_8859_4_TO_LOWER_CASE(code);
}
else if ((EncISO_8859_4_CtypeTable[code]&BIT_CTYPE_LOWER)
&& (flags&ONIGENC_CASE_UPCASE)) {