diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-20 22:58:09 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-20 22:58:09 +0000 |
commit | e476b1b5c29f354cf8dad61a9fc6d855bdfb5b7d (patch) | |
tree | 15dd81e8f41d5ccfb48b2e0d3b564ee0d7cf6458 /malloc.c | |
parent | 635bbe87639b3a9ff9c900336f8f6c30e3d557b9 (diff) | |
download | perl-e476b1b5c29f354cf8dad61a9fc6d855bdfb5b7d.tar.gz |
lexical warnings update, ability to inspect bitmask in calling
scope, among other things (from Paul Marquess)
p4raw-id: //depot/perl@5170
Diffstat (limited to 'malloc.c')
-rw-r--r-- | malloc.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -332,6 +332,13 @@ } STMT_END #endif +#ifdef PERL_IMPLICIT_CONTEXT +# define PERL_IS_ALIVE aTHX +#else +# define PERL_IS_ALIVE TRUE +#endif + + /* * Layout of memory: * ~~~~~~~~~~~~~~~~ @@ -1513,11 +1520,22 @@ Perl_mfree(void *mp) if (!bad_free_warn) return; #ifdef RCHECK +#ifdef PERL_CORE + if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC)) + Perl_warner(WARN_MALLOC, "%s free() ignored", + ovp->ov_rmagic == RMAGIC - 1 ? "Duplicate" : "Bad"); +#else warn("%s free() ignored", ovp->ov_rmagic == RMAGIC - 1 ? "Duplicate" : "Bad"); +#endif +#else +#ifdef PERL_CORE + if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC)) + Perl_warner(WARN_MALLOC, "%s", "Bad free() ignored"); #else warn("%s", "Bad free() ignored"); #endif +#endif return; /* sanity */ } #ifdef RCHECK @@ -1595,12 +1613,24 @@ Perl_realloc(void *mp, size_t nbytes) if (!bad_free_warn) return Nullch; #ifdef RCHECK +#ifdef PERL_CORE + if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC)) + Perl_warner(WARN_MALLOC, "%srealloc() %signored", + (ovp->ov_rmagic == RMAGIC - 1 ? "" : "Bad "), + ovp->ov_rmagic == RMAGIC - 1 ? "of freed memory " : ""); +#else warn("%srealloc() %signored", (ovp->ov_rmagic == RMAGIC - 1 ? "" : "Bad "), ovp->ov_rmagic == RMAGIC - 1 ? "of freed memory " : ""); +#endif +#else +#ifdef PERL_CORE + if (!PERL_IS_ALIVE || !PL_curcop || ckWARN_d(WARN_MALLOC)) + Perl_warner(WARN_MALLOC, "%s", "Bad realloc() ignored"); #else warn("%s", "Bad realloc() ignored"); #endif +#endif return Nullch; /* sanity */ } |