home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
minnie.tuhs.org
/
unixen.tar
/
unixen
/
PDP-11
/
Distributions
/
ucb
/
spencer_2bsd.tar.gz
/
2bsd.tar
/
src
/
px
/
palloc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1980-02-17
|
627b
|
45 lines
/* (c) 1979 Regents of the University of California */
#include "0x.h"
#include "E.h"
extern char *sbrk(), *brk();
alloc(need)
char *need;
{
register cnt, *wp;
register char *have;
need = (need+1) &~ 1;
if ((have=high-memptr) < need) {
if (sbrk(need > have + 1024 ? need-have:1024) == -1)
error(EOUTOFMEM);
high = sbrk(0);
}
wp = memptr;
cnt = (need >> 1) & 077777;
do {
*wp++ = 0;
} while (--cnt);
wp = memptr;
memptr =+ need;
stklim();
return(wp);
}
setmem()
{
high = bottmem = memptr = sbrk(0);
stklim();
}
free(cptr)
char *cptr;
{
}
stklim()
{
maxstk = ((memptr + 07777) &~ 07777) + 512;
}