shithub: mc

Download patch

ref: 18ddda57bcc621dcca8f5c2a6dda3408b073fb24
parent: 2c0fbf27314d04cb3bb5ab1ea3f9b7bae556f89a
author: Ori Bernstein <[email protected]>
date: Fri Jul 24 20:01:45 EDT 2015

Use id instead of full type for structs and unions

    Structs and unions are always going to be private: they can only be
    exported by name. So we should just use their id for the sake of not
    having ridiculously long type names.

--- a/parse/type.c
+++ b/parse/type.c
@@ -822,21 +822,10 @@
             p += bprintf(p, end - p, "$");
             break;
         case Tystruct:
-            p += bprintf(p, end - p, "$t");
-            for (i = 0; i < ty->nmemb; i++) {
-                p += bprintf(p, end - p, "%s.", declname(ty->sdecls[i]));
-                p += tyidfmt(p, end - p, decltype(ty->sdecls[i]));
-                p += bprintf(p, end - p, "$");
-            }
+            p += bprintf(p, end - p, "$t%lld", ty->tid);
             break;
         case Tyunion:
-            p += bprintf(p, end - p, "$u");
-            for (i = 0; i < ty->nmemb; i++) {
-                p += bprintf(p, end - p, "%s$", namestr(ty->udecls[i]->name));
-                if (ty->udecls[i]->etype)
-                    p += tyidfmt(p, end - p, ty->udecls[i]->etype);
-                p += bprintf(p, end - p, "$");
-            }
+            p += bprintf(p, end - p, "$u%lld", ty->tid);
             break;
         case Typaram:
             p += bprintf(p, end - p, "$r%s", ty->pname);