use malloc instead of sbrk
This commit is contained in:
parent
6d85667761
commit
16c73e6654
4 changed files with 7 additions and 7 deletions
|
@ -114,7 +114,7 @@ extern FILE *fftemp();
|
||||||
/* some library functions used */
|
/* some library functions used */
|
||||||
extern long atol();
|
extern long atol();
|
||||||
extern char *mktemp();
|
extern char *mktemp();
|
||||||
extern char *sbrk();
|
extern char *malloc();
|
||||||
extern char *getenv();
|
extern char *getenv();
|
||||||
|
|
||||||
/* ========== Machine dependent C declarations ========== */
|
/* ========== Machine dependent C declarations ========== */
|
||||||
|
|
|
@ -474,8 +474,8 @@ item_alloc(typ)
|
||||||
static item_t *next;
|
static item_t *next;
|
||||||
|
|
||||||
if (--nleft < 0) {
|
if (--nleft < 0) {
|
||||||
next = (item_t *) sbrk(MEMINCR);
|
next = (item_t *) malloc(MEMINCR);
|
||||||
if ((int) next == -1)
|
if (next == 0)
|
||||||
fatal("out of memory");
|
fatal("out of memory");
|
||||||
nleft += (MEMINCR / sizeof(item_t));
|
nleft += (MEMINCR / sizeof(item_t));
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,8 +398,8 @@ new_common(ip)
|
||||||
static struct common_t *next;
|
static struct common_t *next;
|
||||||
|
|
||||||
if (--nleft < 0) {
|
if (--nleft < 0) {
|
||||||
next = (struct common_t *) sbrk(MEMINCR);
|
next = (struct common_t *) malloc(MEMINCR);
|
||||||
if ((int) next == -1) {
|
if (next == 0) {
|
||||||
fatal("out of memory");
|
fatal("out of memory");
|
||||||
}
|
}
|
||||||
nleft += (MEMINCR / sizeof (struct common_t));
|
nleft += (MEMINCR / sizeof (struct common_t));
|
||||||
|
|
|
@ -70,8 +70,8 @@ register char *s;
|
||||||
n++;
|
n++;
|
||||||
while (*p++);
|
while (*p++);
|
||||||
if ((nleft -= n) < 0) {
|
if ((nleft -= n) < 0) {
|
||||||
next = sbrk(MEMINCR);
|
next = malloc(MEMINCR);
|
||||||
if ((int) next == -1)
|
if (next == 0)
|
||||||
fatal("out of memory");
|
fatal("out of memory");
|
||||||
nleft = (MEMINCR / sizeof(char)) - n;
|
nleft = (MEMINCR / sizeof(char)) - n;
|
||||||
assert(nleft >= 0);
|
assert(nleft >= 0);
|
||||||
|
|
Loading…
Reference in a new issue