summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-09-14 14:13:27 +0100
committerDavid Mitchell <davem@iabyn.com>2015-09-14 14:13:27 +0100
commit8b2312d5cbd1295fdfbaed4e3744fc521e549f26 (patch)
tree898c96eb06388357b79f132be940c1573a565714 /regexec.c
parent801fcc250783bc56ec8033a5940b3257bcd9a7db (diff)
downloadperl-8b2312d5cbd1295fdfbaed4e3744fc521e549f26.tar.gz
Revert "#126039 regexec.c: Fix compiler warning"
This reverts commit 801fcc250783bc56ec8033a5940b3257bcd9a7db. This commit fixed some compiler warnings in S_regmatch() by adding a new function-scoped var. I have a better fix - to be applied shortly - that instead uses tmp boolean vars declared in a small scope as and where needed.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/regexec.c b/regexec.c
index 90d1ecc597..c88f46759c 100644
--- a/regexec.c
+++ b/regexec.c
@@ -4813,8 +4813,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
regnode *scan;
regnode *next;
U32 n = 0; /* general value; init to avoid compiler warning */
- U32 prevn = 0; /* previous character; init to avoid compiler warning */
- SSize_t ln = 0; /* len; init to avoid compiler warning */
+ SSize_t ln = 0; /* len or last; init to avoid compiler warning */
char *locinput = startpos;
char *pushinput; /* where to continue after a PUSH */
I32 nextchr; /* is always set to UCHARAT(locinput) */
@@ -5539,9 +5538,9 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
if (utf8_target) {
if (locinput == reginfo->strbeg)
- prevn = isWORDCHAR_LC('\n');
+ ln = isWORDCHAR_LC('\n');
else {
- prevn = isWORDCHAR_LC_utf8(reghop3((U8*)locinput, -1,
+ ln = isWORDCHAR_LC_utf8(reghop3((U8*)locinput, -1,
(U8*)(reginfo->strbeg)));
}
n = (NEXTCHR_IS_EOS)
@@ -5549,14 +5548,14 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
: isWORDCHAR_LC_utf8((U8*)locinput);
}
else { /* Here the string isn't utf8 */
- prevn = (locinput == reginfo->strbeg)
+ ln = (locinput == reginfo->strbeg)
? isWORDCHAR_LC('\n')
: isWORDCHAR_LC(UCHARAT(locinput - 1));
n = (NEXTCHR_IS_EOS)
? isWORDCHAR_LC('\n')
: isWORDCHAR_LC(nextchr);
}
- if (to_complement ^ (prevn == n)) {
+ if (to_complement ^ (ln == n)) {
sayNO;
}
break;
@@ -5587,13 +5586,13 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
* 2) it is a multi-byte character, in which case the final byte is
* never mistakable for ASCII, and so the test will say it is
* not a word character, which is the correct answer. */
- prevn = (locinput == reginfo->strbeg)
+ ln = (locinput == reginfo->strbeg)
? isWORDCHAR_A('\n')
: isWORDCHAR_A(UCHARAT(locinput - 1));
n = (NEXTCHR_IS_EOS)
? isWORDCHAR_A('\n')
: isWORDCHAR_A(nextchr);
- if (to_complement ^ (prevn == n)) {
+ if (to_complement ^ (ln == n)) {
sayNO;
}
break;
@@ -5610,14 +5609,14 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
bound_utf8:
switch((bound_type) FLAGS(scan)) {
case TRADITIONAL_BOUND:
- prevn = (locinput == reginfo->strbeg)
+ ln = (locinput == reginfo->strbeg)
? 0 /* isWORDCHAR_L1('\n') */
: isWORDCHAR_utf8(reghop3((U8*)locinput, -1,
(U8*)(reginfo->strbeg)));
n = (NEXTCHR_IS_EOS)
? 0 /* isWORDCHAR_L1('\n') */
: isWORDCHAR_utf8((U8*)locinput);
- match = cBOOL(prevn != n);
+ match = cBOOL(ln != n);
break;
case GCB_BOUND:
if (locinput == reginfo->strbeg || NEXTCHR_IS_EOS) {
@@ -5680,13 +5679,13 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
else { /* Not utf8 target */
switch((bound_type) FLAGS(scan)) {
case TRADITIONAL_BOUND:
- prevn = (locinput == reginfo->strbeg)
+ ln = (locinput == reginfo->strbeg)
? 0 /* isWORDCHAR_L1('\n') */
: isWORDCHAR_L1(UCHARAT(locinput - 1));
n = (NEXTCHR_IS_EOS)
? 0 /* isWORDCHAR_L1('\n') */
: isWORDCHAR_L1(nextchr);
- match = cBOOL(prevn != n);
+ match = cBOOL(ln != n);
break;
case GCB_BOUND: