aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dc.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-12-06 16:45:40 -0800
committerRuss Cox <rsc@swtch.com>2008-12-06 16:45:40 -0800
commit272c1fb2d928168074798cf2a467591121273478 (patch)
tree69d38d60232dc1532fbd63bfd0aa855d0b4d3dda /src/cmd/dc.c
parent56e6f8f9946a5d59192d443625832671f9154ea8 (diff)
downloadplan9port-272c1fb2d928168074798cf2a467591121273478.tar.gz
plan9port-272c1fb2d928168074798cf2a467591121273478.tar.bz2
plan9port-272c1fb2d928168074798cf2a467591121273478.zip
dc: cleanup, fix off-by-one memory error
Diffstat (limited to 'src/cmd/dc.c')
-rw-r--r--src/cmd/dc.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/cmd/dc.c b/src/cmd/dc.c
index fa7f09bc..bc69ca50 100644
--- a/src/cmd/dc.c
+++ b/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)
{