summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-06-16 09:56:59 +0100
committerNicholas Clark <nick@ccl4.org>2010-06-16 09:56:59 +0100
commit1f4d2d4e2e4bb7bbbd526ea0b9d5592742433f9a (patch)
treeef90621ea56c610b9119d6721f35dc179bfdc3af /util.c
parent0cb20dae370512c655eb665a7d5089db2819e862 (diff)
downloadperl-1f4d2d4e2e4bb7bbbd526ea0b9d5592742433f9a.tar.gz
PERL_IMPLICIT_SYS also needs thread context for the *alloc success paths.
0cb20dae370512c6 was a bit to aggressive in its deferral of dTHX.
Diffstat (limited to 'util.c')
-rw-r--r--util.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/util.c b/util.c
index 15dd162590..237d121cc3 100644
--- a/util.c
+++ b/util.c
@@ -70,12 +70,16 @@ S_write_no_mem(pTHX)
NORETURN_FUNCTION_END;
}
+#if defined (DEBUGGING) || defined(PERL_IMPLICIT_SYS)
+# define ALWAYS_NEED_THX
+#endif
+
/* paranoid version of system's malloc() */
Malloc_t
Perl_safesysmalloc(MEM_SIZE size)
{
-#ifdef DEBUGGING
+#ifdef ALWAYS_NEED_THX
dTHX;
#endif
Malloc_t ptr;
@@ -121,7 +125,7 @@ Perl_safesysmalloc(MEM_SIZE size)
return ptr;
}
else {
-#ifndef DEBUGGING
+#ifndef ALWAYS_NEED_THX
dTHX;
#endif
if (PL_nomemok)
@@ -138,7 +142,7 @@ Perl_safesysmalloc(MEM_SIZE size)
Malloc_t
Perl_safesysrealloc(Malloc_t where,MEM_SIZE size)
{
-#ifdef DEBUGGING
+#ifdef ALWAYS_NEED_THX
dTHX;
#endif
Malloc_t ptr;
@@ -223,7 +227,7 @@ Perl_safesysrealloc(Malloc_t where,MEM_SIZE size)
return ptr;
}
else {
-#ifndef DEBUGGING
+#ifndef ALWAYS_NEED_THX
dTHX;
#endif
if (PL_nomemok)
@@ -282,7 +286,7 @@ Perl_safesysfree(Malloc_t where)
Malloc_t
Perl_safesyscalloc(MEM_SIZE count, MEM_SIZE size)
{
-#ifdef DEBUGGING
+#ifdef ALWAYS_NEED_THX
dTHX;
#endif
Malloc_t ptr;
@@ -347,7 +351,7 @@ Perl_safesyscalloc(MEM_SIZE count, MEM_SIZE size)
return ptr;
}
else {
-#ifndef DEBUGGING
+#ifndef ALWAYS_NEED_THX
dTHX;
#endif
if (PL_nomemok)