shithub: mc

Download patch

ref: b8c37ce00d060d934f58b1b01bdbbbe27dc159f0
parent: 545ee279bf3bee642c0cc97c2fef4a699f96393f
author: Ori Bernstein <[email protected]>
date: Mon Aug 4 18:15:20 EDT 2014

Better formatting for fmtunion

--- a/parse/type.c
+++ b/parse/type.c
@@ -444,10 +444,13 @@
     p += snprintf(p, end - p, "union ");
     for (i = 0; i < t->nmemb; i++) {
         name = namestr(t->udecls[i]->name);
-        if (t->udecls[i]->etype)
+        if (t->udecls[i]->etype) {
             ty = tystr(t->udecls[i]->etype);
-        p += snprintf(p, end - p, "`%s %s; ", name, ty);
-        free(ty);
+            p += snprintf(p, end - p, "`%s %s; ", name, ty);
+            free(ty);
+        } else {
+            p += snprintf(p, end - p, "`%s; ", name);
+        }
     }
     p += snprintf(p, end - p, ";;");
     return p - buf;