Re: [PATCH] fix re debug segvs in global destruction, and a tweak to Benchmark to...
Yves Orton [Wed, 14 Jun 2006 14:33:24 +0000 (16:33 +0200)]
Message-ID: <9b18b3110606140533k583fdd3bh6c4b292e7ff4cf13@mail.gmail.com>

p4raw-id: //depot/perl@28394

regcomp.c
regcomp.h

index c1b4dc7..4514c19 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -3660,6 +3660,18 @@ reStudy:
         PerlIO_printf(Perl_debug_log,"Final program:\n");
         regdump(r);
     });
+    DEBUG_OFFSETS_r(if (r->offsets) {
+        const U32 len = r->offsets[0];
+        U32 i;
+        GET_RE_DEBUG_FLAGS_DECL;
+        PerlIO_printf(Perl_debug_log, "Offsets: [%"UVuf"]\n\t", (UV)r->offsets[0]);
+        for (i = 1; i <= len; i++) {
+            if (r->offsets[i*2-1] || r->offsets[i*2])
+                PerlIO_printf(Perl_debug_log, "%"UVuf":%"UVuf"[%"UVuf"] ",
+                i, (UV)r->offsets[i*2-1], (UV)r->offsets[i*2]);
+            }
+        PerlIO_printf(Perl_debug_log, "\n");
+    });
     return(r);
 }
 
@@ -6359,20 +6371,6 @@ Perl_regdump(pTHX_ const regexp *r)
     if (r->reganch & ROPT_EVAL_SEEN)
        PerlIO_printf(Perl_debug_log, "with eval ");
     PerlIO_printf(Perl_debug_log, "\n");
-    if (r->offsets) {
-        const U32 len = r->offsets[0];
-        GET_RE_DEBUG_FLAGS_DECL;
-        DEBUG_OFFSETS_r({
-           U32 i;
-           PerlIO_printf(Perl_debug_log, "Offsets: [%"UVuf"]\n\t", (UV)r->offsets[0]);
-           for (i = 1; i <= len; i++) {
-               if (r->offsets[i*2-1] || r->offsets[i*2])
-                   PerlIO_printf(Perl_debug_log, "%"UVuf":%"UVuf"[%"UVuf"] ",
-                       i, (UV)r->offsets[i*2-1], (UV)r->offsets[i*2]);
-            }
-           PerlIO_printf(Perl_debug_log, "\n");
-        });
-    }
 #else
     PERL_UNUSED_CONTEXT;
     PERL_UNUSED_ARG(r);
index 84a0e50..c81c286 100644 (file)
--- a/regcomp.h
+++ b/regcomp.h
@@ -616,14 +616,14 @@ re.pm, especially to the documentation.
         SV * re_debug_flags_sv = NULL; \
         re_debug_flags_sv = get_sv(RE_DEBUG_FLAGS, 1); \
         if (re_debug_flags_sv) { \
-            if (!SvUOK(re_debug_flags_sv)) \
+            if (!SvIOK(re_debug_flags_sv)) \
                 sv_setuv(re_debug_flags_sv, RE_DEBUG_COMPILE_DUMP | RE_DEBUG_EXECUTE_MASK ); \
-            re_debug_flags=SvUV(re_debug_flags_sv); \
+            re_debug_flags=SvIV(re_debug_flags_sv); \
         }\
 })
 
 #ifdef DEBUGGING
-#define GET_RE_DEBUG_FLAGS_DECL UV re_debug_flags = 0; GET_RE_DEBUG_FLAGS;
+#define GET_RE_DEBUG_FLAGS_DECL IV re_debug_flags = 0; GET_RE_DEBUG_FLAGS;
 #else
 #define GET_RE_DEBUG_FLAGS_DECL
 #endif