This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
DEBUG_m() adjusted to internalize dTHX
authorGurusamy Sarathy <gsar@cpan.org>
Fri, 20 Aug 1999 22:09:56 +0000 (22:09 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Fri, 20 Aug 1999 22:09:56 +0000 (22:09 +0000)
p4raw-id: //depot/perl@4013

malloc.c
perl.h
util.c

index dc5a69f..a3344ae 100644 (file)
--- a/malloc.c
+++ b/malloc.c
 
 #ifdef DEBUGGING
 #  undef DEBUG_m
-#  define DEBUG_m(a)  if (PERL_GET_INTERP && PL_debug & 128)   a
+#  define DEBUG_m(a)  \
+    STMT_START {                                                       \
+       if (PERL_GET_INTERP) { dTHX; if (PL_debug & 128) { a; } }       \
+    } STMT_END
 #endif
 
 /*
@@ -902,9 +905,12 @@ Perl_malloc(register size_t nbytes)
        if ((p = nextf[bucket]) == NULL) {
                MALLOC_UNLOCK;
 #ifdef PERL_CORE
-               if (!PL_nomemok) {
-                   PerlIO_puts(PerlIO_stderr(),"Out of memory!\n");
-                   WITH_THX(my_exit(1));
+               {
+                   dTHX;
+                   if (!PL_nomemok) {
+                       PerlIO_puts(PerlIO_stderr(),"Out of memory!\n");
+                       my_exit(1);
+                   }
                }
 #else
                return (NULL);
diff --git a/perl.h b/perl.h
index 17de5c6..f2cf772 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1949,7 +1949,10 @@ Gid_t getegid (void);
 #  if defined(PERL_OBJECT)
 #    define DEBUG_m(a) if (PL_debug & 128)     a
 #  else
-#    define DEBUG_m(a) if (PERL_GET_INTERP && PL_debug & 128)  a
+#    define DEBUG_m(a)  \
+    STMT_START {                                                       \
+       if (PERL_GET_INTERP) { dTHX; if (PL_debug & 128) { a; } }       \
+    } STMT_END
 #  endif
 #define DEBUG_f(a) if (PL_debug & 256) a
 #define DEBUG_r(a) if (PL_debug & 512) a
diff --git a/util.c b/util.c
index afec79e..51d7575 100644 (file)
--- a/util.c
+++ b/util.c
@@ -139,10 +139,8 @@ Perl_safesysrealloc(Malloc_t where,MEM_SIZE size)
 #endif
     ptr = PerlMem_realloc(where,size);
 
-    DEBUG_m( {
-       PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) rfree\n",where,PL_an++);
-       PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) realloc %ld bytes\n",ptr,PL_an++,(long)size);
-    } )
+    DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) rfree\n",where,PL_an++));
+    DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) realloc %ld bytes\n",ptr,PL_an++,(long)size));
 
     if (ptr != Nullch)
        return ptr;