From: ceriel Date: Thu, 6 Aug 1987 13:04:20 +0000 (+0000) Subject: use malloc instead of sbrk X-Git-Tag: release-5-5~3938 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=16c73e66544c0c7fcfaf5bbf4004d6988ed66ae7;p=ack.git use malloc instead of sbrk --- diff --git a/mach/proto/as/comm1.h b/mach/proto/as/comm1.h index 95d527d4b..fc4a7a9df 100644 --- a/mach/proto/as/comm1.h +++ b/mach/proto/as/comm1.h @@ -114,7 +114,7 @@ extern FILE *fftemp(); /* some library functions used */ extern long atol(); extern char *mktemp(); -extern char *sbrk(); +extern char *malloc(); extern char *getenv(); /* ========== Machine dependent C declarations ========== */ diff --git a/mach/proto/as/comm5.c b/mach/proto/as/comm5.c index 6a859feb3..d9bf59aa3 100644 --- a/mach/proto/as/comm5.c +++ b/mach/proto/as/comm5.c @@ -474,8 +474,8 @@ item_alloc(typ) static item_t *next; if (--nleft < 0) { - next = (item_t *) sbrk(MEMINCR); - if ((int) next == -1) + next = (item_t *) malloc(MEMINCR); + if (next == 0) fatal("out of memory"); nleft += (MEMINCR / sizeof(item_t)); } diff --git a/mach/proto/as/comm6.c b/mach/proto/as/comm6.c index bb1fe4499..46b6057cc 100644 --- a/mach/proto/as/comm6.c +++ b/mach/proto/as/comm6.c @@ -398,8 +398,8 @@ new_common(ip) static struct common_t *next; if (--nleft < 0) { - next = (struct common_t *) sbrk(MEMINCR); - if ((int) next == -1) { + next = (struct common_t *) malloc(MEMINCR); + if (next == 0) { fatal("out of memory"); } nleft += (MEMINCR / sizeof (struct common_t)); diff --git a/mach/proto/as/comm7.c b/mach/proto/as/comm7.c index f6e892de5..b4951f135 100644 --- a/mach/proto/as/comm7.c +++ b/mach/proto/as/comm7.c @@ -70,8 +70,8 @@ register char *s; n++; while (*p++); if ((nleft -= n) < 0) { - next = sbrk(MEMINCR); - if ((int) next == -1) + next = malloc(MEMINCR); + if (next == 0) fatal("out of memory"); nleft = (MEMINCR / sizeof(char)) - n; assert(nleft >= 0);