Revision: 69037
          http://sourceforge.net/p/brlcad/code/69037
Author:   brlcad
Date:     2016-10-13 03:14:45 +0000 (Thu, 13 Oct 2016)
Log Message:
-----------
make sure we consistently use libbu memory management, remove linux-specific 
malloc.h include, and looks like memory is not being released (did not fix)

Modified Paths:
--------------
    brlcad/trunk/src/libanalyze/MeshHealing/MeshConversion_brlcad.cpp

Modified: brlcad/trunk/src/libanalyze/MeshHealing/MeshConversion_brlcad.cpp
===================================================================
--- brlcad/trunk/src/libanalyze/MeshHealing/MeshConversion_brlcad.cpp   
2016-10-12 15:50:31 UTC (rev 69036)
+++ brlcad/trunk/src/libanalyze/MeshHealing/MeshConversion_brlcad.cpp   
2016-10-13 03:14:45 UTC (rev 69037)
@@ -27,7 +27,6 @@
 
 #include <bu/defines.h>
 #include <bu/malloc.h>
-#include <malloc.h>
 #include <rt/geom.h>
 #include <rt/primitives/bot.h>
 #include <stddef.h>
@@ -339,7 +338,7 @@
 BrlcadMesh::setVertices()
 {
     bu_free(bot->vertices, "vertices");
-    bot->vertices = (fastf_t*)bu_malloc(sizeof(fastf_t) * vertexlist.size() * 
3, "vertices reallocation");
+    bot->vertices = (fastf_t*)bu_malloc(sizeof(fastf_t) * vertexlist.size() * 
3, "alloc vertices");
     bot->num_vertices = vertexlist.size();
 
     for (unsigned int i = 0; i < vertexlist.size(); i++) {
@@ -353,7 +352,7 @@
 {
     DCEL_Edge *edge;
 
-    bot->faces = (int*)realloc(bot->faces, 3* (facelist.size() - 1) * 
sizeof(int));
+    bot->faces = (int*)bu_realloc(bot->faces, 3* (facelist.size() - 1) * 
sizeof(int), "realloc faces");
     bot->num_faces = facelist.size() - 1;
 
     /* Unbounded face is the first record, so skip */
@@ -404,7 +403,7 @@
     }
 
     bot->num_vertices -= 1;
-    /*bot->vertices = (fastf_t*)realloc(bot->vertices, 3 * getNumVertices() * 
sizeof(fastf_t));*/
+    /*bot->vertices = (fastf_t*)bu_realloc(bot->vertices, 3 * getNumVertices() 
* sizeof(fastf_t), "realloc vertices");*/
 }
 
 void
@@ -417,13 +416,13 @@
     }
     bot->num_faces -= 1;
 
-    /*bot->faces = (int*)realloc(bot->faces, 3 * getNumFaces() * 
sizeof(int));*/
+    /*bot->faces = (int*)bu_realloc(bot->faces, 3 * getNumFaces() * 
sizeof(int), "realloc vertices");*/
 }
 
 void
 BrlcadMesh::addFace()
 {
-    int *new_faces = (int*)realloc(bot->faces, 3 * (getNumFaces() + 1) * 
sizeof(int));
+    int *new_faces = (int*)bu_realloc(bot->faces, 3 * (getNumFaces() + 1) * 
sizeof(int), "realloc faces");
     bot->faces = new_faces;
     int ID = facelist.size() - 1;
     DCEL_Edge *trav_edge = facelist[ID].start_edge;
@@ -439,7 +438,7 @@
 void
 BrlcadMesh::addVertex(int ID)
 {
-    fastf_t *new_vertices = (fastf_t*)realloc(bot->vertices, 3 * 
(getNumVertices() + 1) * sizeof(fastf_t));
+    fastf_t *new_vertices = (fastf_t*)bu_realloc(bot->vertices, 3 * 
(getNumVertices() + 1) * sizeof(fastf_t), "realloc vertices");
 
     bot->vertices = new_vertices;
 

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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to