diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-04-19 20:44:19 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-04-19 20:44:19 +0200 |
commit | 3f87ffea44150d233b11a38b1ca3673207fe206e (patch) | |
tree | ab685bf0d354eea423a08e7798ae476df18a61c5 /sys/src/cmd/cc | |
parent | 3a79916c9be2d524b392c1a87a4685ceca603831 (diff) |
cc: get rid of sprint() and temporary buffer for type conversion fuction
slookup() copies to symb, so use the symb[NSYMB] buffer directly
to declare type conversion functions and get rid of the arbitrary
sized local buffer. replace sprint() with snprint().
Diffstat (limited to 'sys/src/cmd/cc')
-rw-r--r-- | sys/src/cmd/cc/funct.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/src/cmd/cc/funct.c b/sys/src/cmd/cc/funct.c index f794c6a62..b9ea5feb6 100644 --- a/sys/src/cmd/cc/funct.c +++ b/sys/src/cmd/cc/funct.c @@ -217,7 +217,6 @@ dclfunct(Type *t, Sym *s) Node *n; Type *f1, *f2, *f3, *f4; int o, i, c; - char str[100]; if(t->funct) return; @@ -262,9 +261,9 @@ dclfunct(Type *t, Sym *s) o = ftabinit[i].op; if(o == OXXX) break; - sprint(str, "%s_%s_", t->tag->name, ftabinit[i].name); + snprint(symb, NSYMB, "%s_%s_", t->tag->name, ftabinit[i].name); n = new(ONAME, Z, Z); - n->sym = slookup(str); + n->sym = lookup(); f->sym[o] = n->sym; switch(ftabinit[i].typ) { default: @@ -296,18 +295,18 @@ dclfunct(Type *t, Sym *s) /* * OCAST types T1 _T2_T1_(T2) */ - sprint(str, "_%s%s_", gtabinit[i].name, t->tag->name); + snprint(symb, NSYMB, "_%s%s_", gtabinit[i].name, t->tag->name); n = new(ONAME, Z, Z); - n->sym = slookup(str); + n->sym = lookup(); f->castto[o] = n->sym; f1 = typ(TFUNC, t); f1->down = types[o]; dodecl(xdecl, CEXTERN, f1, n); - sprint(str, "%s_%s_", t->tag->name, gtabinit[i].name); + snprint(symb, NSYMB, "%s_%s_", t->tag->name, gtabinit[i].name); n = new(ONAME, Z, Z); - n->sym = slookup(str); + n->sym = lookup(); f->castfr[o] = n->sym; f1 = typ(TFUNC, types[o]); |