summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-12 16:39:02 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-12 16:39:02 +0100
commit9b38784150c0aca5746105b5f00bfc653322bcd1 (patch)
tree48457d0d7c2cf65438740ec90bf3382203837dba /malloc.c
parenta2a5de9516c1b256b060768ac6dad252a3aa3be7 (diff)
downloadperl-9b38784150c0aca5746105b5f00bfc653322bcd1.tar.gz
Add Perl_ck_warner_d(), which combines Perl_ckwarn_d() and Perl_warner().
Replace ckWARN_d{,2,3,4}() && Perl_warner() with it, which trades reduced code size for 1 more function call if warnings are not enabled.
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/malloc.c b/malloc.c
index 75818cd7b9..adfa23aec1 100644
--- a/malloc.c
+++ b/malloc.c
@@ -2056,10 +2056,10 @@ Perl_mfree(Malloc_t where)
#ifdef PERL_CORE
{
dTHX;
- if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC))
- Perl_warner(aTHX_ packWARN(WARN_MALLOC), "%s free() ignored (RMAGIC, PERL_CORE)",
- ovp->ov_rmagic == RMAGIC - 1 ?
- "Duplicate" : "Bad");
+ if (!PERL_IS_ALIVE || !PL_curcop)
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_MALLOC), "%s free() ignored (RMAGIC, PERL_CORE)",
+ ovp->ov_rmagic == RMAGIC - 1 ?
+ "Duplicate" : "Bad");
}
#else
warn("%s free() ignored (RMAGIC)",
@@ -2069,8 +2069,8 @@ Perl_mfree(Malloc_t where)
#ifdef PERL_CORE
{
dTHX;
- if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC))
- Perl_warner(aTHX_ packWARN(WARN_MALLOC), "%s", "Bad free() ignored (PERL_CORE)");
+ if (!PERL_IS_ALIVE || !PL_curcop)
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_MALLOC), "%s", "Bad free() ignored (PERL_CORE)");
}
#else
warn("%s", "Bad free() ignored");
@@ -2163,11 +2163,11 @@ Perl_realloc(void *mp, size_t nbytes)
#ifdef PERL_CORE
{
dTHX;
- if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC))
- Perl_warner(aTHX_ packWARN(WARN_MALLOC), "%srealloc() %signored",
- (ovp->ov_rmagic == RMAGIC - 1 ? "" : "Bad "),
- ovp->ov_rmagic == RMAGIC - 1
- ? "of freed memory " : "");
+ if (!PERL_IS_ALIVE || !PL_curcop)
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_MALLOC), "%srealloc() %signored",
+ (ovp->ov_rmagic == RMAGIC - 1 ? "" : "Bad "),
+ ovp->ov_rmagic == RMAGIC - 1
+ ? "of freed memory " : "");
}
#else
warn2("%srealloc() %signored",
@@ -2178,9 +2178,9 @@ Perl_realloc(void *mp, size_t nbytes)
#ifdef PERL_CORE
{
dTHX;
- if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC))
- Perl_warner(aTHX_ packWARN(WARN_MALLOC), "%s",
- "Bad realloc() ignored");
+ if (!PERL_IS_ALIVE || !PL_curcop)
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_MALLOC), "%s",
+ "Bad realloc() ignored");
}
#else
warn("%s", "Bad realloc() ignored");