From: Rafael Garcia-Suarez Date: Tue, 22 Mar 2005 10:53:39 +0000 (+0000) Subject: Revert change #24055, which was producing a segfault in installman X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=69a95ace1ba28c07cbc7748ef89ef90fa99c2d34;p=p5sagit%2Fp5-mst-13.2.git Revert change #24055, which was producing a segfault in installman when it was trying to install perltoc. p4raw-link: @24055 on //depot/perl: c689e61c7cf072958f1f0f7838c3e6c7dc5e21d5 p4raw-id: //depot/perl@24067 --- diff --git a/regexec.c b/regexec.c index fb455a6..dddc47c 100644 --- a/regexec.c +++ b/regexec.c @@ -98,6 +98,7 @@ #define RF_warned 2 /* warned about big count? */ #define RF_evaled 4 /* Did an EVAL with setting? */ #define RF_utf8 8 /* String contains multibyte chars? */ +#define RF_false 16 /* odd number of nested negatives */ #define UTF ((PL_reg_flags & RF_utf8) != 0) @@ -2264,50 +2265,6 @@ typedef union re_unwind_t { #define sayNO_SILENT goto do_no #define saySAME(x) if (x) goto yes; else goto no -#define POSCACHE_SUCCESS 0 /* caching success rather than failure */ -#define POSCACHE_SEEN 1 /* we know what we're caching */ -#define POSCACHE_START 2 /* the real cache: this bit maps to pos 0 */ -#define CACHEsayYES STMT_START { \ - if (PL_reg_poscache) { \ - if (!(PL_reg_poscache[0] & (1<flags & 0xf) - 1 + POSCACHE_START + o * (scan->flags>>4); \ - b = o % 8; \ - o /= 8; \ - DEBUG_r( \ - PerlIO_printf(Perl_debug_log, \ - "%*s (remove success from failure cache)\n", \ - REPORT_CODE_OFF+PL_regindent*2, "") \ - ); \ - PL_reg_poscache[o] &= ~(1<flags & 0xf) - 1 + POSCACHE_START + o * (scan->flags>>4); \ - b = o % 8; \ - o /= 8; \ - DEBUG_r( \ - PerlIO_printf(Perl_debug_log, \ - "%*s (remove failure from success cache)\n", \ - REPORT_CODE_OFF+PL_regindent*2, "") \ - ); \ - PL_reg_poscache[o] &= ~(1<flags & 0xf) - 1 + POSCACHE_START + o * (scan->flags>>4); + o = (scan->flags & 0xf) - 1 + o * (scan->flags>>4); b = o % 8; o /= 8; if (PL_reg_poscache[o] & (1<next)) { regcpblow(cp); - CACHEsayYES; /* All done. */ + sayYES; /* All done. */ } REGCP_UNWIND(lastcp); regcppop(); @@ -3612,7 +3567,7 @@ S_regmatch(pTHX_ regnode *prog) "Complex regular subexpression recursion", REG_INFTY - 1); } - CACHEsayNO; + sayNO; } DEBUG_EXECUTE_r( @@ -3628,13 +3583,13 @@ S_regmatch(pTHX_ regnode *prog) REGCP_SET(lastcp); if (regmatch(cc->scan)) { regcpblow(cp); - CACHEsayYES; + sayYES; } REGCP_UNWIND(lastcp); regcppop(); cc->cur = n - 1; cc->lastloc = lastloc; - CACHEsayNO; + sayNO; } /* Prefer scan over next for maximal matching. */ @@ -3646,7 +3601,7 @@ S_regmatch(pTHX_ regnode *prog) REGCP_SET(lastcp); if (regmatch(cc->scan)) { regcpblow(cp); - CACHEsayYES; + sayYES; } REGCP_UNWIND(lastcp); regcppop(); /* Restore some previous $s? */ @@ -3670,13 +3625,13 @@ S_regmatch(pTHX_ regnode *prog) if (PL_regcc) ln = PL_regcc->cur; if (regmatch(cc->next)) - CACHEsayYES; + sayYES; if (PL_regcc) PL_regcc->cur = ln; PL_regcc = cc; cc->cur = n - 1; cc->lastloc = lastloc; - CACHEsayNO; + sayNO; } /* NOT REACHED */ case BRANCHJ: @@ -4213,6 +4168,7 @@ S_regmatch(pTHX_ regnode *prog) } else PL_reginput = locinput; + PL_reg_flags ^= RF_false; goto do_ifmatch; case IFMATCH: n = 1; @@ -4228,6 +4184,8 @@ S_regmatch(pTHX_ regnode *prog) do_ifmatch: inner = NEXTOPER(NEXTOPER(scan)); if (regmatch(inner) != n) { + if (n == 0) + PL_reg_flags ^= RF_false; say_no: if (logical) { logical = 0; @@ -4237,6 +4195,8 @@ S_regmatch(pTHX_ regnode *prog) else sayNO; } + if (n == 0) + PL_reg_flags ^= RF_false; say_yes: if (logical) { logical = 0; diff --git a/t/op/re_tests b/t/op/re_tests index 28deb0f..b7fbf2d 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -956,5 +956,3 @@ x(?# x c - Sequence (?#... not terminated (a|aa|aaa|aaaa|aaaaa|aaaaaa)(b|c) aaaaaaaaaaaaaaab y $1$2 aaaaaab (a|aa|aaa|aaaa|aaaaa|aaaaaa)(??{$1&&""})(b|c) aaaaaaaaaaaaaaab y $1$2 aaaaaab (a|aa|aaa|aaaa|aaaaa|aaaaaa)(??{$1&&"foo"})(b|c) aaaaaaaaaaaaaaab n - - -^(a*?)(?!(aa|aaaa)*$) aaaaaaaaaaaaaaaaaaaa y $1 a # [perl #34195] -^(a*?)(?!(aa|aaaa)*$)(?=a\z) aaaaaaaa y $1 aaaaaaa