From 307f4776266bb9778f327ed00de85ae97c0e6932 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Mon, 18 Nov 2019 16:15:49 +0100 Subject: [PATCH] fix issue #19: got rid of jkqtpArrayMalloc(), jkqtpArrayCalloc(), jkqtpArrayFree() (which were a remenant of QuickFit 3 and not really portable or useful) --- lib/jkqtcommon/jkqtparraytools.h | 77 ++----------------------------- lib/jkqtcommon/jkqtplinalgtools.h | 4 +- 2 files changed, 6 insertions(+), 75 deletions(-) diff --git a/lib/jkqtcommon/jkqtparraytools.h b/lib/jkqtcommon/jkqtparraytools.h index 317d71e3ce..85bd952bac 100644 --- a/lib/jkqtcommon/jkqtparraytools.h +++ b/lib/jkqtcommon/jkqtparraytools.h @@ -59,75 +59,6 @@ - -/*! \brief malloc() for use herein (aligned on some systems!) - \ingroup jkqtptools_math_array - -*/ -inline void* jkqtpArrayMalloc(size_t size) { -// std::cout<<"statisticsMalloc("<& a, long long l, long long r){ /*! \brief duplicate an array of data \ingroup jkqtptools_math_array - \note use jkqtpArrayFree() to free the memory!!! + \note use free() to free the memory!!! */ template inline T* jkqtpArrayDuplicate(const T* dataIn, long long N) { // std::cout<<"statisticsDuplicateArray("<(jkqtpArrayMalloc(N*sizeof(T))); + T* out=static_cast(malloc(N*sizeof(T))); if (out) memcpy(out, dataIn, N*sizeof(T)); return out; } @@ -169,7 +100,7 @@ inline T* jkqtpArrayDuplicate(const T* dataIn, long long N) { -/*! \brief this class ensures that the given pointer is jkqtpArrayFreed when the class is destroyed. +/*! \brief this class ensures that the given pointer is freed when the class is destroyed. \ingroup jkqtptools_math_array */ @@ -188,7 +119,7 @@ class JKQTPArrayScopedPointer { ~JKQTPArrayScopedPointer() { - if (pntr) jkqtpArrayFree(pntr); + if (pntr) free(pntr); } diff --git a/lib/jkqtcommon/jkqtplinalgtools.h b/lib/jkqtcommon/jkqtplinalgtools.h index e097761664..d0784d4ed6 100644 --- a/lib/jkqtcommon/jkqtplinalgtools.h +++ b/lib/jkqtcommon/jkqtplinalgtools.h @@ -702,7 +702,7 @@ inline bool jkqtplinalgLinSolve(const T* A, const T* B, long N, long C, T* resul // v ... ... ... | ..... // const long msize=N*(N+C); - JKQTPArrayScopedPointer m(static_cast(jkqtpArrayMalloc(msize*sizeof(T)))); // use scoped pointer to ensure, that m is free'd, when the function is ending + JKQTPArrayScopedPointer m(static_cast(malloc(msize*sizeof(T)))); // use scoped pointer to ensure, that m is free'd, when the function is ending for (long l=0; l m(static_cast(jkqtpArrayCalloc((N-1)*(N-1),sizeof(T *)))); + JKQTPArrayScopedPointer m(static_cast(calloc((N-1)*(N-1),sizeof(T *)))); for (i=1;i