summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-04-25 10:07:47 -0600
committerKarl Williamson <public@khwilliamson.com>2013-05-20 11:01:50 -0600
commitd22b930b662c8c65d2e856c42f4a59454444a111 (patch)
tree17b047fc198862a36aa4322fcf8b83a0d5d15450
parent25200305a51f99449a69c43f5d279893ab5a0188 (diff)
downloadperl-d22b930b662c8c65d2e856c42f4a59454444a111.tar.gz
Use new case changing macros
The previous commit added macros to do some case changing. This commit uses them in the core, where appropriate.
-rw-r--r--ext/File-Glob/bsd_glob.c4
-rw-r--r--pp.c7
-rw-r--r--utf8.c9
-rw-r--r--utf8.h4
4 files changed, 10 insertions, 14 deletions
diff --git a/ext/File-Glob/bsd_glob.c b/ext/File-Glob/bsd_glob.c
index 72d8fc7372..7ec24df664 100644
--- a/ext/File-Glob/bsd_glob.c
+++ b/ext/File-Glob/bsd_glob.c
@@ -617,12 +617,12 @@ ci_compare(const void *p, const void *q)
const char *qq = *(const char **)q;
int ci;
while (*pp && *qq) {
- if (toLOWER(*pp) != toLOWER(*qq))
+ if (toFOLD(*pp) != toFOLD(*qq))
break;
++pp;
++qq;
}
- ci = toLOWER(*pp) - toLOWER(*qq);
+ ci = toFOLD(*pp) - toFOLD(*qq);
if (ci == 0)
return compare(p, q);
return ci;
diff --git a/pp.c b/pp.c
index 337c339769..bd2d8c907e 100644
--- a/pp.c
+++ b/pp.c
@@ -4198,18 +4198,15 @@ PP(pp_fc)
}
} /* Unflagged string */
else if (len) {
- /* For locale, bytes, and nothing, the behavior is supposed to be the
- * same as lc().
- */
if ( IN_LOCALE_RUNTIME ) { /* Under locale */
TAINT;
SvTAINTED_on(dest);
for (; s < send; d++, s++)
- *d = toLOWER_LC(*s);
+ *d = toFOLD_LC(*s);
}
else if ( !IN_UNI_8_BIT ) { /* Under nothing, or bytes */
for (; s < send; d++, s++)
- *d = toLOWER(*s);
+ *d = toFOLD(*s);
}
else {
/* For ASCII and the Latin-1 range, there's only two troublesome
diff --git a/utf8.c b/utf8.c
index 9ae1580ce9..90d0722ca7 100644
--- a/utf8.c
+++ b/utf8.c
@@ -2776,7 +2776,7 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, U8 flags, b
if (UTF8_IS_INVARIANT(*p)) {
if (flags & FOLD_FLAGS_LOCALE) {
- result = toLOWER_LC(*p);
+ result = toFOLD_LC(*p);
}
else {
return _to_fold_latin1(*p, ustrp, lenp,
@@ -2785,7 +2785,7 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, U8 flags, b
}
else if UTF8_IS_DOWNGRADEABLE_START(*p) {
if (flags & FOLD_FLAGS_LOCALE) {
- result = toLOWER_LC(TWO_BYTE_UTF8_TO_UNI(*p, *(p+1)));
+ result = toFOLD_LC(TWO_BYTE_UTF8_TO_UNI(*p, *(p+1)));
}
else {
return _to_fold_latin1(TWO_BYTE_UTF8_TO_UNI(*p, *(p+1)),
@@ -4580,8 +4580,7 @@ Perl_foldEQ_utf8_flags(pTHX_ const char *s1, char **pe1, UV l1, bool u1, const c
return 0;
}
n1 = 1;
- *foldbuf1 = toLOWER(*p1); /* Folds in the ASCII range are
- just lowercased */
+ *foldbuf1 = toFOLD(*p1);
}
else if (u1) {
to_utf8_fold(p1, foldbuf1, &n1);
@@ -4628,7 +4627,7 @@ Perl_foldEQ_utf8_flags(pTHX_ const char *s1, char **pe1, UV l1, bool u1, const c
return 0;
}
n2 = 1;
- *foldbuf2 = toLOWER(*p2);
+ *foldbuf2 = toFOLD(*p2);
}
else if (u2) {
to_utf8_fold(p2, foldbuf2, &n2);
diff --git a/utf8.h b/utf8.h
index 01d8f5fa20..ea54a2d262 100644
--- a/utf8.h
+++ b/utf8.h
@@ -504,8 +504,8 @@ Perl's extended UTF-8 means we can have start bytes up to FF.
(ANYOF_NONBITMAP(node)) && \
(ANYOF_FLAGS(node) & ANYOF_LOC_NONBITMAP_FOLD) && \
((end) > (input) + 1) && \
- toLOWER((input)[0]) == 's' && \
- toLOWER((input)[1]) == 's')
+ toFOLD((input)[0]) == 's' && \
+ toFOLD((input)[1]) == 's')
#define SHARP_S_SKIP 2
/* If you want to exclude surrogates, and beyond legal Unicode, see the blame