Skip to content

Commit

Permalink
simplify growproc
Browse files Browse the repository at this point in the history
  • Loading branch information
rtm committed Aug 28, 2008
1 parent 98754d6 commit ee3f75f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ee3f75f

Please sign in to comment.