summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-21 00:01:17 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-21 00:01:17 +0000
commite8cd8248d84d5cafd97f60fca2effc40c0cbafdc (patch)
treef55ebfa97313d2e97aabf10033179185fae78b8c /malloc.c
parent8d93267c4ab5375527e9b0ff9ead9f620d361791 (diff)
downloadperl-e8cd8248d84d5cafd97f60fca2effc40c0cbafdc.tar.gz
malloc.c fixups in change#5170 need to fetch thx pointer
p4raw-link: @5170 on //depot/perl: e476b1b5c29f354cf8dad61a9fc6d855bdfb5b7d p4raw-id: //depot/perl@5173
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/malloc.c b/malloc.c
index ecebeb030e..9864eac665 100644
--- a/malloc.c
+++ b/malloc.c
@@ -958,7 +958,7 @@ static u_int goodsbrk;
static void
botch(char *diag, char *s)
{
- dTHXo;
+ dTHX;
PerlIO_printf(PerlIO_stderr(), "assertion botched (%s?): %s\n", diag, s);
PerlProc_abort();
}
@@ -1043,13 +1043,13 @@ Perl_malloc(register size_t nbytes)
/* remove from linked list */
#if defined(RCHECK)
if ((PTR2UV(p)) & (MEM_ALIGNBYTES - 1)) {
- dTHXo;
+ dTHX;
PerlIO_printf(PerlIO_stderr(),
"Unaligned pointer in the free chain 0x%"UVxf"\n",
PTR2UV(p));
}
if ((PTR2UV(p->ov_next)) & (MEM_ALIGNBYTES - 1)) {
- dTHXo;
+ dTHX;
PerlIO_printf(PerlIO_stderr(),
"Unaligned `next' pointer in the free "
"chain 0x"UVxf" at 0x%"UVxf"\n",
@@ -1513,7 +1513,7 @@ Perl_mfree(void *mp)
{
static int bad_free_warn = -1;
if (bad_free_warn == -1) {
- dTHXo;
+ dTHX;
char *pbf = PerlEnv_getenv("PERL_BADFREE");
bad_free_warn = (pbf) ? atoi(pbf) : 1;
}
@@ -1521,9 +1521,13 @@ Perl_mfree(void *mp)
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");
+ {
+ dTHX;
+ 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");
@@ -1606,7 +1610,7 @@ Perl_realloc(void *mp, size_t nbytes)
{
static int bad_free_warn = -1;
if (bad_free_warn == -1) {
- dTHXo;
+ dTHX;
char *pbf = PerlEnv_getenv("PERL_BADFREE");
bad_free_warn = (pbf) ? atoi(pbf) : 1;
}
@@ -1614,10 +1618,14 @@ Perl_realloc(void *mp, size_t nbytes)
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 " : "");
+ {
+ dTHX;
+ 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 "),