shithub: mc

Download patch

ref: bc9013256fb5a406c53829fe6d4cad8325243347
parent: b2ea6be4fd100222817cb2ad5dbb70ddda74ee48
author: Ori Bernstein <[email protected]>
date: Mon Jan 6 20:06:57 EST 2014

Search structs correctly for members in initializers.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1495,8 +1495,8 @@
 
         et = NULL;
         for (j = 0; j < t->nmemb; j++) {
-            if (!strcmp(namestr(t->sdecls[i]->decl.name), namestr(name))) {
-                et = type(st, t->sdecls[i]);
+            if (!strcmp(namestr(t->sdecls[j]->decl.name), namestr(name))) {
+                et = type(st, t->sdecls[j]);
                 break;
             }
         }