shithub: 3dee

Download patch

ref: 3723c57850d0be36a5b7f541b26c8c3d80ade225
parent: f629d32fa3ca1fec1e85f7e14edc3f942a1167fe
author: rodri <rgl@antares-labs.eu>
date: Thu Jul 3 11:47:45 EDT 2025

obj,stl: bring model dedup back

--- a/obj.c
+++ b/obj.c
@@ -370,7 +370,7 @@
 
 	dedup = 1;
 	ARGBEGIN{
-	case 'd': dedup--; break;	/* TODO waiting for a Model compaction routine */
+	case 'd': dedup--; break;
 	default: usage();
 	}ARGEND;
 	if(argc > 2)
@@ -382,6 +382,9 @@
 	m = readobjmodel(infile);
 	if(m == nil)
 		sysfatal("readobjmodel: %r");
+
+	if(dedup)
+		compactmodel(m);
 
 	if(dstdir == nil){
 		if(writemodel(1, m) == 0)
--- a/stl.c
+++ b/stl.c
@@ -64,7 +64,7 @@
 	dedup = 1;
 	infile = "/fd/0";
 	ARGBEGIN{
-	case 'd': dedup--; break;	/* TODO waiting for a Model compaction routine */
+	case 'd': dedup--; break;
 	default: usage();
 	}ARGEND;
 	if(argc == 1)
@@ -79,6 +79,9 @@
 	m = readstlmodel(fd);
 	if(m == nil)
 		sysfatal("readstlmodel: %r");
+
+	if(dedup)
+		compactmodel(m);
 
 	if(writemodel(1, m) == 0)
 		sysfatal("writemodel: %r");
--