Revision: 77198
          http://sourceforge.net/p/brlcad/code/77198
Author:   starseeker
Date:     2020-09-23 12:38:50 +0000 (Wed, 23 Sep 2020)
Log Message:
-----------
Use std::set to build up the unique set of directory pointers.

Modified Paths:
--------------
    brlcad/trunk/src/libged/stat/stat.cpp

Modified: brlcad/trunk/src/libged/stat/stat.cpp
===================================================================
--- brlcad/trunk/src/libged/stat/stat.cpp       2020-09-23 03:42:58 UTC (rev 
77197)
+++ brlcad/trunk/src/libged/stat/stat.cpp       2020-09-23 12:38:50 UTC (rev 
77198)
@@ -26,7 +26,9 @@
 
 #include "common.h"
 
+#include <set>
 #include <sstream>
+
 extern "C" {
 #include "fort.h"
 #include "../alphanum.h"
@@ -33,6 +35,7 @@
 }
 
 #include "bu/opt.h"
+#include "bu/ptbl.h"
 #include "bu/sort.h"
 #include "bu/units.h"
 #include "bu/vls.h"
@@ -560,7 +563,7 @@
        }
     }
 
-    struct bu_ptbl objs = BU_PTBL_INIT_ZERO;
+    std::set<struct directory *> udp;
 
     for (int i = 0; i < argc; i++) {
 
@@ -577,7 +580,7 @@
                    continue;
                }
            }
-           bu_ptbl_ins_unique(&objs,  (long *)dp);
+           udp.insert(dp);
        }
 
        bu_free(paths, "dp array");
@@ -584,6 +587,12 @@
     }
 
     // If we have any sorting enabled, do that
+    struct bu_ptbl objs = BU_PTBL_INIT_ZERO;
+    std::set<struct directory *>::iterator o_it;
+    for (o_it = udp.begin(); o_it != udp.end(); o_it++) {
+       struct directory *dp = *o_it;
+       bu_ptbl_ins(&objs,  (long *)dp);
+    }
     dpath_sort((void *)objs.buffer, BU_PTBL_LEN(&objs), 
bu_vls_cstr(&sort_str), gedp);
 
     for (size_t j = 0; j < BU_PTBL_LEN(&objs); j++) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to