simplify growproc

This commit is contained in:
rtm 2008-08-28 17:57:47 +00:00
parent 98754d687e
commit ee3f75f229

5
proc.c
View file

@ -49,16 +49,15 @@ allocproc(void)
int
growproc(int n)
{
char *newmem, *oldmem;
char *newmem;
newmem = kalloc(cp->sz + n);
if(newmem == 0)
return -1;
memmove(newmem, cp->mem, cp->sz);
memset(newmem + cp->sz, 0, n);
oldmem = cp->mem;
kfree(cp->mem, cp->sz);
cp->mem = newmem;
kfree(oldmem, cp->sz);
cp->sz += n;
setupsegs(cp);
return cp->sz - n;