diff options
author | Karl Williamson <public@khwilliamson.com> | 2010-09-29 22:43:32 -0600 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-09-30 06:31:39 -0700 |
commit | 5d51ce98fae3de078d69723f2d6256ab12ad8548 (patch) | |
tree | 0e24aa35650a08ef1ea12f8554204ab5571c0bed /regcomp.c | |
parent | b2e549c0b5ccc745d727de4e27634e8090b0f719 (diff) | |
download | perl-5d51ce98fae3de078d69723f2d6256ab12ad8548.tar.gz |
[perl #77952] regcomp.c compiler warnings
These were that longjmp calls could clobber certain variables.
Initializing the variables after the place that longjmp returns to
causes the warnings to disappear.
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 35 |
1 files changed, 22 insertions, 13 deletions
@@ -4273,8 +4273,8 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 pm_flags) struct regexp *r; register regexp_internal *ri; STRLEN plen; - char *exp = SvPV(pattern, plen); - char* xend = exp + plen; + char *exp; + char* xend; regnode *scan; I32 flags; I32 minlen = 0; @@ -4286,7 +4286,7 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 pm_flags) RExC_state_t RExC_state; RExC_state_t * const pRExC_state = &RExC_state; #ifdef TRIE_STUDY_OPT - int restudied= 0; + int restudied; RExC_state_t copyRExC_state; #endif GET_RE_DEBUG_FLAGS_DECL; @@ -4297,24 +4297,29 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 pm_flags) RExC_utf8 = RExC_orig_utf8 = SvUTF8(pattern); - DEBUG_COMPILE_r({ - SV *dsv= sv_newmortal(); - RE_PV_QUOTED_DECL(s, RExC_utf8, - dsv, exp, plen, 60); - PerlIO_printf(Perl_debug_log, "%sCompiling REx%s %s\n", - PL_colors[4],PL_colors[5],s); - }); /* Longjmp back to here if have to switch in midstream to utf8 */ if (! RExC_orig_utf8) { JMPENV_PUSH(jump_ret); } - if (jump_ret != 0) { + if (jump_ret == 0) { /* First time through */ + exp = SvPV(pattern, plen); + xend = exp + plen; + + DEBUG_COMPILE_r({ + SV *dsv= sv_newmortal(); + RE_PV_QUOTED_DECL(s, RExC_utf8, + dsv, exp, plen, 60); + PerlIO_printf(Perl_debug_log, "%sCompiling REx%s %s\n", + PL_colors[4],PL_colors[5],s); + }); + } + else { /* longjumped back */ STRLEN len = plen; - /* Here, we longjmped back. If the cause was other than changing to - * utf8, pop our own setjmp, and longjmp to the correct handler */ + /* If the cause for the longjmp was other than changing to utf8, pop + * our own setjmp, and longjmp to the correct handler */ if (jump_ret != UTF8_LONGJMP) { JMPENV_POP; JMPENV_JUMP(jump_ret); @@ -4338,6 +4343,10 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 pm_flags) SAVEFREEPV(exp); } +#ifdef TRIE_STUDY_OPT + restudied = 0; +#endif + RExC_precomp = exp; RExC_flags = pm_flags; RExC_sawback = 0; |