From: Gurusamy Sarathy Date: Fri, 20 Aug 1999 22:09:56 +0000 (+0000) Subject: DEBUG_m() adjusted to internalize dTHX X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0b250b9ef0d5134fdb23236140643970d9a3fbf5;p=p5sagit%2Fp5-mst-13.2.git DEBUG_m() adjusted to internalize dTHX p4raw-id: //depot/perl@4013 --- diff --git a/malloc.c b/malloc.c index dc5a69f..a3344ae 100644 --- a/malloc.c +++ b/malloc.c @@ -311,7 +311,10 @@ #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 --- 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 --- 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;