summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorDominic Dunlop <domo@computer.org>2000-11-07 13:05:25 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2000-11-08 18:30:26 +0000
commitfebabd2afca32f4056ed041373de98438ab121ff (patch)
tree5e9ec2d1e723fba95a2df4118b126d434bb708bd /malloc.c
parent06b2af23355fc42815af71c20b189a3727d5c00e (diff)
downloadperl-febabd2afca32f4056ed041373de98438ab121ff.tar.gz
Re: Patch 7533 prevents malloc.c from compiling on MachTen
Message-Id: <p04320403b62d8e0870cf@[192.168.1.4]> p4raw-id: //depot/perl@7611
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/malloc.c b/malloc.c
index 55da67c1bd..eee4da6684 100644
--- a/malloc.c
+++ b/malloc.c
@@ -860,11 +860,7 @@ static void* get_from_bigger_buckets(int bucket, MEM_SIZE size);
static union overhead *getpages (MEM_SIZE needed, int *nblksp, int bucket);
static int getpages_adjacent(MEM_SIZE require);
-#if defined(PERL_EMERGENCY_SBRK) && defined(PERL_CORE)
-
-# ifndef BIG_SIZE
-# define BIG_SIZE (1<<16) /* 64K */
-# endif
+#ifdef PERL_CORE
#ifdef I_MACH_CTHREADS
# undef MUTEX_LOCK
@@ -916,6 +912,12 @@ static u_int start_slack;
static u_int goodsbrk;
+# ifdef PERL_EMERGENCY_SBRK
+
+# ifndef BIG_SIZE
+# define BIG_SIZE (1<<16) /* 64K */
+# endif
+
static char *emergency_buffer;
static MEM_SIZE emergency_buffer_size;
static int no_mem; /* 0 if the last request for more memory succeeded.
@@ -983,9 +985,10 @@ emergency_sbrk(MEM_SIZE size)
return Nullch;
}
-#else /* !(defined(PERL_EMERGENCY_SBRK) && defined(PERL_CORE)) */
+# else /* !defined(PERL_EMERGENCY_SBRK) */
# define emergency_sbrk(size) -1
-#endif /* !(defined(PERL_EMERGENCY_SBRK) && defined(PERL_CORE)) */
+# endif
+#endif /* ifdef PERL_CORE */
#ifdef DEBUGGING
#undef ASSERT
@@ -1062,6 +1065,9 @@ Perl_malloc(register size_t nbytes)
{
dTHX;
if (!PL_nomemok) {
+#if defined(PLAIN_MALLOC) && defined(NO_FANCY_MALLOC)
+ PerlIO_puts(PerlIO_stderr(),"Out of memory!\n");
+#else
char buff[80];
char *eb = buff + sizeof(buff) - 1;
char *s = eb;
@@ -1084,6 +1090,7 @@ Perl_malloc(register size_t nbytes)
} while (n /= 10);
PerlIO_puts(PerlIO_stderr(),s);
PerlIO_puts(PerlIO_stderr()," bytes!\n");
+#endif /* defined(PLAIN_MALLOC) && defined(NO_FANCY_MALLOC) */
my_exit(1);
}
}
@@ -1391,7 +1398,9 @@ getpages(MEM_SIZE needed, int *nblksp, int bucket)
sbrked_remains = require - needed;
last_op = cp;
}
+#if !defined(PLAIN_MALLOC) && !defined(NO_FANCY_MALLOC)
no_mem = 0;
+#endif
last_sbrk_top = cp + require;
#ifdef DEBUGGING_MSTATS
goodsbrk += require;