handle very long symbol names. via cinap. Reference: /n/atom/patch/applied2013/acidlongsym Date: Thu Oct 3 17:12:34 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/cmd/acid/util.c Thu Oct 3 17:11:46 2013 +++ /sys/src/cmd/acid/util.c Thu Oct 3 17:11:46 2013 @@ -9,14 +9,19 @@ static int syren; +enum { + Renames = 5, +}; + Lsym* -unique(char *buf, Sym *s) +unique(char *buf, int bufsz, Sym *s) { Lsym *l; int i, renamed; renamed = 0; - strcpy(buf, s->name); + strncpy(buf, s->name, bufsz - Renames - 1); + buf[bufsz - Renames - 1] = 0; for(;;) { l = look(buf); if(l == 0 || (l->lexval == Tid && l->v->set == 0)) @@ -30,7 +35,7 @@ memmove(buf+1, buf, i); buf[0] = '$'; renamed++; - if(renamed > 5 && !quiet) { + if(renamed > Renames && !quiet) { print("Too many renames; must be X source!\n"); break; } @@ -76,7 +81,7 @@ *tail = tl; tail = &tl->next; - l = unique(buf, s); + l = unique(buf, sizeof buf, s); l->v->set = 1; l->v->type = TINT;