use malloc instead of sbrk

This commit is contained in:
ceriel 1987-08-06 13:04:20 +00:00
parent 6d85667761
commit 16c73e6654
4 changed files with 7 additions and 7 deletions

View file

@ -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 ========== */

View file

@ -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));
}

View file

@ -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));

View file

@ -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);