This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Don't use general macro
authorKarl Williamson <khw@cpan.org>
Mon, 5 Jan 2015 22:30:42 +0000 (15:30 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 6 Jan 2015 22:05:26 +0000 (15:05 -0700)
The macro REGC is used to hide PASS1 behavior versus PASS2 behavior from
the caller.  But this is the last use of REGC, and it's only executed in
PASS2, so it doesn't need the generality (and obscurity) that REGC
provides.

regcomp.c

index 56e1a25..c42c256 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -6865,7 +6865,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
     RExC_emit_bound = ri->program + RExC_size + 1;
     pRExC_state->code_index = 0;
 
-    REGC((U8)REG_MAGIC, (char*) RExC_emit++);
+    *((char*) RExC_emit++) = (char) REG_MAGIC;
     if (reg(pRExC_state, 0, &flags,1) == NULL) {
        ReREFCNT_dec(rx);
         Perl_croak(aTHX_ "panic: reg returned NULL to re_op_compile for generation pass, flags=%#"UVxf"", (UV) flags);