shithub: mc

Download patch

ref: cc3afe8080e433d68406cf51615a9530ecbbba68
parent: ae65514eb5853c11042cdeba8bc408b68798c59c
author: Ori Bernstein <[email protected]>
date: Mon Oct 30 20:43:57 EDT 2017

Loop uniformly in export.

--- a/parse/export.c
+++ b/parse/export.c
@@ -260,26 +260,24 @@
 
 	/* tag the traits */
 	tr = NULL;
-	k = htkeys(st->tr, &n);
-	for (j = 0; j < n; j++) {
-		tr = gettrait(st, k[j]);
+	for (i = 0; i < ntraittab; i++) {
+		tr = traittab[i];
 		if (tr->vis != Visexport)
 			continue;
 		if (hidelocal && tr->ishidden)
 			tr->vis = Vishidden;
 		tr->param->vis = tr->vis;
-		for (i = 0; i < tr->naux; i++)
-			tr->aux[i]->vis = tr->vis;
-		for (i = 0; i < tr->nproto; i++) {
-			tr->proto[i]->decl.vis = tr->vis;
-			tagnode(st, tr->proto[i], 0, hidelocal);
+		for (j = 0; j < tr->naux; j++)
+			tr->aux[j]->vis = tr->vis;
+		for (j = 0; j < tr->nproto; j++) {
+			tr->proto[j]->decl.vis = tr->vis;
+			tagnode(st, tr->proto[j], 0, hidelocal);
 		}
 	}
-	free(k);
 
 	/* tag the impls */
-	for (i = 0; i < file->file.nimpl; i++) {
-		s = file->file.impl[i];
+	for (i = 0; i < nimpltab; i++) {
+		s = impltab[i];
 		if (s->impl.vis != Visexport)
 			continue;
 		tagnode(st, s, 0, hidelocal);