From: srezic@cpan.org Date: Sat, 27 Oct 2007 11:33:57 +0000 (-0700) Subject: [perl #46957] [PATCH] make Devel::Peek::mstat always available X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3128eefee559edb9fdd97ad1b3eff48da114045e;p=p5sagit%2Fp5-mst-13.2.git [perl #46957] [PATCH] make Devel::Peek::mstat always available From: srezic@cpan.org (via RT) Message-ID: p4raw-id: //depot/perl@33414 --- diff --git a/ext/Devel/Peek/Peek.xs b/ext/Devel/Peek/Peek.xs index cf47c3c..0351cc2 100644 --- a/ext/Devel/Peek/Peek.xs +++ b/ext/Devel/Peek/Peek.xs @@ -127,16 +127,14 @@ DeadCode(pTHX) #endif /* !PURIFY */ } -#if (defined(PERL_DEBUGGING_MSTATS) || defined(DEBUGGING_MSTATS)) \ - && (defined(MYMALLOC) && !defined(PLAIN_MALLOC)) +#if defined(MYMALLOC) # define mstat(str) dump_mstats(str) #else # define mstat(str) \ - PerlIO_printf(Perl_debug_log, "%s: perl not compiled with DEBUGGING_MSTATS\n",str); + PerlIO_printf(Perl_debug_log, "%s: perl not compiled with MYMALLOC\n",str); #endif -#if (defined(PERL_DEBUGGING_MSTATS) || defined(DEBUGGING_MSTATS)) \ - && (defined(MYMALLOC) && !defined(PLAIN_MALLOC)) +#if defined(MYMALLOC) /* Very coarse overestimate, 2-per-power-of-2, one more to determine NBUCKETS. */ # define _NBUCKETS (2*8*IVSIZE+1) @@ -293,7 +291,7 @@ mstats2hash(SV *sv, SV *rv, int level) croak("Wrong size for a value with a mstats buffer"); _mstats_to_hv((HV *)SvRV(rv), (struct mstats_buffer*)SvPVX(sv), level); } -#else /* !( defined(PERL_DEBUGGING_MSTATS) || defined(DEBUGGING_MSTATS) \ ) */ +#else /* defined(MYMALLOC) */ static void fill_mstats(SV *sv, int level) { @@ -311,7 +309,7 @@ mstats2hash(SV *sv, SV *rv, int level) { croak("Cannot report mstats without Perl malloc"); } -#endif /* defined(PERL_DEBUGGING_MSTATS) || defined(DEBUGGING_MSTATS)... */ +#endif /* defined(MYMALLOC) */ #define _CvGV(cv) \ (SvROK(cv) && (SvTYPE(SvRV(cv))==SVt_PVCV) \ diff --git a/malloc.c b/malloc.c index 682eeb6..a8d4554 100644 --- a/malloc.c +++ b/malloc.c @@ -2450,6 +2450,8 @@ Perl_get_mstats(pTHX_ perl_mstats_t *buf, int buflen, int level) buf->bucket_available_size[i] = BUCKET_SIZE_REAL(i); } } +#else /* defined DEBUGGING_MSTATS */ + PerlIO_printf(Perl_error_log, "perl not compiled with DEBUGGING_MSTATS\n"); #endif /* defined DEBUGGING_MSTATS */ return 0; /* XXX unused */ } @@ -2523,6 +2525,8 @@ Perl_dump_mstats(pTHX_ char *s) buffer.total_sbrk, buffer.sbrks, buffer.sbrk_good, buffer.sbrk_slack, buffer.start_slack, buffer.total_chain, buffer.sbrked_remains); +#else /* DEBUGGING_MSTATS */ + PerlIO_printf(Perl_error_log, "%s: perl not compiled with DEBUGGING_MSTATS\n",s); #endif /* DEBUGGING_MSTATS */ }