diff --git a/src/mesh.cpp b/src/mesh.cpp index 59b43556..9cf3903d 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -110,11 +110,11 @@ void SMesh::Simplify(int start) { STriMeta meta = l.elem[start].meta; - STriangle *tout = (STriangle *)AllocTemporary(maxTriangles*sizeof(*tout)); + STriangle *tout = (STriangle *)MemAlloc(maxTriangles*sizeof(*tout)); int toutc = 0; Vector n = Vector::From(0, 0, 0); - Vector *conv = (Vector *)AllocTemporary(maxTriangles*3*sizeof(*conv)); + Vector *conv = (Vector *)MemAlloc(maxTriangles*3*sizeof(*conv)); int convc = 0; int start0 = start; @@ -236,8 +236,8 @@ void SMesh::Simplify(int start) { for(i = 0; i < toutc; i++) { AddTriangle(&(tout[i])); } - FreeTemporary(tout); - FreeTemporary(conv); + MemFree(tout); + MemFree(conv); } void SMesh::AddAgainstBsp(SMesh *srcm, SBsp3 *bsp3) { diff --git a/src/platform/utilunix.cpp b/src/platform/utilunix.cpp index 565ca762..0275bd60 100644 --- a/src/platform/utilunix.cpp +++ b/src/platform/utilunix.cpp @@ -54,18 +54,6 @@ void *AllocTemporary(size_t n) return (void *)&h[1]; } -void FreeTemporary(void *p) -{ - AllocTempHeader *h = (AllocTempHeader *)p - 1; - if(h->prev) { - h->prev->next = h->next; - } else { - Head = h->next; - } - if(h->next) h->next->prev = h->prev; - free(h); -} - void FreeAllTemporary(void) { AllocTempHeader *h = Head; diff --git a/src/platform/utilwin.cpp b/src/platform/utilwin.cpp index eeaef9ba..4e452802 100644 --- a/src/platform/utilwin.cpp +++ b/src/platform/utilwin.cpp @@ -47,9 +47,6 @@ void *AllocTemporary(size_t n) ssassert(v != NULL, "Cannot allocate memory"); return v; } -void FreeTemporary(void *p) { - HeapFree(TempHeap, HEAP_NO_SERIALIZE, p); -} void FreeAllTemporary() { if(TempHeap) HeapDestroy(TempHeap); diff --git a/src/solvespace.h b/src/solvespace.h index f6be2509..e23092ca 100644 --- a/src/solvespace.h +++ b/src/solvespace.h @@ -150,7 +150,6 @@ void dbp(const char *str, ...); std::vector InitPlatform(int argc, char **argv); void *AllocTemporary(size_t n); -void FreeTemporary(void *p); void FreeAllTemporary(); void *MemAlloc(size_t n); void MemFree(void *p);