mirror of
https://github.com/golang/go
synced 2024-11-02 11:50:30 +00:00
gc: avoid 0-length C array
R=golang-dev, ality CC=golang-dev, rsc https://golang.org/cl/5467066
This commit is contained in:
parent
2c2a582ae9
commit
0f4f3c6769
1 changed files with 3 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue