Make regex DEBUGGING faster.
authorJarkko Hietaniemi <jhi@iki.fi>
Mon, 18 Mar 2002 14:39:15 +0000 (14:39 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Mon, 18 Mar 2002 14:39:15 +0000 (14:39 +0000)
p4raw-id: //depot/perl@15297

perl.c
perl.h
regexec.c

diff --git a/perl.c b/perl.c
index 13df3e4..ebf5ca1 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -258,6 +258,11 @@ perl_construct(pTHXx)
     PL_fdpid = newAV();                        /* for remembering popen pids by fd */
     PL_modglobal = newHV();            /* pointers to per-interpreter module globals */
     PL_errors = newSVpvn("",0);
+#ifdef DEBUGGING
+    sv_setpvn(PERL_DEBUG_PAD(0), "", 0);       /* For regex debugging. */
+    sv_setpvn(PERL_DEBUG_PAD(1), "", 0);
+    sv_setpvn(PERL_DEBUG_PAD(2), "", 0);
+#endif
 #ifdef USE_ITHREADS
     PL_regex_padav = newAV();
     av_push(PL_regex_padav,(SV*)newAV());    /* First entry is an array of empty elements */
diff --git a/perl.h b/perl.h
index f7bf179..02e3f9c 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -3183,7 +3183,7 @@ struct perl_debug_pad {
 };
 
 #define PERL_DEBUG_PAD(i)      &(PL_debug_pad.pad[i])
-#define PERL_DEBUG_PAD_ZERO(i) (sv_setpvn(PERL_DEBUG_PAD(i), "", 0), PERL_DEBUG_PAD(i))
+#define PERL_DEBUG_PAD_ZERO(i) (SvPVX(PERL_DEBUG_PAD(i))[0] = 0, SvCUR(PERL_DEBUG_PAD(i)) = 0, PERL_DEBUG_PAD(i))
 
 /* Enable variables which are pointers to functions */
 typedef void (CPERLscope(*peep_t))(pTHX_ OP* o);
index 9264b86..00bd6ef 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -2054,12 +2054,6 @@ S_regtry(pTHX_ regexp *prog, char *startpos)
             New(22,PL_reg_start_tmp, PL_reg_start_tmpl, char*);
     }
 
-#ifdef DEBUGGING
-    sv_setpvn(PERL_DEBUG_PAD(0), "", 0);
-    sv_setpvn(PERL_DEBUG_PAD(1), "", 0);
-    sv_setpvn(PERL_DEBUG_PAD(2), "", 0);
-#endif
-
     /* XXXX What this code is doing here?!!!  There should be no need
        to do this again and again, PL_reglastparen should take care of
        this!  --ilya*/