ref: 106bbb494c2983278391f67f804905deb3204db8
parent: abd0b64337a11d4ffd92002c231674527ca63016
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;