mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
dc: cleanup, fix off-by-one memory error
This commit is contained in:
parent
56e6f8f994
commit
272c1fb2d9
1 changed files with 1 additions and 15 deletions
16
src/cmd/dc.c
16
src/cmd/dc.c
|
@ -165,7 +165,6 @@ void release(Blk *p);
|
|||
Blk* dcgetwd(Blk *p);
|
||||
void putwd(Blk *p, Blk *c);
|
||||
Blk* lookwd(Blk *p);
|
||||
char* nalloc(char *p, unsigned nbytes);
|
||||
int getstk(void);
|
||||
|
||||
/********debug only**/
|
||||
|
@ -1222,7 +1221,7 @@ init(int argc, char *argv[])
|
|||
readptr = &readstk[0];
|
||||
k=0;
|
||||
sp = sptr = &symlst[0];
|
||||
while(sptr < &symlst[TBLSZ]) {
|
||||
while(sptr < &symlst[TBLSZ-1]) {
|
||||
sptr->next = ++sp;
|
||||
sptr++;
|
||||
}
|
||||
|
@ -2268,19 +2267,6 @@ lookwd(Blk *p)
|
|||
return(*wp->rdw);
|
||||
}
|
||||
|
||||
char*
|
||||
nalloc(char *p, unsigned nbytes)
|
||||
{
|
||||
char *q, *r;
|
||||
|
||||
q = r = malloc(nbytes);
|
||||
if(q==0)
|
||||
return(0);
|
||||
while(nbytes--)
|
||||
*q++ = *p++;
|
||||
return(r);
|
||||
}
|
||||
|
||||
int
|
||||
getstk(void)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue