Skip to content

Commit

Permalink
PATCH [perl #126039] regexec.c: Fix compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
dcollinsn authored and khwilliamson committed Sep 13, 2015
1 parent 9ca36e5 commit 801fcc2
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions regexec.c
Expand Up @@ -4813,7 +4813,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
regnode *scan;
regnode *next;
U32 n = 0; /* general value; init to avoid compiler warning */
SSize_t ln = 0; /* len or last; 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 */
char *locinput = startpos;
char *pushinput; /* where to continue after a PUSH */
I32 nextchr; /* is always set to UCHARAT(locinput) */
Expand Down Expand Up @@ -5538,24 +5539,24 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)

if (utf8_target) {
if (locinput == reginfo->strbeg)
ln = isWORDCHAR_LC('\n');
prevn = isWORDCHAR_LC('\n');
else {
ln = isWORDCHAR_LC_utf8(reghop3((U8*)locinput, -1,
prevn = isWORDCHAR_LC_utf8(reghop3((U8*)locinput, -1,
(U8*)(reginfo->strbeg)));
}
n = (NEXTCHR_IS_EOS)
? isWORDCHAR_LC('\n')
: isWORDCHAR_LC_utf8((U8*)locinput);
}
else { /* Here the string isn't utf8 */
ln = (locinput == reginfo->strbeg)
prevn = (locinput == reginfo->strbeg)
? isWORDCHAR_LC('\n')
: isWORDCHAR_LC(UCHARAT(locinput - 1));
n = (NEXTCHR_IS_EOS)
? isWORDCHAR_LC('\n')
: isWORDCHAR_LC(nextchr);
}
if (to_complement ^ (ln == n)) {
if (to_complement ^ (prevn == n)) {
sayNO;
}
break;
Expand Down Expand Up @@ -5586,13 +5587,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. */
ln = (locinput == reginfo->strbeg)
prevn = (locinput == reginfo->strbeg)
? isWORDCHAR_A('\n')
: isWORDCHAR_A(UCHARAT(locinput - 1));
n = (NEXTCHR_IS_EOS)
? isWORDCHAR_A('\n')
: isWORDCHAR_A(nextchr);
if (to_complement ^ (ln == n)) {
if (to_complement ^ (prevn == n)) {
sayNO;
}
break;
Expand All @@ -5609,14 +5610,14 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
bound_utf8:
switch((bound_type) FLAGS(scan)) {
case TRADITIONAL_BOUND:
ln = (locinput == reginfo->strbeg)
prevn = (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(ln != n);
match = cBOOL(prevn != n);
break;
case GCB_BOUND:
if (locinput == reginfo->strbeg || NEXTCHR_IS_EOS) {
Expand Down Expand Up @@ -5679,13 +5680,13 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
else { /* Not utf8 target */
switch((bound_type) FLAGS(scan)) {
case TRADITIONAL_BOUND:
ln = (locinput == reginfo->strbeg)
prevn = (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(ln != n);
match = cBOOL(prevn != n);
break;

case GCB_BOUND:
Expand Down

0 comments on commit 801fcc2

Please sign in to comment.