gc: avoid 0-length C array

R=golang-dev, ality
CC=golang-dev, rsc
https://golang.org/cl/5467066
This commit is contained in:
Lucio De Re 2011-12-12 16:25:31 -05:00 committed by Russ Cox
parent 2c2a582ae9
commit 0f4f3c6769

View file

@ -38,6 +38,7 @@ static struct {
int *val;
} exper[] = {
// {"rune32", &rune32},
{nil, nil},
};
static void
@ -45,7 +46,7 @@ addexp(char *s)
{
int i;
for(i=0; i<nelem(exper); i++) {
for(i=0; exper[i].name != nil; i++) {
if(strcmp(exper[i].name, s) == 0) {
*exper[i].val = 1;
return;
@ -75,7 +76,7 @@ expstring(void)
static char buf[512];
strcpy(buf, "X");
for(i=0; i<nelem(exper); i++)
for(i=0; exper[i].name != nil; i++)
if(*exper[i].val)
seprint(buf+strlen(buf), buf+sizeof buf, ",%s", exper[i].name);
if(strlen(buf) == 1)