Changeset 1073
- Timestamp:
- Jun 23, 2004, 1:00:17 PM (22 years ago)
- Location:
- trunk/psLib
- Files:
-
- 136 edited
-
psLib.kdevelop (modified) (2 diffs)
-
psLib.kdevses (modified) (1 diff)
-
src/collections/psBitSet.c (modified) (5 diffs)
-
src/collections/psBitSet.h (modified) (2 diffs)
-
src/collections/psList.c (modified) (7 diffs)
-
src/collections/psList.h (modified) (2 diffs)
-
src/collections/psSort.c (modified) (3 diffs)
-
src/collections/psSort.d (modified) (1 diff)
-
src/collections/psVector.c (modified) (7 diffs)
-
src/collections/psVector.h (modified) (3 diffs)
-
src/dataManip/psFFT.c (modified) (37 diffs)
-
src/dataManip/psFunctions.c (modified) (18 diffs)
-
src/dataManip/psFunctions.h (modified) (3 diffs)
-
src/dataManip/psStats.c (modified) (12 diffs)
-
src/dataManip/psStats.h (modified) (3 diffs)
-
src/dataManip/psVectorFFT.c (modified) (37 diffs)
-
src/fft/psVectorFFT.c (modified) (37 diffs)
-
src/image/psImage.c (modified) (21 diffs)
-
src/image/psImage.h (modified) (2 diffs)
-
src/image/psImageIO.c (modified) (12 diffs)
-
src/image/psImageIO.d (modified) (1 diff)
-
src/image/psImageStats.c (modified) (4 diffs)
-
src/imageops/psImageStats.c (modified) (4 diffs)
-
src/math/psPolynomial.c (modified) (18 diffs)
-
src/math/psPolynomial.h (modified) (3 diffs)
-
src/math/psSpline.c (modified) (18 diffs)
-
src/math/psSpline.h (modified) (3 diffs)
-
src/math/psStats.c (modified) (12 diffs)
-
src/math/psStats.h (modified) (3 diffs)
-
src/mathtypes/psImage.c (modified) (21 diffs)
-
src/mathtypes/psImage.h (modified) (2 diffs)
-
src/mathtypes/psVector.c (modified) (7 diffs)
-
src/mathtypes/psVector.h (modified) (3 diffs)
-
src/sys/psMemory.c (modified) (19 diffs)
-
src/sys/psMemory.h (modified) (6 diffs)
-
src/sysUtils/psHash.c (modified) (21 diffs)
-
src/sysUtils/psHash.d (modified) (1 diff)
-
src/sysUtils/psHash.h (modified) (2 diffs)
-
src/sysUtils/psMemory.c (modified) (19 diffs)
-
src/sysUtils/psMemory.h (modified) (6 diffs)
-
src/types/psBitSet.c (modified) (5 diffs)
-
src/types/psBitSet.h (modified) (2 diffs)
-
src/types/psList.c (modified) (7 diffs)
-
src/types/psList.h (modified) (2 diffs)
-
test/FullUnitTest (modified) (2 diffs)
-
test/collections/builddir/tst_psBitSet_01.d (modified) (1 diff)
-
test/collections/builddir/tst_psBitSet_02.d (modified) (1 diff)
-
test/collections/builddir/tst_psBitSet_03.d (modified) (1 diff)
-
test/collections/builddir/tst_psBitSet_04.d (modified) (1 diff)
-
test/collections/builddir/tst_psBitSet_05.d (modified) (1 diff)
-
test/collections/builddir/tst_psBitSet_06.d (modified) (1 diff)
-
test/collections/builddir/tst_psImage.d (modified) (1 diff)
-
test/collections/builddir/tst_psList.d (modified) (1 diff)
-
test/collections/builddir/tst_psSort_01.d (modified) (1 diff)
-
test/collections/builddir/tst_psSort_02.d (modified) (1 diff)
-
test/collections/builddir/tst_psSort_03.d (modified) (1 diff)
-
test/collections/builddir/tst_psSort_04.d (modified) (1 diff)
-
test/collections/builddir/tst_psVector_01.d (modified) (1 diff)
-
test/collections/builddir/tst_psVector_02.d (modified) (1 diff)
-
test/collections/builddir/tst_psVector_03.d (modified) (1 diff)
-
test/collections/tst_psBitSet_01.c (modified) (2 diffs)
-
test/collections/tst_psBitSet_02.c (modified) (2 diffs)
-
test/collections/tst_psBitSet_03.c (modified) (2 diffs)
-
test/collections/tst_psBitSet_04.c (modified) (2 diffs)
-
test/collections/tst_psBitSet_05.c (modified) (2 diffs)
-
test/collections/tst_psBitSet_06.c (modified) (2 diffs)
-
test/collections/tst_psList.c (modified) (13 diffs)
-
test/collections/tst_psSort_01.c (modified) (2 diffs)
-
test/collections/tst_psSort_02.c (modified) (2 diffs)
-
test/collections/tst_psSort_03.c (modified) (2 diffs)
-
test/collections/tst_psSort_04.c (modified) (2 diffs)
-
test/collections/tst_psVector_01.c (modified) (2 diffs)
-
test/collections/tst_psVector_02.c (modified) (2 diffs)
-
test/collections/tst_psVector_03.c (modified) (6 diffs)
-
test/collections/verified/tst_psBitSet_01.stderr (modified) (1 diff)
-
test/collections/verified/tst_psBitSet_05.stderr (modified) (1 diff)
-
test/collections/verified/tst_psBitSet_06.stderr (modified) (1 diff)
-
test/collections/verified/tst_psBitSet_06.stdout (modified) (1 diff)
-
test/collections/verified/tst_psList.stderr (modified) (2 diffs)
-
test/collections/verified/tst_psSort_03.stderr (modified) (1 diff)
-
test/collections/verified/tst_psSort_04.stderr (modified) (1 diff)
-
test/dataManip/tst_psFunc00.c (modified) (9 diffs)
-
test/dataManip/tst_psFunc01.c (modified) (1 diff)
-
test/dataManip/tst_psHist00.c (modified) (1 diff)
-
test/dataManip/tst_psHist01.c (modified) (1 diff)
-
test/dataManip/tst_psHist02.c (modified) (6 diffs)
-
test/dataManip/tst_psMatrix01.c (modified) (2 diffs)
-
test/dataManip/tst_psMatrix03.c (modified) (2 diffs)
-
test/dataManip/tst_psMatrix04.c (modified) (2 diffs)
-
test/dataManip/tst_psMatrix05.c (modified) (2 diffs)
-
test/dataManip/tst_psMatrix06.c (modified) (2 diffs)
-
test/dataManip/tst_psMatrix07.c (modified) (2 diffs)
-
test/dataManip/tst_psStats00.c (modified) (1 diff)
-
test/dataManip/tst_psStats01.c (modified) (1 diff)
-
test/dataManip/tst_psStats02.c (modified) (1 diff)
-
test/dataManip/tst_psStats03.c (modified) (1 diff)
-
test/dataManip/tst_psStats05.c (modified) (2 diffs)
-
test/dataManip/tst_psStats06.c (modified) (1 diff)
-
test/dataManip/tst_psStats07.c (modified) (1 diff)
-
test/dataManip/tst_psStats08.c (modified) (1 diff)
-
test/dataManip/tst_psStats09.c (modified) (1 diff)
-
test/dataManip/tst_psVectorFFT.c (modified) (6 diffs)
-
test/dataManip/verified/tst_psStats05.stdout (modified) (1 diff)
-
test/image/tst_psImage.c (modified) (22 diffs)
-
test/image/tst_psImageFFT.c (modified) (6 diffs)
-
test/image/tst_psImageIO.c (modified) (6 diffs)
-
test/image/tst_psImageStats00.c (modified) (3 diffs)
-
test/image/tst_psImageStats01.c (modified) (2 diffs)
-
test/image/tst_psImageStats02.c (modified) (1 diff)
-
test/image/verified/tst_psImageStats02.stdout (modified) (1 diff)
-
test/sysUtils/builddir/atst_psAbort_01.d (modified) (1 diff)
-
test/sysUtils/builddir/atst_psAbort_02.d (modified) (1 diff)
-
test/sysUtils/builddir/atst_psAbort_03.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psError.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psHash00.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psHash01.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psHash02.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psHash03.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psHash04.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psLogMsg00.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psLogMsg01.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psLogMsg02.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psLogMsg03.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psMemory.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psStringCopy.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psTrace00.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psTrace01.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psTrace02.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psTrace03.d (modified) (1 diff)
-
test/sysUtils/builddir/tst_psTrace04.d (modified) (1 diff)
-
test/sysUtils/tst_psHash00.c (modified) (1 diff)
-
test/sysUtils/tst_psHash01.c (modified) (4 diffs)
-
test/sysUtils/tst_psHash02.c (modified) (4 diffs)
-
test/sysUtils/tst_psHash03.c (modified) (6 diffs)
-
test/sysUtils/tst_psHash04.c (modified) (6 diffs)
-
test/sysUtils/verified/tst_psMemory.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/psLib.kdevelop
r667 r1073 136 136 <hidepatterns>*.o,*.lo,CVS</hidepatterns> 137 137 <hidenonprojectfiles>false</hidenonprojectfiles> 138 <showvcsfields>false</showvcsfields> 138 139 </tree> 139 140 </kdevfileview> … … 144 145 </filetemplates> 145 146 </cppsupportpart> 147 <kdevcvsservice> 148 <recursivewhenupdate>true</recursivewhenupdate> 149 <prunedirswhenupdate>true</prunedirswhenupdate> 150 <createdirswhenupdate>true</createdirswhenupdate> 151 <recursivewhencommitremove>true</recursivewhencommitremove> 152 <revertoptions>-C</revertoptions> 153 </kdevcvsservice> 146 154 </kdevelop> -
trunk/psLib/psLib.kdevses
r1005 r1073 2 2 <!DOCTYPE KDevPrjSession> 3 3 <KDevPrjSession> 4 <DocsAndViews NumberOfDocuments="0" /> 4 <DocsAndViews NumberOfDocuments="11" > 5 <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psImage.c" > 6 <View0 line="0" Type="???" > 7 <AdditionalSettings Top="1" Width="1196" Attach="1" Height="861" Left="1" MinMaxMode="0" /> 8 </View0> 9 </Doc0> 10 <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psBitSet.c" > 11 <View0 line="107" Type="???" > 12 <AdditionalSettings Top="1" Width="1196" Attach="1" Height="832" Left="1" MinMaxMode="0" /> 13 </View0> 14 </Doc1> 15 <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psList.c" > 16 <View0 line="43" Type="???" > 17 <AdditionalSettings Top="1" Width="1196" Attach="1" Height="832" Left="1" MinMaxMode="0" /> 18 </View0> 19 </Doc2> 20 <Doc3 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psVector.c" > 21 <View0 line="185" Type="???" > 22 <AdditionalSettings Top="1" Width="1196" Attach="1" Height="832" Left="1" MinMaxMode="0" /> 23 </View0> 24 </Doc3> 25 <Doc4 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psVector.h" > 26 <View0 line="123" Type="???" > 27 <AdditionalSettings Top="1" Width="1196" Attach="1" Height="832" Left="1" MinMaxMode="0" /> 28 </View0> 29 </Doc4> 30 <Doc5 NumberOfViews="1" URL="file:/home/desonia/psLib/src/dataManip/psFFT.c" > 31 <View0 line="0" Type="???" > 32 <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" /> 33 </View0> 34 </Doc5> 35 <Doc6 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psHash00.c" > 36 <View0 line="54" Type="???" > 37 <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" /> 38 </View0> 39 </Doc6> 40 <Doc7 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psHash01.c" > 41 <View0 line="41" Type="???" > 42 <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" /> 43 </View0> 44 </Doc7> 45 <Doc8 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psHash02.c" > 46 <View0 line="82" Type="???" > 47 <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" /> 48 </View0> 49 </Doc8> 50 <Doc9 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psHash03.c" > 51 <View0 line="122" Type="???" > 52 <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" /> 53 </View0> 54 </Doc9> 55 <Doc10 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psHash04.c" > 56 <View0 line="68" Type="???" > 57 <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" /> 58 </View0> 59 </Doc10> 60 </DocsAndViews> 5 61 <pluginList> 6 62 <kdevbookmarks> -
trunk/psLib/src/collections/psBitSet.c
r1041 r1073 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 15 02:45:43$12 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 55 55 /* FUNCTION IMPLEMENTATION - LOCAL */ 56 56 /*****************************************************************************/ 57 static void bitSetFree(psBitSet *restrict inBitSet); 58 57 59 58 60 /** Private function to create a mask. … … 88 90 numBytes = ceil(n/8.0); 89 91 newObj = psAlloc(sizeof(psBitSet)); 92 p_psMemSetDeallocator(newObj,(psFreeFcn)bitSetFree); 90 93 newObj->n = numBytes; 91 94 … … 98 101 } 99 102 100 void psBitSetFree(psBitSet *restrict inBitSet)103 static void bitSetFree(psBitSet *restrict inBitSet) 101 104 { 102 105 if(inBitSet == NULL) { … … 105 108 } 106 109 psFree(inBitSet->bits); 107 psFree(inBitSet);108 110 } 109 111 -
trunk/psLib/src/collections/psBitSet.h
r974 r1073 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-06- 10 01:58:06$14 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-06-23 23:00:15 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 54 54 psBitSet* psBitSetAlloc( 55 55 int n /**< Number of bits in psBitSet array */ 56 );57 58 /** Free a psBitSet59 *60 * Deletes a psBitSet array.61 */62 void psBitSetFree(63 psBitSet *restrict inMask /**< Pointer to psBitSet to be deleted. */64 56 ); 65 57 -
trunk/psLib/src/collections/psList.c
r1024 r1073 6 6 * @author Robert Daniel DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06- 14 19:45:46$8 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-23 23:00:15 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 29 29 // private functions. 30 psListElem* listGetIterator(psList* list); 31 int listGetIteratorIndex(psList* list); 32 void listSetIterator(psList *list, int where, bool lockList); 30 static psListElem* listGetIterator(psList* list); 31 static int listGetIteratorIndex(psList* list); 32 static void listSetIterator(psList *list, int where, bool lockList); 33 static void listFree(psList *list); 33 34 34 35 … … 36 37 { 37 38 psList *list = psAlloc(sizeof(psList)); 39 p_psMemSetDeallocator(list,(psFreeFcn)listFree); 38 40 39 41 list->size = 0; … … 41 43 list->iter = ITER_INIT_HEAD; 42 44 list->iterIndex = PS_LIST_HEAD; 45 43 46 pthread_mutex_init(&(list->lock),NULL) 44 47 ; … … 51 54 } 52 55 53 void psListFree(psList *list, psFreeFcn elemFree)56 static void listFree(psList *list) 54 57 { 55 58 if (list == NULL) { … … 63 66 psListElem *next = ptr->next; 64 67 65 p _psCustomFree(elemFree, psMemDecrRefCounter(ptr->data));68 psFree(ptr->data); 66 69 psFree(ptr); 67 70 … … 75 78 ; 76 79 77 psFree(list);78 80 } 79 81 -
trunk/psLib/src/collections/psList.h
r1017 r1073 10 10 * @ingroup LinkedList 11 11 * 12 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 12 22:15:39$12 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 73 73 ) 74 74 ; 75 76 #include "psMemory.h"77 /** Destroys a psList linked list object. This also frees the elements of the78 * list using the psFreeFcn given, if any. If no psFreeFcn is specified,79 * the elements are just dereferenced via psMemDecrRefCounter(...).80 *81 */82 void psListFree(83 psList* restrict list, ///< list to destroy84 psFreeFcn elemFree ///< destructor for data on list85 );86 75 87 76 /** Adds an element to a psList at position given. -
trunk/psLib/src/collections/psSort.c
r989 r1073 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-06- 10 23:15:08$16 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-06-23 23:00:15 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 33 33 #include "psSort.h" 34 34 #include "psError.h" 35 #include "psMemory.h" 35 36 36 37 /******************************************************************************/ … … 242 243 243 244 // Free temp memory 244 ps VectorFree(tmpVector);245 psFree(tmpVector); 245 246 246 247 return outVector; -
trunk/psLib/src/collections/psSort.d
r986 r1073 1 psSort.o psSort.d : psSort.c psVector.h psType.h psSort.h ../sysUtils/psError.h 1 psSort.o psSort.d : psSort.c psVector.h psType.h psSort.h ../sysUtils/psError.h \ 2 ../sysUtils/psMemory.h -
trunk/psLib/src/collections/psVector.c
r1008 r1073 8 8 * @author Ross Harman, MHPCC 9 9 * 10 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-06- 12 01:33:16$10 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-06-23 23:00:15 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 49 49 /* FUNCTION IMPLEMENTATION - LOCAL */ 50 50 /*****************************************************************************/ 51 static void vectorFree(psVector *restrict psVec); 51 52 52 53 /*****************************************************************************/ … … 68 69 // Create vector struct 69 70 psVec = (psVector *)psAlloc(sizeof(psVector)); 71 p_psMemSetDeallocator(psVec,(psFreeFcn)vectorFree); 70 72 71 73 psVec->type.dimen = PS_DIMEN_VECTOR; … … 132 134 if(nalloc < 1) { 133 135 psError(__func__, "Invalid value for nalloc (%d)\n", nalloc); 134 ps VectorFree(in);136 psFree(in); 135 137 return NULL; 136 138 } … … 154 156 } 155 157 156 void psVectorFree(psVector *restrict psVec)158 static void vectorFree(psVector *restrict psVec) 157 159 { 158 160 if (psVec == NULL) { … … 160 162 } 161 163 164 if (psVec->type.type == PS_TYPE_PTR) { 165 for(int i = 0; i < psVec->n; i++) { 166 psFree(psVec->data.PTR[i]); 167 psVec->data.PTR[i] = NULL; 168 } 169 } 170 162 171 psFree(psVec->data.V); 163 psFree(psVec);164 172 } 165 173 166 void psVectorElementFree(psVector *restrict psVec , void (*elemFree)(void *))174 void psVectorElementFree(psVector *restrict psVec) 167 175 { 168 176 … … 176 184 } 177 185 178 for(int i = 0; i < psVec->nalloc; i++) { 179 if(elemFree == NULL) { 180 psMemDecrRefCounter(psVec->data.PTR[i]); 181 } else { 182 elemFree(psMemDecrRefCounter(psVec->data.PTR[i])); 183 } 186 for(int i = 0; i < psVec->n; i++) { 187 psFree(psVec->data.PTR[i]); 184 188 psVec->data.PTR[i] = NULL; 185 189 } -
trunk/psLib/src/collections/psVector.h
r974 r1073 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-06- 10 01:58:06$13 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-06-23 23:00:15 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 100 100 ); 101 101 102 /** Deallocate a vector.103 *104 * Uses psLib memory allocation functions to deallocate a vector collection of data. The vector is deallocated105 * according to the psType type member contained within the vector.106 *107 * @return psVector*: Pointer to psVector.108 *109 */110 void psVectorFree(111 psVector *restrict psVec ///< Vector to free.112 );113 114 115 102 /** Deallocate/Dereference elements of a void pointer vector. 116 103 * … … 122 109 */ 123 110 void psVectorElementFree( 124 psVector *restrict psVec, ///< Void pointer vector to destroy. 125 void (*elemFree)(void *) ///< Optional callback function to remove vector elements. 111 psVector *restrict psVec ///< Void pointer vector to destroy. 126 112 ); 127 113 -
trunk/psLib/src/dataManip/psFFT.c
r1010 r1073 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-06- 12 02:17:25 $7 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-06-23 23:00:15 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 35 35 /* got good image data? */ 36 36 if (in==NULL) { 37 ps ImageFree(out);37 psFree(out); 38 38 return NULL; 39 39 } … … 44 44 psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)", 45 45 type); 46 ps ImageFree(out);46 psFree(out); 47 47 return NULL; 48 48 } … … 51 51 psError(__func__,"Input image must be complex image for reverse FFT (type=%d).", 52 52 type); 53 ps ImageFree(out);53 psFree(out); 54 54 return NULL; 55 55 … … 76 76 if (plan == NULL) { 77 77 psError(__func__,"Failed to create FFTW plan."); 78 ps ImageFree(out);78 psFree(out); 79 79 return NULL; 80 80 } … … 98 98 99 99 if (in == NULL) { 100 ps ImageFree(out);100 psFree(out); 101 101 return NULL; 102 102 } … … 143 143 psError(__func__,"Can not extract real component from given image type (%d).", 144 144 type); 145 ps ImageFree(out);145 psFree(out); 146 146 return NULL; 147 147 } … … 158 158 159 159 if (in == NULL) { 160 ps ImageFree(out);160 psFree(out); 161 161 return NULL; 162 162 } … … 205 205 psError(__func__,"Can not extract imaginary component from given image type (%d).", 206 206 type); 207 ps ImageFree(out);207 psFree(out); 208 208 return NULL; 209 209 } … … 220 220 221 221 if (real == NULL || imag == NULL) { 222 ps ImageFree(out);222 psFree(out); 223 223 return NULL; 224 224 } … … 230 230 if (imag->type.type != type) { 231 231 psError(__func__,"The inputs to psImageComplex must be the same type."); 232 ps ImageFree(out);232 psFree(out); 233 233 return NULL; 234 234 } … … 237 237 imag->numRows != numRows) { 238 238 psError(__func__,"The inputs to psImageComplex must be the same dimensions."); 239 ps ImageFree(out);239 psFree(out); 240 240 return NULL; 241 241 } … … 243 243 if (PS_IS_PSELEMTYPE_COMPLEX(type)) { 244 244 psError(__func__,"The inputs to psImageComplex can not be complex."); 245 ps ImageFree(out);245 psFree(out); 246 246 return NULL; 247 247 } … … 249 249 if (type != PS_TYPE_F32 && type != PS_TYPE_F64) { 250 250 psError(__func__,"The input type to psImageComplex must be a floating point."); 251 ps ImageFree(out);251 psFree(out); 252 252 return NULL; 253 253 } … … 287 287 psError(__func__,"Can not merge real and imaginary portions for given image type (%d).", 288 288 type); 289 ps ImageFree(out);289 psFree(out); 290 290 return NULL; 291 291 } … … 302 302 303 303 if (in == NULL) { 304 ps ImageFree(out);304 psFree(out); 305 305 return NULL; 306 306 } … … 347 347 psError(__func__,"Can not compute complex conjugate for given image type (%d).", 348 348 type); 349 ps ImageFree(out);349 psFree(out); 350 350 return NULL; 351 351 } … … 362 362 363 363 if (in == NULL) { 364 ps ImageFree(out);364 psFree(out); 365 365 return NULL; 366 366 } … … 374 374 if (! PS_IS_PSELEMTYPE_COMPLEX(type)) { 375 375 psError(__func__,"Power Spectrum for non-complex inputs is not implemented."); 376 ps ImageFree(out);376 psFree(out); 377 377 return NULL; 378 378 } … … 417 417 psError(__func__,"Can not power spectrum for given image type (%d).", 418 418 type); 419 ps ImageFree(out);419 psFree(out); 420 420 return NULL; 421 421 } … … 435 435 /* got good image data? */ 436 436 if (in==NULL) { 437 ps VectorFree(out);437 psFree(out); 438 438 return NULL; 439 439 } … … 444 444 psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)", 445 445 type); 446 ps VectorFree(out);446 psFree(out); 447 447 return NULL; 448 448 } … … 451 451 psError(__func__,"Input image must be complex image for reverse FFT (type=%d).", 452 452 type); 453 ps VectorFree(out);453 psFree(out); 454 454 return NULL; 455 455 … … 491 491 if (plan == NULL) { 492 492 psError(__func__,"Failed to create FFTW plan."); 493 ps VectorFree(out);493 psFree(out); 494 494 return NULL; 495 495 } … … 510 510 511 511 if (in == NULL) { 512 ps VectorFree(out);512 psFree(out); 513 513 return NULL; 514 514 } … … 542 542 psError(__func__,"Can not extract real component from given vector type (%d).", 543 543 type); 544 ps VectorFree(out);544 psFree(out); 545 545 return NULL; 546 546 } … … 556 556 557 557 if (in == NULL) { 558 ps VectorFree(out);558 psFree(out); 559 559 return NULL; 560 560 } … … 588 588 psError(__func__,"Can not extract imaginary component from given vector type (%d).", 589 589 type); 590 ps VectorFree(out);590 psFree(out); 591 591 return NULL; 592 592 } … … 602 602 603 603 if (real == NULL || imag == NULL) { 604 ps VectorFree(out);604 psFree(out); 605 605 return NULL; 606 606 } … … 615 615 if (imag->type.type != type) { 616 616 psError(__func__,"The inputs to psVectorComplex must be the same type."); 617 ps VectorFree(out);617 psFree(out); 618 618 return NULL; 619 619 } … … 621 621 if (PS_IS_PSELEMTYPE_COMPLEX(type)) { 622 622 psError(__func__,"The inputs to psVectorComplex can not be complex."); 623 ps VectorFree(out);623 psFree(out); 624 624 return NULL; 625 625 } … … 640 640 psError(__func__,"Can not merge real and imaginary portions for given vector type (%d).", 641 641 type); 642 ps VectorFree(out);642 psFree(out); 643 643 return NULL; 644 644 } … … 654 654 655 655 if (in == NULL) { 656 ps VectorFree(out);656 psFree(out); 657 657 return NULL; 658 658 } … … 687 687 psError(__func__,"Can not compute complex conjugate for given vector type (%d).", 688 688 type); 689 ps VectorFree(out);689 psFree(out); 690 690 return NULL; 691 691 } … … 703 703 704 704 if (in == NULL) { 705 ps VectorFree(out);705 psFree(out); 706 706 return NULL; 707 707 } … … 716 716 if (! PS_IS_PSELEMTYPE_COMPLEX(type)) { 717 717 psError(__func__,"Power Spectrum for non-complex inputs is not implemented."); 718 ps VectorFree(out);718 psFree(out); 719 719 return NULL; 720 720 } … … 747 747 psError(__func__,"Can not power spectrum for given vector type (%d).", 748 748 type); 749 ps VectorFree(out);750 return NULL; 751 } 752 753 return out; 754 755 } 749 psFree(out); 750 return NULL; 751 } 752 753 return out; 754 755 } -
trunk/psLib/src/dataManip/psFunctions.c
r1022 r1073 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-06- 14 19:40:14$9 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-06-23 23:00:15 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 #include <gsl/gsl_rng.h> 35 35 #include <gsl/gsl_randist.h> 36 37 static void polynomial1DFree(psPolynomial1D *myPoly); 38 static void polynomial2DFree(psPolynomial2D *myPoly); 39 static void polynomial3DFree(psPolynomial3D *myPoly); 40 static void polynomial4DFree(psPolynomial4D *myPoly); 41 static void dPolynomial1DFree(psDPolynomial1D *myPoly); 42 static void dPolynomial2DFree(psDPolynomial2D *myPoly); 43 static void dPolynomial3DFree(psDPolynomial3D *myPoly); 44 static void dPolynomial4DFree(psDPolynomial4D *myPoly); 45 36 46 /*****************************************************************************/ 37 47 /* FUNCTION IMPLEMENTATION - PUBLIC */ … … 108 118 109 119 newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D)); 120 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial1DFree); 110 121 newPoly->n = n; 111 122 newPoly->coeff = (float *) psAlloc(n * sizeof(float)); … … 128 139 129 140 newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D)); 141 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial2DFree); 130 142 newPoly->nX = nX; 131 143 newPoly->nY = nY; … … 158 170 159 171 newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D)); 172 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial3DFree); 160 173 newPoly->nX = nX; 161 174 newPoly->nY = nY; … … 197 210 198 211 newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D)); 212 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial4DFree); 199 213 newPoly->nW = nW; 200 214 newPoly->nX = nX; … … 235 249 } 236 250 237 void psPolynomial1DFree(psPolynomial1D *myPoly)251 static void polynomial1DFree(psPolynomial1D *myPoly) 238 252 { 239 253 psFree(myPoly->coeff); 240 254 psFree(myPoly->coeffErr); 241 255 psFree(myPoly->mask); 242 psFree(myPoly); 243 } 244 245 void psPolynomial2DFree(psPolynomial2D *myPoly) 256 } 257 258 static void polynomial2DFree(psPolynomial2D *myPoly) 246 259 { 247 260 int x = 0; … … 255 268 psFree(myPoly->coeffErr); 256 269 psFree(myPoly->mask); 257 258 psFree(myPoly); 259 } 260 261 void psPolynomial3DFree(psPolynomial3D *myPoly) 270 } 271 272 static void polynomial3DFree(psPolynomial3D *myPoly) 262 273 { 263 274 int x = 0; … … 278 289 psFree(myPoly->coeffErr); 279 290 psFree(myPoly->mask); 280 psFree(myPoly); 281 } 282 283 void psPolynomial4DFree(psPolynomial4D *myPoly) 291 } 292 293 static void polynomial4DFree(psPolynomial4D *myPoly) 284 294 { 285 295 int w = 0; … … 306 316 psFree(myPoly->coeffErr); 307 317 psFree(myPoly->mask); 308 psFree(myPoly);309 318 } 310 319 … … 434 443 435 444 newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D)); 445 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial1DFree); 436 446 newPoly->n = n; 437 447 newPoly->coeff = (double *) psAlloc(n * sizeof(double)); … … 454 464 455 465 newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D)); 466 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial2DFree); 456 467 newPoly->nX = nX; 457 468 newPoly->nY = nY; … … 484 495 485 496 newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D)); 497 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial3DFree); 486 498 newPoly->nX = nX; 487 499 newPoly->nY = nY; … … 523 535 524 536 newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D)); 537 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial4DFree); 525 538 newPoly->nW = nW; 526 539 newPoly->nX = nX; … … 561 574 } 562 575 563 void psDPolynomial1DFree(psDPolynomial1D *myPoly)576 static void dPolynomial1DFree(psDPolynomial1D *myPoly) 564 577 { 565 578 psFree(myPoly->coeff); 566 579 psFree(myPoly->coeffErr); 567 580 psFree(myPoly->mask); 568 psFree(myPoly); 569 } 570 571 void psDPolynomial2DFree(psDPolynomial2D *myPoly) 581 } 582 583 static void dPolynomial2DFree(psDPolynomial2D *myPoly) 572 584 { 573 585 int x = 0; … … 581 593 psFree(myPoly->coeffErr); 582 594 psFree(myPoly->mask); 583 584 psFree(myPoly); 585 } 586 587 void psDPolynomial3DFree(psDPolynomial3D *myPoly) 595 } 596 597 static void dPolynomial3DFree(psDPolynomial3D *myPoly) 588 598 { 589 599 int x = 0; … … 604 614 psFree(myPoly->coeffErr); 605 615 psFree(myPoly->mask); 606 psFree(myPoly); 607 } 608 609 void psDPolynomial4DFree(psDPolynomial4D *myPoly) 616 } 617 618 static void dPolynomial4DFree(psDPolynomial4D *myPoly) 610 619 { 611 620 int w = 0; … … 632 641 psFree(myPoly->coeffErr); 633 642 psFree(myPoly->mask); 634 psFree(myPoly);635 643 } 636 644 -
trunk/psLib/src/dataManip/psFunctions.h
r1020 r1073 12 12 * @author George Gusciora, MHPCC 13 13 * 14 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-06- 14 19:32:42$14 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-06-23 23:00:15 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 104 104 ); 105 105 106 /** Destructor */107 void psPolynomial1DFree(psPolynomial1D *myPoly ///< Polynomial to destroy108 );109 110 /** Destructor */111 void psPolynomial2DFree(psPolynomial2D *myPoly ///< Polynomial to destroy112 );113 /** Destructor */114 void psPolynomial3DFree(psPolynomial3D *myPoly ///< Polynomial to destroy115 );116 /** Destructor */117 void psPolynomial4DFree(psPolynomial4D *myPoly ///< Polynomial to destroy118 );119 120 121 106 /** Evaluate 1D polynomial */ 122 107 float … … 206 191 ); 207 192 208 209 /** Destructor */210 void psDPolynomial1DFree(psDPolynomial1D *myPoly ///< Polynomial to destroy211 );212 /** Destructor */213 void psDPolynomial2DFree(psDPolynomial2D *myPoly ///< Polynomial to destroy214 );215 /** Destructor */216 void psDPolynomial3DFree(psDPolynomial3D *myPoly ///< Polynomial to destroy217 );218 /** Destructor */219 void psDPolynomial4DFree(psDPolynomial4D *myPoly ///< Polynomial to destroy220 );221 222 223 193 /** Evaluate 1D polynomial (double precision) */ 224 194 double -
trunk/psLib/src/dataManip/psStats.c
r1071 r1073 32 32 psStats *stats); 33 33 #endif 34 35 static void histogramFree(psHistogram *myHist); 34 36 35 37 /****************************************************************************** … … 68 70 69 71 /****************************************************************************** 70 psStatsFree(): This routine must free the psStats data structure.71 *****************************************************************************/72 void psStatsFree(psStats *stats)73 {74 psFree(stats);75 }76 77 /******************************************************************************78 72 psHistogramAlloc(lower, upper, n): allocate a uniform histogram structure 79 73 with the specifed upper and lower limits, and the specifed number of bins. … … 108 102 // bins, then there are N+1 bounds to those bins. 109 103 newHist = (psHistogram *) psAlloc(sizeof(psHistogram)); 104 p_psMemSetDeallocator(newHist,(psFreeFcn)histogramFree); 110 105 newHist->bounds = psVectorAlloc(n+1, PS_TYPE_F32); 111 106 newHist->bounds->n = newHist->bounds->nalloc; … … 160 155 // Allocate memory for the new histogram structure. 161 156 newHist = (psHistogram *) psAlloc(sizeof(psHistogram)); 157 p_psMemSetDeallocator(newHist,(psFreeFcn)histogramFree); 162 158 newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32); 163 159 newHist->bounds->n = newHist->bounds->nalloc; … … 182 178 } 183 179 184 void psHistogramFree(psHistogram *myHist) 185 { 186 psVectorFree(myHist->bounds); 187 psVectorFree(myHist->nums); 188 psFree(myHist); 180 static void histogramFree(psHistogram *myHist) 181 { 182 psFree(myHist->bounds); 183 psFree(myHist->nums); 189 184 } 190 185 … … 618 613 619 614 // Free temporary data buffers. 620 ps StatsFree(stats2);615 psFree(stats2); 621 616 622 617 // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure. … … 688 683 689 684 // Free the temporary data structures. 690 ps VectorFree(unsortedVector);691 ps VectorFree(sortedVector);685 psFree(unsortedVector); 686 psFree(sortedVector); 692 687 } 693 688 … … 775 770 776 771 // Free temporary data buffers. 777 ps StatsFree(stats2);772 psFree(stats2); 778 773 779 774 // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure. … … 840 835 841 836 // Free the temporary data structures. 842 ps VectorFree(unsortedVector);843 ps VectorFree(sortedVector);837 psFree(unsortedVector); 838 psFree(sortedVector); 844 839 // NOTE: This is the 845 840 } … … 1043 1038 } 1044 1039 1045 ps VectorFree(tmpMask);1040 psFree(tmpMask); 1046 1041 } 1047 1042 … … 1125 1120 stats->robustLQ = stats->clippedMean; 1126 1121 } 1127 ps StatsFree(tmpStats);1128 ps HistogramFree(robustHistogram);1122 psFree(tmpStats); 1123 psFree(robustHistogram); 1129 1124 return; 1130 1125 } … … 1200 1195 stats->robustNfit = 0.0; 1201 1196 stats->robustN50 = 0.0; 1202 ps StatsFree(tmpStats);1203 ps HistogramFree(robustHistogram);1197 psFree(tmpStats); 1198 psFree(robustHistogram); 1204 1199 } 1205 1200 -
trunk/psLib/src/dataManip/psStats.h
r1020 r1073 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-06- 14 19:33:09$11 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-06-23 23:00:15 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 88 88 psStats *psStatsAlloc(psStatsOptions options); ///< Statistics to measure 89 89 90 /** A destructor for the stats structure.*/91 void psStatsFree(psStats *restrict stats); ///< Stats structure to destroy92 93 90 /****************************************************************************** 94 91 Histogram functions and data structures. … … 116 113 psHistogram * psHistogramAllocGeneric(const psVector *restrict bounds); ///< Bounds for the bins 117 114 118 119 /** Destructor \ingroup MathGroup **/120 void psHistogramFree(psHistogram *myHist); ///< Histogram to destroy121 122 123 115 /** Calculate a histogram \ingroup MathGroup **/ 124 116 psHistogram *psHistogramVector (psHistogram *out, ///< Histogram data -
trunk/psLib/src/dataManip/psVectorFFT.c
r1010 r1073 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-06- 12 02:17:25 $7 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-06-23 23:00:15 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 35 35 /* got good image data? */ 36 36 if (in==NULL) { 37 ps ImageFree(out);37 psFree(out); 38 38 return NULL; 39 39 } … … 44 44 psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)", 45 45 type); 46 ps ImageFree(out);46 psFree(out); 47 47 return NULL; 48 48 } … … 51 51 psError(__func__,"Input image must be complex image for reverse FFT (type=%d).", 52 52 type); 53 ps ImageFree(out);53 psFree(out); 54 54 return NULL; 55 55 … … 76 76 if (plan == NULL) { 77 77 psError(__func__,"Failed to create FFTW plan."); 78 ps ImageFree(out);78 psFree(out); 79 79 return NULL; 80 80 } … … 98 98 99 99 if (in == NULL) { 100 ps ImageFree(out);100 psFree(out); 101 101 return NULL; 102 102 } … … 143 143 psError(__func__,"Can not extract real component from given image type (%d).", 144 144 type); 145 ps ImageFree(out);145 psFree(out); 146 146 return NULL; 147 147 } … … 158 158 159 159 if (in == NULL) { 160 ps ImageFree(out);160 psFree(out); 161 161 return NULL; 162 162 } … … 205 205 psError(__func__,"Can not extract imaginary component from given image type (%d).", 206 206 type); 207 ps ImageFree(out);207 psFree(out); 208 208 return NULL; 209 209 } … … 220 220 221 221 if (real == NULL || imag == NULL) { 222 ps ImageFree(out);222 psFree(out); 223 223 return NULL; 224 224 } … … 230 230 if (imag->type.type != type) { 231 231 psError(__func__,"The inputs to psImageComplex must be the same type."); 232 ps ImageFree(out);232 psFree(out); 233 233 return NULL; 234 234 } … … 237 237 imag->numRows != numRows) { 238 238 psError(__func__,"The inputs to psImageComplex must be the same dimensions."); 239 ps ImageFree(out);239 psFree(out); 240 240 return NULL; 241 241 } … … 243 243 if (PS_IS_PSELEMTYPE_COMPLEX(type)) { 244 244 psError(__func__,"The inputs to psImageComplex can not be complex."); 245 ps ImageFree(out);245 psFree(out); 246 246 return NULL; 247 247 } … … 249 249 if (type != PS_TYPE_F32 && type != PS_TYPE_F64) { 250 250 psError(__func__,"The input type to psImageComplex must be a floating point."); 251 ps ImageFree(out);251 psFree(out); 252 252 return NULL; 253 253 } … … 287 287 psError(__func__,"Can not merge real and imaginary portions for given image type (%d).", 288 288 type); 289 ps ImageFree(out);289 psFree(out); 290 290 return NULL; 291 291 } … … 302 302 303 303 if (in == NULL) { 304 ps ImageFree(out);304 psFree(out); 305 305 return NULL; 306 306 } … … 347 347 psError(__func__,"Can not compute complex conjugate for given image type (%d).", 348 348 type); 349 ps ImageFree(out);349 psFree(out); 350 350 return NULL; 351 351 } … … 362 362 363 363 if (in == NULL) { 364 ps ImageFree(out);364 psFree(out); 365 365 return NULL; 366 366 } … … 374 374 if (! PS_IS_PSELEMTYPE_COMPLEX(type)) { 375 375 psError(__func__,"Power Spectrum for non-complex inputs is not implemented."); 376 ps ImageFree(out);376 psFree(out); 377 377 return NULL; 378 378 } … … 417 417 psError(__func__,"Can not power spectrum for given image type (%d).", 418 418 type); 419 ps ImageFree(out);419 psFree(out); 420 420 return NULL; 421 421 } … … 435 435 /* got good image data? */ 436 436 if (in==NULL) { 437 ps VectorFree(out);437 psFree(out); 438 438 return NULL; 439 439 } … … 444 444 psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)", 445 445 type); 446 ps VectorFree(out);446 psFree(out); 447 447 return NULL; 448 448 } … … 451 451 psError(__func__,"Input image must be complex image for reverse FFT (type=%d).", 452 452 type); 453 ps VectorFree(out);453 psFree(out); 454 454 return NULL; 455 455 … … 491 491 if (plan == NULL) { 492 492 psError(__func__,"Failed to create FFTW plan."); 493 ps VectorFree(out);493 psFree(out); 494 494 return NULL; 495 495 } … … 510 510 511 511 if (in == NULL) { 512 ps VectorFree(out);512 psFree(out); 513 513 return NULL; 514 514 } … … 542 542 psError(__func__,"Can not extract real component from given vector type (%d).", 543 543 type); 544 ps VectorFree(out);544 psFree(out); 545 545 return NULL; 546 546 } … … 556 556 557 557 if (in == NULL) { 558 ps VectorFree(out);558 psFree(out); 559 559 return NULL; 560 560 } … … 588 588 psError(__func__,"Can not extract imaginary component from given vector type (%d).", 589 589 type); 590 ps VectorFree(out);590 psFree(out); 591 591 return NULL; 592 592 } … … 602 602 603 603 if (real == NULL || imag == NULL) { 604 ps VectorFree(out);604 psFree(out); 605 605 return NULL; 606 606 } … … 615 615 if (imag->type.type != type) { 616 616 psError(__func__,"The inputs to psVectorComplex must be the same type."); 617 ps VectorFree(out);617 psFree(out); 618 618 return NULL; 619 619 } … … 621 621 if (PS_IS_PSELEMTYPE_COMPLEX(type)) { 622 622 psError(__func__,"The inputs to psVectorComplex can not be complex."); 623 ps VectorFree(out);623 psFree(out); 624 624 return NULL; 625 625 } … … 640 640 psError(__func__,"Can not merge real and imaginary portions for given vector type (%d).", 641 641 type); 642 ps VectorFree(out);642 psFree(out); 643 643 return NULL; 644 644 } … … 654 654 655 655 if (in == NULL) { 656 ps VectorFree(out);656 psFree(out); 657 657 return NULL; 658 658 } … … 687 687 psError(__func__,"Can not compute complex conjugate for given vector type (%d).", 688 688 type); 689 ps VectorFree(out);689 psFree(out); 690 690 return NULL; 691 691 } … … 703 703 704 704 if (in == NULL) { 705 ps VectorFree(out);705 psFree(out); 706 706 return NULL; 707 707 } … … 716 716 if (! PS_IS_PSELEMTYPE_COMPLEX(type)) { 717 717 psError(__func__,"Power Spectrum for non-complex inputs is not implemented."); 718 ps VectorFree(out);718 psFree(out); 719 719 return NULL; 720 720 } … … 747 747 psError(__func__,"Can not power spectrum for given vector type (%d).", 748 748 type); 749 ps VectorFree(out);750 return NULL; 751 } 752 753 return out; 754 755 } 749 psFree(out); 750 return NULL; 751 } 752 753 return out; 754 755 } -
trunk/psLib/src/fft/psVectorFFT.c
r1010 r1073 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-06- 12 02:17:25 $7 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-06-23 23:00:15 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 35 35 /* got good image data? */ 36 36 if (in==NULL) { 37 ps ImageFree(out);37 psFree(out); 38 38 return NULL; 39 39 } … … 44 44 psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)", 45 45 type); 46 ps ImageFree(out);46 psFree(out); 47 47 return NULL; 48 48 } … … 51 51 psError(__func__,"Input image must be complex image for reverse FFT (type=%d).", 52 52 type); 53 ps ImageFree(out);53 psFree(out); 54 54 return NULL; 55 55 … … 76 76 if (plan == NULL) { 77 77 psError(__func__,"Failed to create FFTW plan."); 78 ps ImageFree(out);78 psFree(out); 79 79 return NULL; 80 80 } … … 98 98 99 99 if (in == NULL) { 100 ps ImageFree(out);100 psFree(out); 101 101 return NULL; 102 102 } … … 143 143 psError(__func__,"Can not extract real component from given image type (%d).", 144 144 type); 145 ps ImageFree(out);145 psFree(out); 146 146 return NULL; 147 147 } … … 158 158 159 159 if (in == NULL) { 160 ps ImageFree(out);160 psFree(out); 161 161 return NULL; 162 162 } … … 205 205 psError(__func__,"Can not extract imaginary component from given image type (%d).", 206 206 type); 207 ps ImageFree(out);207 psFree(out); 208 208 return NULL; 209 209 } … … 220 220 221 221 if (real == NULL || imag == NULL) { 222 ps ImageFree(out);222 psFree(out); 223 223 return NULL; 224 224 } … … 230 230 if (imag->type.type != type) { 231 231 psError(__func__,"The inputs to psImageComplex must be the same type."); 232 ps ImageFree(out);232 psFree(out); 233 233 return NULL; 234 234 } … … 237 237 imag->numRows != numRows) { 238 238 psError(__func__,"The inputs to psImageComplex must be the same dimensions."); 239 ps ImageFree(out);239 psFree(out); 240 240 return NULL; 241 241 } … … 243 243 if (PS_IS_PSELEMTYPE_COMPLEX(type)) { 244 244 psError(__func__,"The inputs to psImageComplex can not be complex."); 245 ps ImageFree(out);245 psFree(out); 246 246 return NULL; 247 247 } … … 249 249 if (type != PS_TYPE_F32 && type != PS_TYPE_F64) { 250 250 psError(__func__,"The input type to psImageComplex must be a floating point."); 251 ps ImageFree(out);251 psFree(out); 252 252 return NULL; 253 253 } … … 287 287 psError(__func__,"Can not merge real and imaginary portions for given image type (%d).", 288 288 type); 289 ps ImageFree(out);289 psFree(out); 290 290 return NULL; 291 291 } … … 302 302 303 303 if (in == NULL) { 304 ps ImageFree(out);304 psFree(out); 305 305 return NULL; 306 306 } … … 347 347 psError(__func__,"Can not compute complex conjugate for given image type (%d).", 348 348 type); 349 ps ImageFree(out);349 psFree(out); 350 350 return NULL; 351 351 } … … 362 362 363 363 if (in == NULL) { 364 ps ImageFree(out);364 psFree(out); 365 365 return NULL; 366 366 } … … 374 374 if (! PS_IS_PSELEMTYPE_COMPLEX(type)) { 375 375 psError(__func__,"Power Spectrum for non-complex inputs is not implemented."); 376 ps ImageFree(out);376 psFree(out); 377 377 return NULL; 378 378 } … … 417 417 psError(__func__,"Can not power spectrum for given image type (%d).", 418 418 type); 419 ps ImageFree(out);419 psFree(out); 420 420 return NULL; 421 421 } … … 435 435 /* got good image data? */ 436 436 if (in==NULL) { 437 ps VectorFree(out);437 psFree(out); 438 438 return NULL; 439 439 } … … 444 444 psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)", 445 445 type); 446 ps VectorFree(out);446 psFree(out); 447 447 return NULL; 448 448 } … … 451 451 psError(__func__,"Input image must be complex image for reverse FFT (type=%d).", 452 452 type); 453 ps VectorFree(out);453 psFree(out); 454 454 return NULL; 455 455 … … 491 491 if (plan == NULL) { 492 492 psError(__func__,"Failed to create FFTW plan."); 493 ps VectorFree(out);493 psFree(out); 494 494 return NULL; 495 495 } … … 510 510 511 511 if (in == NULL) { 512 ps VectorFree(out);512 psFree(out); 513 513 return NULL; 514 514 } … … 542 542 psError(__func__,"Can not extract real component from given vector type (%d).", 543 543 type); 544 ps VectorFree(out);544 psFree(out); 545 545 return NULL; 546 546 } … … 556 556 557 557 if (in == NULL) { 558 ps VectorFree(out);558 psFree(out); 559 559 return NULL; 560 560 } … … 588 588 psError(__func__,"Can not extract imaginary component from given vector type (%d).", 589 589 type); 590 ps VectorFree(out);590 psFree(out); 591 591 return NULL; 592 592 } … … 602 602 603 603 if (real == NULL || imag == NULL) { 604 ps VectorFree(out);604 psFree(out); 605 605 return NULL; 606 606 } … … 615 615 if (imag->type.type != type) { 616 616 psError(__func__,"The inputs to psVectorComplex must be the same type."); 617 ps VectorFree(out);617 psFree(out); 618 618 return NULL; 619 619 } … … 621 621 if (PS_IS_PSELEMTYPE_COMPLEX(type)) { 622 622 psError(__func__,"The inputs to psVectorComplex can not be complex."); 623 ps VectorFree(out);623 psFree(out); 624 624 return NULL; 625 625 } … … 640 640 psError(__func__,"Can not merge real and imaginary portions for given vector type (%d).", 641 641 type); 642 ps VectorFree(out);642 psFree(out); 643 643 return NULL; 644 644 } … … 654 654 655 655 if (in == NULL) { 656 ps VectorFree(out);656 psFree(out); 657 657 return NULL; 658 658 } … … 687 687 psError(__func__,"Can not compute complex conjugate for given vector type (%d).", 688 688 type); 689 ps VectorFree(out);689 psFree(out); 690 690 return NULL; 691 691 } … … 703 703 704 704 if (in == NULL) { 705 ps VectorFree(out);705 psFree(out); 706 706 return NULL; 707 707 } … … 716 716 if (! PS_IS_PSELEMTYPE_COMPLEX(type)) { 717 717 psError(__func__,"Power Spectrum for non-complex inputs is not implemented."); 718 ps VectorFree(out);718 psFree(out); 719 719 return NULL; 720 720 } … … 747 747 psError(__func__,"Can not power spectrum for given vector type (%d).", 748 748 type); 749 ps VectorFree(out);750 return NULL; 751 } 752 753 return out; 754 755 } 749 psFree(out); 750 return NULL; 751 } 752 753 return out; 754 755 } -
trunk/psLib/src/image/psImage.c
r996 r1073 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-06- 11 02:02:53$11 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-06-23 23:00:15 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 #include "psImage.h" 29 29 30 static void imageFree(psImage* image); 30 31 31 32 /*****************************************************************************/ … … 49 50 50 51 psImage *image = (psImage *)psAlloc(sizeof(psImage)); 52 p_psMemSetDeallocator(image,(psFreeFcn)imageFree); 51 53 52 54 image->data.V = psAlloc(sizeof(void*)*numRows); … … 71 73 } 72 74 73 void psImageFree(psImage *image)75 static void imageFree(psImage* image) 74 76 { 75 77 if (image == NULL) { … … 96 98 psFree(image->data.V); 97 99 image->data.V = NULL; 98 99 psFree(image);100 100 } 101 101 … … 237 237 if (children[i] != NULL) { 238 238 numFreed++; 239 ps ImageFree(children[i]);239 psFree(children[i]); 240 240 } 241 241 } … … 341 341 case PS_TYPE_PTR: \ 342 342 psError(__func__,"Can't copy image from a matrix of pointers."); \ 343 ps ImageFree(output); \343 psFree(output); \ 344 344 return NULL; \ 345 345 default: \ … … 391 391 case PS_TYPE_PTR: 392 392 psError(__func__,"Can't copy image into a matrix of pointers."); 393 ps ImageFree(output);393 psFree(output); 394 394 return NULL; 395 395 } … … 534 534 case PS_TYPE_PTR: 535 535 psError (__func__, "Can't copy image from a matrix of pointers."); 536 ps ImageFree (output);536 psFree (output); 537 537 return ((void *) 0); 538 538 default: … … 676 676 case PS_TYPE_PTR: 677 677 psError (__func__, "Can't copy image from a matrix of pointers."); 678 ps ImageFree (output);678 psFree (output); 679 679 return ((void *) 0); 680 680 default: … … 818 818 case PS_TYPE_PTR: 819 819 psError (__func__, "Can't copy image from a matrix of pointers."); 820 ps ImageFree (output);820 psFree (output); 821 821 return ((void *) 0); 822 822 default: … … 960 960 case PS_TYPE_PTR: 961 961 psError (__func__, "Can't copy image from a matrix of pointers."); 962 ps ImageFree (output);962 psFree (output); 963 963 return ((void *) 0); 964 964 default: … … 1102 1102 case PS_TYPE_PTR: 1103 1103 psError (__func__, "Can't copy image from a matrix of pointers."); 1104 ps ImageFree (output);1104 psFree (output); 1105 1105 return ((void *) 0); 1106 1106 default: … … 1244 1244 case PS_TYPE_PTR: 1245 1245 psError (__func__, "Can't copy image from a matrix of pointers."); 1246 ps ImageFree (output);1246 psFree (output); 1247 1247 return ((void *) 0); 1248 1248 default: … … 1386 1386 case PS_TYPE_PTR: 1387 1387 psError (__func__, "Can't copy image from a matrix of pointers."); 1388 ps ImageFree (output);1388 psFree (output); 1389 1389 return ((void *) 0); 1390 1390 default: … … 1528 1528 case PS_TYPE_PTR: 1529 1529 psError (__func__, "Can't copy image from a matrix of pointers."); 1530 ps ImageFree (output);1530 psFree (output); 1531 1531 return ((void *) 0); 1532 1532 default: … … 1670 1670 case PS_TYPE_PTR: 1671 1671 psError (__func__, "Can't copy image from a matrix of pointers."); 1672 ps ImageFree (output);1672 psFree (output); 1673 1673 return ((void *) 0); 1674 1674 default: … … 1812 1812 case PS_TYPE_PTR: 1813 1813 psError (__func__, "Can't copy image from a matrix of pointers."); 1814 ps ImageFree (output);1814 psFree (output); 1815 1815 return ((void *) 0); 1816 1816 default: … … 1954 1954 case PS_TYPE_PTR: 1955 1955 psError (__func__, "Can't copy image from a matrix of pointers."); 1956 ps ImageFree (output);1956 psFree (output); 1957 1957 return ((void *) 0); 1958 1958 default: … … 2096 2096 case PS_TYPE_PTR: 2097 2097 psError (__func__, "Can't copy image from a matrix of pointers."); 2098 ps ImageFree (output);2098 psFree (output); 2099 2099 return ((void *) 0); 2100 2100 default: … … 2104 2104 case PS_TYPE_PTR: 2105 2105 psError (__func__, "Can't copy image into a matrix of pointers."); 2106 ps ImageFree (output);2106 psFree (output); 2107 2107 return ((void *) 0); 2108 2108 } -
trunk/psLib/src/image/psImage.h
r974 r1073 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-06- 10 01:58:06$13 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-06-23 23:00:15 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 110 110 ); 111 111 112 /** Destroy the specified image.113 *114 * Uses psLib memory deallocation functions to free an image and any existing115 * children.116 *117 */118 void psImageFree(119 psImage *restrict image ///< Free psImage120 );121 122 112 /** Frees all children of a psImage. 123 113 * -
trunk/psLib/src/image/psImageIO.c
r997 r1073 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-06- 11 03:45:07$9 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-06-23 23:00:15 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 #include "psImageIO.h" 20 20 #include "psError.h" 21 #include "psMemory.h" 21 22 22 23 psImage* psImageReadSection(psImage* output, int col, int row, int numCols, … … 39 40 if (filename == NULL) { 40 41 psError(__func__,"Must specify filename; it can not be NULL."); 41 ps ImageFree(output);42 psFree(output); 42 43 return NULL; 43 44 } … … 49 50 psError(__func__,"Could not open file '%s'. (%s)", 50 51 filename, fitsErr); 51 ps ImageFree(output);52 psFree(output); 52 53 return NULL; 53 54 } … … 61 62 psError(__func__,"Could not index to '%s' HDU for file %s. (%s)", 62 63 extname, filename, fitsErr); 63 ps ImageFree(output);64 psFree(output); 64 65 return NULL; 65 66 } … … 71 72 psError(__func__,"Could not index to HDU #%d for file %s. (%s)", 72 73 extnum, filename, fitsErr); 73 ps ImageFree(output);74 psFree(output); 74 75 return NULL; 75 76 } … … 83 84 psError("Could not determine image data type of '%s'. (%s)", 84 85 filename, fitsErr); 85 ps ImageFree(output);86 psFree(output); 86 87 return NULL; 87 88 } … … 94 95 psError("Could not determine dimensions of '%s'. (%s)", 95 96 filename,fitsErr); 96 ps ImageFree(output);97 psFree(output); 97 98 return NULL; 98 99 } … … 104 105 psError("Dimensions of '%s' are not supported (NAXIS=%i).", 105 106 filename, nAxis); 106 ps ImageFree(output);107 psFree(output); 107 108 return NULL; 108 109 } … … 115 116 psError("Could not determine image size of '%s'. (%s)", 116 117 filename,fitsErr); 117 ps ImageFree(output);118 psFree(output); 118 119 return NULL; 119 120 } … … 181 182 psError(__func__,"Unsupported bitpix value (%d) in FITS file %s.", 182 183 bitPix,filename); 183 ps ImageFree(output);184 psFree(output); 184 185 return NULL; 185 186 } … … 187 188 if (fits_read_subset(fptr, fitsDatatype, firstPixel, lastPixel, increment, 188 189 NULL, output->data.V[0], &anynull, &status) != 0) { 189 ps ImageFree(output);190 psFree(output); 190 191 (void)fits_get_errstatus(status, fitsErr); 191 192 status = 0; -
trunk/psLib/src/image/psImageIO.d
r986 r1073 1 1 psImageIO.o psImageIO.d : psImageIO.c psImageIO.h ../collections/psImage.h \ 2 ../collections/psType.h ../sysUtils/psError.h 2 ../collections/psType.h ../sysUtils/psError.h ../sysUtils/psMemory.h -
trunk/psLib/src/image/psImageStats.c
r1072 r1073 67 67 68 68 stats = psVectorStats(stats, junkData, junkMask, maskVal); 69 ps VectorFree(junkMask);69 psFree(junkMask); 70 70 } else { 71 71 stats = psVectorStats(stats, junkData, NULL, 0); 72 72 } 73 ps VectorFree(junkData);73 psFree(junkData); 74 74 return(stats); 75 75 } … … 129 129 } 130 130 out = psHistogramVector(out, junkData, junkMask, maskVal); 131 ps VectorFree(junkMask);131 psFree(junkMask); 132 132 } else { 133 133 out = psHistogramVector(out, junkData, NULL, 0); 134 134 } 135 ps VectorFree(junkData);135 psFree(junkData); 136 136 137 137 return(out); … … 339 339 // Free the Chebyshev polynomials that were created in this routine. 340 340 for (i=0;i<maxChebyPoly;i++) { 341 ps Polynomial1DFree(chebPolys[i]);341 psFree(chebPolys[i]); 342 342 } 343 343 psFree(chebPolys); … … 413 413 // Free the Chebyshev polynomials that were created in this routine. 414 414 for (i=0;i<maxChebyPoly;i++) { 415 ps Polynomial1DFree(chebPolys[i]);415 psFree(chebPolys[i]); 416 416 } 417 417 psFree(chebPolys); -
trunk/psLib/src/imageops/psImageStats.c
r1072 r1073 67 67 68 68 stats = psVectorStats(stats, junkData, junkMask, maskVal); 69 ps VectorFree(junkMask);69 psFree(junkMask); 70 70 } else { 71 71 stats = psVectorStats(stats, junkData, NULL, 0); 72 72 } 73 ps VectorFree(junkData);73 psFree(junkData); 74 74 return(stats); 75 75 } … … 129 129 } 130 130 out = psHistogramVector(out, junkData, junkMask, maskVal); 131 ps VectorFree(junkMask);131 psFree(junkMask); 132 132 } else { 133 133 out = psHistogramVector(out, junkData, NULL, 0); 134 134 } 135 ps VectorFree(junkData);135 psFree(junkData); 136 136 137 137 return(out); … … 339 339 // Free the Chebyshev polynomials that were created in this routine. 340 340 for (i=0;i<maxChebyPoly;i++) { 341 ps Polynomial1DFree(chebPolys[i]);341 psFree(chebPolys[i]); 342 342 } 343 343 psFree(chebPolys); … … 413 413 // Free the Chebyshev polynomials that were created in this routine. 414 414 for (i=0;i<maxChebyPoly;i++) { 415 ps Polynomial1DFree(chebPolys[i]);415 psFree(chebPolys[i]); 416 416 } 417 417 psFree(chebPolys); -
trunk/psLib/src/math/psPolynomial.c
r1022 r1073 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-06- 14 19:40:14$9 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-06-23 23:00:15 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 #include <gsl/gsl_rng.h> 35 35 #include <gsl/gsl_randist.h> 36 37 static void polynomial1DFree(psPolynomial1D *myPoly); 38 static void polynomial2DFree(psPolynomial2D *myPoly); 39 static void polynomial3DFree(psPolynomial3D *myPoly); 40 static void polynomial4DFree(psPolynomial4D *myPoly); 41 static void dPolynomial1DFree(psDPolynomial1D *myPoly); 42 static void dPolynomial2DFree(psDPolynomial2D *myPoly); 43 static void dPolynomial3DFree(psDPolynomial3D *myPoly); 44 static void dPolynomial4DFree(psDPolynomial4D *myPoly); 45 36 46 /*****************************************************************************/ 37 47 /* FUNCTION IMPLEMENTATION - PUBLIC */ … … 108 118 109 119 newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D)); 120 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial1DFree); 110 121 newPoly->n = n; 111 122 newPoly->coeff = (float *) psAlloc(n * sizeof(float)); … … 128 139 129 140 newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D)); 141 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial2DFree); 130 142 newPoly->nX = nX; 131 143 newPoly->nY = nY; … … 158 170 159 171 newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D)); 172 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial3DFree); 160 173 newPoly->nX = nX; 161 174 newPoly->nY = nY; … … 197 210 198 211 newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D)); 212 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial4DFree); 199 213 newPoly->nW = nW; 200 214 newPoly->nX = nX; … … 235 249 } 236 250 237 void psPolynomial1DFree(psPolynomial1D *myPoly)251 static void polynomial1DFree(psPolynomial1D *myPoly) 238 252 { 239 253 psFree(myPoly->coeff); 240 254 psFree(myPoly->coeffErr); 241 255 psFree(myPoly->mask); 242 psFree(myPoly); 243 } 244 245 void psPolynomial2DFree(psPolynomial2D *myPoly) 256 } 257 258 static void polynomial2DFree(psPolynomial2D *myPoly) 246 259 { 247 260 int x = 0; … … 255 268 psFree(myPoly->coeffErr); 256 269 psFree(myPoly->mask); 257 258 psFree(myPoly); 259 } 260 261 void psPolynomial3DFree(psPolynomial3D *myPoly) 270 } 271 272 static void polynomial3DFree(psPolynomial3D *myPoly) 262 273 { 263 274 int x = 0; … … 278 289 psFree(myPoly->coeffErr); 279 290 psFree(myPoly->mask); 280 psFree(myPoly); 281 } 282 283 void psPolynomial4DFree(psPolynomial4D *myPoly) 291 } 292 293 static void polynomial4DFree(psPolynomial4D *myPoly) 284 294 { 285 295 int w = 0; … … 306 316 psFree(myPoly->coeffErr); 307 317 psFree(myPoly->mask); 308 psFree(myPoly);309 318 } 310 319 … … 434 443 435 444 newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D)); 445 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial1DFree); 436 446 newPoly->n = n; 437 447 newPoly->coeff = (double *) psAlloc(n * sizeof(double)); … … 454 464 455 465 newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D)); 466 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial2DFree); 456 467 newPoly->nX = nX; 457 468 newPoly->nY = nY; … … 484 495 485 496 newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D)); 497 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial3DFree); 486 498 newPoly->nX = nX; 487 499 newPoly->nY = nY; … … 523 535 524 536 newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D)); 537 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial4DFree); 525 538 newPoly->nW = nW; 526 539 newPoly->nX = nX; … … 561 574 } 562 575 563 void psDPolynomial1DFree(psDPolynomial1D *myPoly)576 static void dPolynomial1DFree(psDPolynomial1D *myPoly) 564 577 { 565 578 psFree(myPoly->coeff); 566 579 psFree(myPoly->coeffErr); 567 580 psFree(myPoly->mask); 568 psFree(myPoly); 569 } 570 571 void psDPolynomial2DFree(psDPolynomial2D *myPoly) 581 } 582 583 static void dPolynomial2DFree(psDPolynomial2D *myPoly) 572 584 { 573 585 int x = 0; … … 581 593 psFree(myPoly->coeffErr); 582 594 psFree(myPoly->mask); 583 584 psFree(myPoly); 585 } 586 587 void psDPolynomial3DFree(psDPolynomial3D *myPoly) 595 } 596 597 static void dPolynomial3DFree(psDPolynomial3D *myPoly) 588 598 { 589 599 int x = 0; … … 604 614 psFree(myPoly->coeffErr); 605 615 psFree(myPoly->mask); 606 psFree(myPoly); 607 } 608 609 void psDPolynomial4DFree(psDPolynomial4D *myPoly) 616 } 617 618 static void dPolynomial4DFree(psDPolynomial4D *myPoly) 610 619 { 611 620 int w = 0; … … 632 641 psFree(myPoly->coeffErr); 633 642 psFree(myPoly->mask); 634 psFree(myPoly);635 643 } 636 644 -
trunk/psLib/src/math/psPolynomial.h
r1020 r1073 12 12 * @author George Gusciora, MHPCC 13 13 * 14 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-06- 14 19:32:42$14 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-06-23 23:00:15 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 104 104 ); 105 105 106 /** Destructor */107 void psPolynomial1DFree(psPolynomial1D *myPoly ///< Polynomial to destroy108 );109 110 /** Destructor */111 void psPolynomial2DFree(psPolynomial2D *myPoly ///< Polynomial to destroy112 );113 /** Destructor */114 void psPolynomial3DFree(psPolynomial3D *myPoly ///< Polynomial to destroy115 );116 /** Destructor */117 void psPolynomial4DFree(psPolynomial4D *myPoly ///< Polynomial to destroy118 );119 120 121 106 /** Evaluate 1D polynomial */ 122 107 float … … 206 191 ); 207 192 208 209 /** Destructor */210 void psDPolynomial1DFree(psDPolynomial1D *myPoly ///< Polynomial to destroy211 );212 /** Destructor */213 void psDPolynomial2DFree(psDPolynomial2D *myPoly ///< Polynomial to destroy214 );215 /** Destructor */216 void psDPolynomial3DFree(psDPolynomial3D *myPoly ///< Polynomial to destroy217 );218 /** Destructor */219 void psDPolynomial4DFree(psDPolynomial4D *myPoly ///< Polynomial to destroy220 );221 222 223 193 /** Evaluate 1D polynomial (double precision) */ 224 194 double -
trunk/psLib/src/math/psSpline.c
r1022 r1073 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-06- 14 19:40:14$9 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-06-23 23:00:15 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 #include <gsl/gsl_rng.h> 35 35 #include <gsl/gsl_randist.h> 36 37 static void polynomial1DFree(psPolynomial1D *myPoly); 38 static void polynomial2DFree(psPolynomial2D *myPoly); 39 static void polynomial3DFree(psPolynomial3D *myPoly); 40 static void polynomial4DFree(psPolynomial4D *myPoly); 41 static void dPolynomial1DFree(psDPolynomial1D *myPoly); 42 static void dPolynomial2DFree(psDPolynomial2D *myPoly); 43 static void dPolynomial3DFree(psDPolynomial3D *myPoly); 44 static void dPolynomial4DFree(psDPolynomial4D *myPoly); 45 36 46 /*****************************************************************************/ 37 47 /* FUNCTION IMPLEMENTATION - PUBLIC */ … … 108 118 109 119 newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D)); 120 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial1DFree); 110 121 newPoly->n = n; 111 122 newPoly->coeff = (float *) psAlloc(n * sizeof(float)); … … 128 139 129 140 newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D)); 141 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial2DFree); 130 142 newPoly->nX = nX; 131 143 newPoly->nY = nY; … … 158 170 159 171 newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D)); 172 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial3DFree); 160 173 newPoly->nX = nX; 161 174 newPoly->nY = nY; … … 197 210 198 211 newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D)); 212 p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial4DFree); 199 213 newPoly->nW = nW; 200 214 newPoly->nX = nX; … … 235 249 } 236 250 237 void psPolynomial1DFree(psPolynomial1D *myPoly)251 static void polynomial1DFree(psPolynomial1D *myPoly) 238 252 { 239 253 psFree(myPoly->coeff); 240 254 psFree(myPoly->coeffErr); 241 255 psFree(myPoly->mask); 242 psFree(myPoly); 243 } 244 245 void psPolynomial2DFree(psPolynomial2D *myPoly) 256 } 257 258 static void polynomial2DFree(psPolynomial2D *myPoly) 246 259 { 247 260 int x = 0; … … 255 268 psFree(myPoly->coeffErr); 256 269 psFree(myPoly->mask); 257 258 psFree(myPoly); 259 } 260 261 void psPolynomial3DFree(psPolynomial3D *myPoly) 270 } 271 272 static void polynomial3DFree(psPolynomial3D *myPoly) 262 273 { 263 274 int x = 0; … … 278 289 psFree(myPoly->coeffErr); 279 290 psFree(myPoly->mask); 280 psFree(myPoly); 281 } 282 283 void psPolynomial4DFree(psPolynomial4D *myPoly) 291 } 292 293 static void polynomial4DFree(psPolynomial4D *myPoly) 284 294 { 285 295 int w = 0; … … 306 316 psFree(myPoly->coeffErr); 307 317 psFree(myPoly->mask); 308 psFree(myPoly);309 318 } 310 319 … … 434 443 435 444 newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D)); 445 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial1DFree); 436 446 newPoly->n = n; 437 447 newPoly->coeff = (double *) psAlloc(n * sizeof(double)); … … 454 464 455 465 newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D)); 466 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial2DFree); 456 467 newPoly->nX = nX; 457 468 newPoly->nY = nY; … … 484 495 485 496 newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D)); 497 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial3DFree); 486 498 newPoly->nX = nX; 487 499 newPoly->nY = nY; … … 523 535 524 536 newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D)); 537 p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial4DFree); 525 538 newPoly->nW = nW; 526 539 newPoly->nX = nX; … … 561 574 } 562 575 563 void psDPolynomial1DFree(psDPolynomial1D *myPoly)576 static void dPolynomial1DFree(psDPolynomial1D *myPoly) 564 577 { 565 578 psFree(myPoly->coeff); 566 579 psFree(myPoly->coeffErr); 567 580 psFree(myPoly->mask); 568 psFree(myPoly); 569 } 570 571 void psDPolynomial2DFree(psDPolynomial2D *myPoly) 581 } 582 583 static void dPolynomial2DFree(psDPolynomial2D *myPoly) 572 584 { 573 585 int x = 0; … … 581 593 psFree(myPoly->coeffErr); 582 594 psFree(myPoly->mask); 583 584 psFree(myPoly); 585 } 586 587 void psDPolynomial3DFree(psDPolynomial3D *myPoly) 595 } 596 597 static void dPolynomial3DFree(psDPolynomial3D *myPoly) 588 598 { 589 599 int x = 0; … … 604 614 psFree(myPoly->coeffErr); 605 615 psFree(myPoly->mask); 606 psFree(myPoly); 607 } 608 609 void psDPolynomial4DFree(psDPolynomial4D *myPoly) 616 } 617 618 static void dPolynomial4DFree(psDPolynomial4D *myPoly) 610 619 { 611 620 int w = 0; … … 632 641 psFree(myPoly->coeffErr); 633 642 psFree(myPoly->mask); 634 psFree(myPoly);635 643 } 636 644 -
trunk/psLib/src/math/psSpline.h
r1020 r1073 12 12 * @author George Gusciora, MHPCC 13 13 * 14 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-06- 14 19:32:42$14 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-06-23 23:00:15 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 104 104 ); 105 105 106 /** Destructor */107 void psPolynomial1DFree(psPolynomial1D *myPoly ///< Polynomial to destroy108 );109 110 /** Destructor */111 void psPolynomial2DFree(psPolynomial2D *myPoly ///< Polynomial to destroy112 );113 /** Destructor */114 void psPolynomial3DFree(psPolynomial3D *myPoly ///< Polynomial to destroy115 );116 /** Destructor */117 void psPolynomial4DFree(psPolynomial4D *myPoly ///< Polynomial to destroy118 );119 120 121 106 /** Evaluate 1D polynomial */ 122 107 float … … 206 191 ); 207 192 208 209 /** Destructor */210 void psDPolynomial1DFree(psDPolynomial1D *myPoly ///< Polynomial to destroy211 );212 /** Destructor */213 void psDPolynomial2DFree(psDPolynomial2D *myPoly ///< Polynomial to destroy214 );215 /** Destructor */216 void psDPolynomial3DFree(psDPolynomial3D *myPoly ///< Polynomial to destroy217 );218 /** Destructor */219 void psDPolynomial4DFree(psDPolynomial4D *myPoly ///< Polynomial to destroy220 );221 222 223 193 /** Evaluate 1D polynomial (double precision) */ 224 194 double -
trunk/psLib/src/math/psStats.c
r1071 r1073 32 32 psStats *stats); 33 33 #endif 34 35 static void histogramFree(psHistogram *myHist); 34 36 35 37 /****************************************************************************** … … 68 70 69 71 /****************************************************************************** 70 psStatsFree(): This routine must free the psStats data structure.71 *****************************************************************************/72 void psStatsFree(psStats *stats)73 {74 psFree(stats);75 }76 77 /******************************************************************************78 72 psHistogramAlloc(lower, upper, n): allocate a uniform histogram structure 79 73 with the specifed upper and lower limits, and the specifed number of bins. … … 108 102 // bins, then there are N+1 bounds to those bins. 109 103 newHist = (psHistogram *) psAlloc(sizeof(psHistogram)); 104 p_psMemSetDeallocator(newHist,(psFreeFcn)histogramFree); 110 105 newHist->bounds = psVectorAlloc(n+1, PS_TYPE_F32); 111 106 newHist->bounds->n = newHist->bounds->nalloc; … … 160 155 // Allocate memory for the new histogram structure. 161 156 newHist = (psHistogram *) psAlloc(sizeof(psHistogram)); 157 p_psMemSetDeallocator(newHist,(psFreeFcn)histogramFree); 162 158 newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32); 163 159 newHist->bounds->n = newHist->bounds->nalloc; … … 182 178 } 183 179 184 void psHistogramFree(psHistogram *myHist) 185 { 186 psVectorFree(myHist->bounds); 187 psVectorFree(myHist->nums); 188 psFree(myHist); 180 static void histogramFree(psHistogram *myHist) 181 { 182 psFree(myHist->bounds); 183 psFree(myHist->nums); 189 184 } 190 185 … … 618 613 619 614 // Free temporary data buffers. 620 ps StatsFree(stats2);615 psFree(stats2); 621 616 622 617 // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure. … … 688 683 689 684 // Free the temporary data structures. 690 ps VectorFree(unsortedVector);691 ps VectorFree(sortedVector);685 psFree(unsortedVector); 686 psFree(sortedVector); 692 687 } 693 688 … … 775 770 776 771 // Free temporary data buffers. 777 ps StatsFree(stats2);772 psFree(stats2); 778 773 779 774 // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure. … … 840 835 841 836 // Free the temporary data structures. 842 ps VectorFree(unsortedVector);843 ps VectorFree(sortedVector);837 psFree(unsortedVector); 838 psFree(sortedVector); 844 839 // NOTE: This is the 845 840 } … … 1043 1038 } 1044 1039 1045 ps VectorFree(tmpMask);1040 psFree(tmpMask); 1046 1041 } 1047 1042 … … 1125 1120 stats->robustLQ = stats->clippedMean; 1126 1121 } 1127 ps StatsFree(tmpStats);1128 ps HistogramFree(robustHistogram);1122 psFree(tmpStats); 1123 psFree(robustHistogram); 1129 1124 return; 1130 1125 } … … 1200 1195 stats->robustNfit = 0.0; 1201 1196 stats->robustN50 = 0.0; 1202 ps StatsFree(tmpStats);1203 ps HistogramFree(robustHistogram);1197 psFree(tmpStats); 1198 psFree(robustHistogram); 1204 1199 } 1205 1200 -
trunk/psLib/src/math/psStats.h
r1020 r1073 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-06- 14 19:33:09$11 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-06-23 23:00:15 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 88 88 psStats *psStatsAlloc(psStatsOptions options); ///< Statistics to measure 89 89 90 /** A destructor for the stats structure.*/91 void psStatsFree(psStats *restrict stats); ///< Stats structure to destroy92 93 90 /****************************************************************************** 94 91 Histogram functions and data structures. … … 116 113 psHistogram * psHistogramAllocGeneric(const psVector *restrict bounds); ///< Bounds for the bins 117 114 118 119 /** Destructor \ingroup MathGroup **/120 void psHistogramFree(psHistogram *myHist); ///< Histogram to destroy121 122 123 115 /** Calculate a histogram \ingroup MathGroup **/ 124 116 psHistogram *psHistogramVector (psHistogram *out, ///< Histogram data -
trunk/psLib/src/mathtypes/psImage.c
r996 r1073 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-06- 11 02:02:53$11 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-06-23 23:00:15 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 #include "psImage.h" 29 29 30 static void imageFree(psImage* image); 30 31 31 32 /*****************************************************************************/ … … 49 50 50 51 psImage *image = (psImage *)psAlloc(sizeof(psImage)); 52 p_psMemSetDeallocator(image,(psFreeFcn)imageFree); 51 53 52 54 image->data.V = psAlloc(sizeof(void*)*numRows); … … 71 73 } 72 74 73 void psImageFree(psImage *image)75 static void imageFree(psImage* image) 74 76 { 75 77 if (image == NULL) { … … 96 98 psFree(image->data.V); 97 99 image->data.V = NULL; 98 99 psFree(image);100 100 } 101 101 … … 237 237 if (children[i] != NULL) { 238 238 numFreed++; 239 ps ImageFree(children[i]);239 psFree(children[i]); 240 240 } 241 241 } … … 341 341 case PS_TYPE_PTR: \ 342 342 psError(__func__,"Can't copy image from a matrix of pointers."); \ 343 ps ImageFree(output); \343 psFree(output); \ 344 344 return NULL; \ 345 345 default: \ … … 391 391 case PS_TYPE_PTR: 392 392 psError(__func__,"Can't copy image into a matrix of pointers."); 393 ps ImageFree(output);393 psFree(output); 394 394 return NULL; 395 395 } … … 534 534 case PS_TYPE_PTR: 535 535 psError (__func__, "Can't copy image from a matrix of pointers."); 536 ps ImageFree (output);536 psFree (output); 537 537 return ((void *) 0); 538 538 default: … … 676 676 case PS_TYPE_PTR: 677 677 psError (__func__, "Can't copy image from a matrix of pointers."); 678 ps ImageFree (output);678 psFree (output); 679 679 return ((void *) 0); 680 680 default: … … 818 818 case PS_TYPE_PTR: 819 819 psError (__func__, "Can't copy image from a matrix of pointers."); 820 ps ImageFree (output);820 psFree (output); 821 821 return ((void *) 0); 822 822 default: … … 960 960 case PS_TYPE_PTR: 961 961 psError (__func__, "Can't copy image from a matrix of pointers."); 962 ps ImageFree (output);962 psFree (output); 963 963 return ((void *) 0); 964 964 default: … … 1102 1102 case PS_TYPE_PTR: 1103 1103 psError (__func__, "Can't copy image from a matrix of pointers."); 1104 ps ImageFree (output);1104 psFree (output); 1105 1105 return ((void *) 0); 1106 1106 default: … … 1244 1244 case PS_TYPE_PTR: 1245 1245 psError (__func__, "Can't copy image from a matrix of pointers."); 1246 ps ImageFree (output);1246 psFree (output); 1247 1247 return ((void *) 0); 1248 1248 default: … … 1386 1386 case PS_TYPE_PTR: 1387 1387 psError (__func__, "Can't copy image from a matrix of pointers."); 1388 ps ImageFree (output);1388 psFree (output); 1389 1389 return ((void *) 0); 1390 1390 default: … … 1528 1528 case PS_TYPE_PTR: 1529 1529 psError (__func__, "Can't copy image from a matrix of pointers."); 1530 ps ImageFree (output);1530 psFree (output); 1531 1531 return ((void *) 0); 1532 1532 default: … … 1670 1670 case PS_TYPE_PTR: 1671 1671 psError (__func__, "Can't copy image from a matrix of pointers."); 1672 ps ImageFree (output);1672 psFree (output); 1673 1673 return ((void *) 0); 1674 1674 default: … … 1812 1812 case PS_TYPE_PTR: 1813 1813 psError (__func__, "Can't copy image from a matrix of pointers."); 1814 ps ImageFree (output);1814 psFree (output); 1815 1815 return ((void *) 0); 1816 1816 default: … … 1954 1954 case PS_TYPE_PTR: 1955 1955 psError (__func__, "Can't copy image from a matrix of pointers."); 1956 ps ImageFree (output);1956 psFree (output); 1957 1957 return ((void *) 0); 1958 1958 default: … … 2096 2096 case PS_TYPE_PTR: 2097 2097 psError (__func__, "Can't copy image from a matrix of pointers."); 2098 ps ImageFree (output);2098 psFree (output); 2099 2099 return ((void *) 0); 2100 2100 default: … … 2104 2104 case PS_TYPE_PTR: 2105 2105 psError (__func__, "Can't copy image into a matrix of pointers."); 2106 ps ImageFree (output);2106 psFree (output); 2107 2107 return ((void *) 0); 2108 2108 } -
trunk/psLib/src/mathtypes/psImage.h
r974 r1073 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-06- 10 01:58:06$13 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-06-23 23:00:15 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 110 110 ); 111 111 112 /** Destroy the specified image.113 *114 * Uses psLib memory deallocation functions to free an image and any existing115 * children.116 *117 */118 void psImageFree(119 psImage *restrict image ///< Free psImage120 );121 122 112 /** Frees all children of a psImage. 123 113 * -
trunk/psLib/src/mathtypes/psVector.c
r1008 r1073 8 8 * @author Ross Harman, MHPCC 9 9 * 10 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-06- 12 01:33:16$10 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-06-23 23:00:15 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 49 49 /* FUNCTION IMPLEMENTATION - LOCAL */ 50 50 /*****************************************************************************/ 51 static void vectorFree(psVector *restrict psVec); 51 52 52 53 /*****************************************************************************/ … … 68 69 // Create vector struct 69 70 psVec = (psVector *)psAlloc(sizeof(psVector)); 71 p_psMemSetDeallocator(psVec,(psFreeFcn)vectorFree); 70 72 71 73 psVec->type.dimen = PS_DIMEN_VECTOR; … … 132 134 if(nalloc < 1) { 133 135 psError(__func__, "Invalid value for nalloc (%d)\n", nalloc); 134 ps VectorFree(in);136 psFree(in); 135 137 return NULL; 136 138 } … … 154 156 } 155 157 156 void psVectorFree(psVector *restrict psVec)158 static void vectorFree(psVector *restrict psVec) 157 159 { 158 160 if (psVec == NULL) { … … 160 162 } 161 163 164 if (psVec->type.type == PS_TYPE_PTR) { 165 for(int i = 0; i < psVec->n; i++) { 166 psFree(psVec->data.PTR[i]); 167 psVec->data.PTR[i] = NULL; 168 } 169 } 170 162 171 psFree(psVec->data.V); 163 psFree(psVec);164 172 } 165 173 166 void psVectorElementFree(psVector *restrict psVec , void (*elemFree)(void *))174 void psVectorElementFree(psVector *restrict psVec) 167 175 { 168 176 … … 176 184 } 177 185 178 for(int i = 0; i < psVec->nalloc; i++) { 179 if(elemFree == NULL) { 180 psMemDecrRefCounter(psVec->data.PTR[i]); 181 } else { 182 elemFree(psMemDecrRefCounter(psVec->data.PTR[i])); 183 } 186 for(int i = 0; i < psVec->n; i++) { 187 psFree(psVec->data.PTR[i]); 184 188 psVec->data.PTR[i] = NULL; 185 189 } -
trunk/psLib/src/mathtypes/psVector.h
r974 r1073 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-06- 10 01:58:06$13 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-06-23 23:00:15 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 100 100 ); 101 101 102 /** Deallocate a vector.103 *104 * Uses psLib memory allocation functions to deallocate a vector collection of data. The vector is deallocated105 * according to the psType type member contained within the vector.106 *107 * @return psVector*: Pointer to psVector.108 *109 */110 void psVectorFree(111 psVector *restrict psVec ///< Vector to free.112 );113 114 115 102 /** Deallocate/Dereference elements of a void pointer vector. 116 103 * … … 122 109 */ 123 110 void psVectorElementFree( 124 psVector *restrict psVec, ///< Void pointer vector to destroy. 125 void (*elemFree)(void *) ///< Optional callback function to remove vector elements. 111 psVector *restrict psVec ///< Void pointer vector to destroy. 126 112 ); 127 113 -
trunk/psLib/src/sys/psMemory.c
r876 r1073 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-06- 04 23:46:48$10 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-06-23 23:00:15 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 30 30 static int checkMemBlock(const psMemBlock *m, const char* funcName); 31 31 static psMemBlock *lastMemBlockAllocated = NULL; 32 pthread_mutex_tmemBlockListMutex = PTHREAD_MUTEX_INITIALIZER;33 pthread_mutex_tmemIdMutex = PTHREAD_MUTEX_INITIALIZER;32 static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER; 33 static pthread_mutex_t memIdMutex = PTHREAD_MUTEX_INITIALIZER; 34 34 35 35 /** … … 96 96 psMemoryId p_psMemFreeID = 0; // notify user this block is freed 97 97 98 psMemoryId psMemAllocateCallbackSetID(psMemoryId id) // set p_psMemAllocateID to id98 psMemoryId psMemAllocateCallbackSetID(psMemoryId id) 99 99 { 100 100 psMemoryId old = p_psMemAllocateID; … … 104 104 } 105 105 106 psMemoryId psMemFreeCallbackSetID(psMemoryId id) // set p_psMemFreeID to id106 psMemoryId psMemFreeCallbackSetID(psMemoryId id) 107 107 { 108 108 psMemoryId old = p_psMemFreeID; … … 184 184 #define ALIGNED(P) ((void *)((long)(P) & ~03) == (P)) 185 185 186 static int 187 checkMemBlock(const psMemBlock *m, 188 const char* funcName) 186 static int checkMemBlock(const psMemBlock *m, const char* funcName) 189 187 { 190 188 // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked, … … 260 258 261 259 ptr->file = file; 260 ptr->freeFcn = NULL; 262 261 *(unsigned int*)&ptr->lineno = lineno; 263 262 ptr->startblock = P_PS_MEMMAGIC; … … 346 345 if (checkMemBlock(ptr, __func__) != 0) { 347 346 memProblemCallback(ptr, file, lineno); // we may not own this block; don't free it 348 } 349 350 psMemDecrRefCounter(vptr); // this handles the free, if required. 347 return; 348 } 349 350 (void)psMemDecrRefCounter(vptr); // this handles the free, if required. 351 351 } 352 352 … … 354 354 * Check for memory leaks. Not production quality code 355 355 */ 356 int psMemCheckLeaks( 357 psMemoryId id0, // don't list blocks with id < id0 358 psMemBlock ***arr, // pointer to array of pointers to leaked blocks, or NULL 359 FILE *fd) // print list of leaks to fd (or NULL) 356 int psMemCheckLeaks(psMemoryId id0,psMemBlock ***arr,FILE *fd) 360 357 { 361 358 int nleak = 0; … … 365 362 pthread_mutex_lock(&memBlockListMutex); 366 363 367 for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) 368 { 364 for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) { 369 365 if ( (psMemGetRefCounter(iter+1) > 0) && (iter->id >= id0) ) { 370 366 nleak++; … … 382 378 pthread_mutex_unlock(&memBlockListMutex); 383 379 384 if (nleak == 0 || arr == NULL) 385 { 380 if (nleak == 0 || arr == NULL) { 386 381 return nleak; 387 382 } … … 390 385 pthread_mutex_lock(&memBlockListMutex); 391 386 392 for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) 393 { 387 for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) { 394 388 if ( (psMemGetRefCounter(iter+1) > 0) && (iter->id >= id0) ) { 395 389 (*arr)[j++] = iter; … … 408 402 * Reference counting APIs 409 403 */ 410 psReferenceCount psMemGetRefCounter(void *vptr) // return refCounter 404 // return refCounter 405 psReferenceCount psMemGetRefCounter(void *vptr) 411 406 { 412 407 psMemBlock *ptr; 413 408 unsigned int refCount; 414 409 415 if (vptr == NULL) 416 { 410 if (vptr == NULL) { 417 411 return 0; 418 412 } … … 420 414 ptr = ((psMemBlock *)vptr) - 1; 421 415 422 if (checkMemBlock(ptr, __func__) != 0) 423 { 416 if (checkMemBlock(ptr, __func__) != 0) { 424 417 memProblemCallback(ptr, __func__, __LINE__); 425 418 } … … 431 424 return refCount; 432 425 } 433 434 void *psMemIncrRefCounter(void *vptr) // increment and return refCounter426 // increment and return refCounter 427 void *psMemIncrRefCounter(void *vptr) 435 428 { 436 429 psMemBlock *ptr; 437 430 438 if (vptr == NULL) 439 { 431 if (vptr == NULL) { 440 432 return vptr; 441 433 } … … 443 435 ptr = ((psMemBlock *)vptr) - 1; 444 436 445 if (checkMemBlock(ptr, __func__)) 446 { 437 if (checkMemBlock(ptr, __func__)) { 447 438 memProblemCallback(ptr, __func__, __LINE__); 448 439 } … … 455 446 } 456 447 457 void *psMemDecrRefCounter(void *vptr)// decrement and return refCounter458 { 459 if (vptr == NULL) 460 {448 // decrement and return refCounter 449 void *psMemDecrRefCounter(void *vptr) 450 { 451 if (vptr == NULL) { 461 452 return NULL; 462 453 } … … 467 458 pthread_mutex_lock(&ptr->refCounterMutex); 468 459 469 if (ptr->refCounter > 1) 470 { 460 if (ptr->refCounter > 1) { 471 461 /// XXX - Probably should have another mutex here. 472 462 ptr->refCounter--; // multiple references, just decrement the count. 473 463 pthread_mutex_unlock(&ptr->refCounterMutex); 474 464 475 } else 476 { 465 } else { 477 466 pthread_mutex_unlock(&ptr->refCounterMutex); 478 467 … … 482 471 } 483 472 473 if (ptr->freeFcn != NULL) { 474 ptr->freeFcn(vptr); 475 } 476 484 477 pthread_mutex_lock(&memBlockListMutex); 485 478 … … 507 500 } 508 501 509 void p_psCustomFree(psFreeFcn fcn, void* ptr) 510 { 511 512 if (fcn == NULL) { 502 void p_psMemSetDeallocator(void* vptr, psFreeFcn freeFcn) 503 { 504 if (vptr == NULL) { 513 505 return; 514 } else { 515 if (fcn == PS_FREE) { 516 psFree(ptr); 517 } else { 518 fcn(ptr); 519 } 520 } 521 } 506 } 507 508 psMemBlock *ptr = ((psMemBlock *)vptr) - 1; 509 510 ptr->freeFcn = freeFcn; 511 512 } 513 psFreeFcn p_psMemGetDeallocator(void* vptr) 514 { 515 if (vptr == NULL) { 516 return NULL; 517 } 518 519 psMemBlock *ptr = ((psMemBlock *)vptr) - 1; 520 521 return ptr->freeFcn; 522 } -
trunk/psLib/src/sys/psMemory.h
r978 r1073 14 14 * @ingroup MemoryManagement 15 15 * 16 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-06- 10 02:09:57$16 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-06-23 23:00:15 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 /// typedef for a memory block's reference count. Guaranteed to be some variety of integer. 51 51 typedef unsigned long psReferenceCount; 52 53 /// typedef for deallocator. 54 typedef void (*psFreeFcn)(void* ptr); 52 55 53 56 /** Book-keeping data for storage allocator. … … 58 61 typedef struct psMemBlock 59 62 { 60 const void* startblock; ///< initialised to p_psMEMMAGIC 61 struct psMemBlock* previousBlock; ///< previous block in allocation list 62 struct psMemBlock* nextBlock; ///< next block allocation list 63 size_t userMemorySize; ///< the size of the user-portion of the memory block 64 const psMemoryId id; ///< a unique ID for this allocation 65 const char* file; ///< set from __FILE__ in e.g. p_psAlloc 66 const int lineno; ///< set from __LINE__ in e.g. p_psAlloc 67 pthread_mutex_t refCounterMutex; ///< mutex to ensure exclusive access to reference counter 68 psReferenceCount refCounter; ///< how many times pointer is referenced 69 const void* endblock; ///< initialised to p_psMEMMAGIC 63 const void* startblock; ///< initialised to p_psMEMMAGIC 64 struct psMemBlock* previousBlock; ///< previous block in allocation list 65 struct psMemBlock* nextBlock; ///< next block allocation list 66 psFreeFcn freeFcn; ///< deallocator. If NULL, use generic deallocation. 67 size_t userMemorySize; ///< the size of the user-portion of the memory block 68 const psMemoryId id; ///< a unique ID for this allocation 69 const char* file; ///< set from __FILE__ in e.g. p_psAlloc 70 const int lineno; ///< set from __LINE__ in e.g. p_psAlloc 71 pthread_mutex_t refCounterMutex; ///< mutex to ensure exclusive access to reference counter 72 psReferenceCount refCounter; ///< how many times pointer is referenced 73 const void* endblock; ///< initialised to p_psMEMMAGIC 70 74 } 71 75 psMemBlock; … … 114 118 ); 115 119 116 typedef void (*psFreeFcn)(void* ptr);117 118 120 /** Memory allocation. This operates much like malloc(), but is guaranteed to return a non-NULL value. 119 121 * 120 122 * @return void* pointer to the allocated buffer. This will not be NULL. 121 * @see psFree 123 * @see psFree 122 124 */ 123 125 #ifdef DOXYGEN … … 131 133 int lineno ///< Line number of call 132 134 ); 135 136 void p_psMemSetDeallocator(void* ptr, psFreeFcn freeFcn); 137 psFreeFcn p_psMemGetDeallocator(void* ptr); 138 133 139 /// Memory allocation. psAlloc sends file and line number to p_psAlloc. 134 140 #define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__) … … 282 288 ); 283 289 284 #define PS_FREE (void*)1285 286 290 //@} End of Memory Management Functions 287 291 288 289 292 #ifndef DOXYGEN 290 291 void p_psCustomFree(psFreeFcn fcn,void* ptr);292 293 293 294 /* -
trunk/psLib/src/sysUtils/psHash.c
r964 r1073 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 10 00:09:55 $12 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #include <stdio.h> 19 19 #include <string.h> 20 #include <stdbool.h> 20 21 #include "psHash.h" 21 22 #include "psMemory.h" … … 24 25 #include "psAbort.h" 25 26 27 static psHashBucket *hashBucketAlloc(const char *key,void *data,psHashBucket *next); 28 static void hashBucketFree(psHashBucket *bucket); 29 static void *doHashWork(psHash* table, const char* key, void* data, bool remove 30 ); 31 static void hashFree(psHash *table); 26 32 27 33 /****************************************************************************** … … 87 93 // Allocate memory for the new hash bucket. 88 94 psHashBucket *bucket = psAlloc(sizeof(psHashBucket)); 95 p_psMemSetDeallocator(bucket,(psFreeFcn)hashBucketFree); 89 96 90 97 // Initialize the bucket. … … 105 112 106 113 /****************************************************************************** 107 hashBucketFree(bucket, itemFree): This procedure deallocates the specified 108 hash bucket. If "itemFree" is NULL, then we simply free the data with the 109 standard psFree() function. If "itemFree" is not NULL, then it must be a 110 function pointer which takes the hash bucket as a parameter, and frees the 111 data in that hash bucket. 114 hashBucketFree(bucket): This procedure deallocates the specified 115 hash bucket. 112 116 Inputs: 113 117 bucket: the hash bucket to be freed. 114 itemFree: a function pointer, possibly NULL.115 118 Return: 116 119 NONE 117 120 *****************************************************************************/ 118 static void hashBucketFree(psHashBucket *bucket, // bucket to free 119 void (*itemFree)(void *item)) // how to free data; 120 { 121 if (bucket == NULL) 122 { 121 static void hashBucketFree(psHashBucket *bucket) 122 { 123 if (bucket == NULL) { 123 124 return; 124 125 } … … 126 127 // A bucket is actually a linked list of buckets. We recursively step 127 128 // through that linked list, free each bucket. 128 if (bucket->next != NULL) 129 { 130 hashBucketFree(bucket, itemFree); 131 } 129 psFree(bucket->next); 132 130 133 131 psFree(bucket->key); 134 psMemDecrRefCounter(bucket->data); 135 136 if (itemFree != NULL) 137 { 138 itemFree(bucket->data); 139 } else 140 { 141 psFree(bucket->data); 142 } 143 144 psFree(bucket); 132 133 psFree(bucket->data); 145 134 } 146 135 … … 159 148 // Create the new hash table. 160 149 psHash *table = psAlloc(sizeof(psHash)); 150 p_psMemSetDeallocator(table,(psFreeFcn)hashFree); 161 151 162 152 // Allocate memory for the buckets. … … 185 175 Inputs: 186 176 table: a hash table 187 itemFree: a function pointer, possibly NULL.188 177 Return: 189 178 NONE 190 179 *****************************************************************************/ 191 void psHashFree(psHash *table, // hash table to be freed 192 void (*itemFree)(void *item)) // how to free hashed data; or NULL 180 static void hashFree(psHash *table) 193 181 { 194 182 psHashBucket *tmp = NULL; // Used to step through linked list. … … 196 184 int i = 0; // Loop index variable. 197 185 198 if (table == NULL) 199 { 186 if (table == NULL) { 200 187 return; 201 188 } … … 204 191 // NULL, then free the bucket via a function call to hashBucketFree(); 205 192 206 for (i = 0; i < table->nbucket; i++) 207 { 193 for (i = 0; i < table->nbucket; i++) { 208 194 // A bucket is composed of a linked list of buckets. We use the 209 195 // "tmp" and "ptr" pointers to step through that list and free each … … 214 200 while (ptr != NULL) { 215 201 tmp = ptr->next; 216 hashBucketFree(ptr, itemFree);202 psFree(ptr); 217 203 ptr = tmp; 218 204 } … … 222 208 // Free the bucket structure, then the hash table. 223 209 psFree(table->buckets); 224 psFree(table); 225 } 226 227 /****************************************************************************** 228 doHashWork(table, key, data, remove, itemFree): This is an internal 210 } 211 212 /****************************************************************************** 213 doHashWork(table, key, data, remove): This is an internal 229 214 procedure which does the bulk of the work in using the hash table. Depending 230 215 upon the input parameters, it will either insert a new key/data into the hash 231 216 table, retrieve the data for a specified key, or remove a key/data item. If 232 we try to insert a key that already exists in the hash table, then we call 233 the user-supplied function itemfree (or psFree if that is NULL), to free the 234 existing data/key item. 217 we try to insert a key that already exists in the hash table, then we deallocate 218 the existing data/key item. 235 219 Inputs: 236 220 table: a hash table … … 238 222 data: the data to insert, if not NULL 239 223 remove: set to non-zero if the key/data should be removed from the table. 240 itemFree: function pointer241 224 Return: 242 225 NONE … … 246 229 there is little common code between those functions. 247 230 *****************************************************************************/ 248 static void *doHashWork(psHash *table, // table to insert in 249 const char *key, // key to use 250 void *data, // data to insert, or (if NULL) retrieve/remove 251 int remove 252 , // remove the item from the list? 253 void (*itemFree)(void *item)) // how to free hashed data 231 static void *doHashWork(psHash *table, const char *key, void *data, bool remove 232 ) 254 233 { 255 234 long int hash = 1; // This will contain an integer value … … 313 292 } 314 293 315 psFree(ptr->key);316 294 psFree(ptr); 317 295 318 296 // By definition, the data associated with that key 319 297 // must be returned, not freed. 320 return psMemDecrRefCounter(data);298 return data; 321 299 } 322 300 optr = ptr; … … 354 332 // the new data was not inserted into the hash table. 355 333 356 if (itemFree == NULL) { 357 psFree(psMemDecrRefCounter(ptr->data)); 358 } else { 359 itemFree(psMemDecrRefCounter(ptr->data)); 360 } 334 psFree(ptr->data); 361 335 362 336 ptr->data = psMemIncrRefCounter(data); … … 385 359 NONE 386 360 *****************************************************************************/ 387 void *psHashInsert(psHash *table, // table to insert in 388 const char *key, // key to use 389 void *data, // data to insert 390 void (*itemFree)(void *item)) // how to free hashed data; 361 void *psHashInsert(psHash *table, const char *key, void *data) 391 362 { 392 363 if (table == NULL) { … … 400 371 } 401 372 402 return doHashWork(table, key, data, 0 , itemFree);373 return doHashWork(table, key, data, 0); 403 374 } 404 375 … … 425 396 426 397 427 return doHashWork(table, key, NULL, 0 , NULL);398 return doHashWork(table, key, NULL, 0); 428 399 } 429 400 … … 438 409 The data that was associated with that key. 439 410 *****************************************************************************/ 440 void *psHashRemove(psHash *table, // table to lookup key in 441 const char *key, // key to lookup 442 void (*itemFree)(void *item)) // how to free hashed data; 411 void *psHashRemove(psHash *table, const char *key) 443 412 { 444 413 if (table == NULL) { … … 449 418 } 450 419 451 return doHashWork(table, key, NULL, 1 , itemFree);452 } 420 return doHashWork(table, key, NULL, 1); 421 } -
trunk/psLib/src/sysUtils/psHash.d
r1041 r1073 1 1 psHash.o psHash.d : psHash.c psHash.h ../collections/psList.h \ 2 ../collections/psVector.h ../collections/psType.h \3 ../sysUtils/psMemory.h psString.hpsTrace.h psAbort.h2 ../collections/psVector.h ../collections/psType.h psMemory.h psString.h \ 3 psTrace.h psAbort.h -
trunk/psLib/src/sysUtils/psHash.h
r1013 r1073 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 12 05:50:01$12 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 45 45 ); 46 46 47 /// Free hash buckets from table.48 void psHashFree(psHash *table, ///< hash table to be freed49 void (*itemFree)(void *item) ///< how to free hashed data; or NULL50 );51 52 47 /// Insert entry into table. 53 48 void *psHashInsert(psHash *table, ///< table to insert in 54 49 const char *key, ///< key to use 55 void *data, ///< data to insert 56 void (*itemFree)(void *item) ///< how to free hashed data; or NULL 50 void *data ///< data to insert 57 51 ); 58 52 59 53 /// Lookup key in table. 60 void *psHashLookup(psHash *table, ///< table to lookup key in61 const char *key ///< key to lookup54 void *psHashLookup(psHash *table, ///< table to lookup key in 55 const char *key ///< key to lookup 62 56 ); 63 57 64 58 /// Remove key from table. 65 void *psHashRemove(psHash *table, ///< table to lookup key in 66 const char *key, ///< key to lookup 67 void (*itemFree)(void *item) ///< how to free hashed data; or NULL 59 void *psHashRemove(psHash *table, ///< table to lookup key in 60 const char *key ///< key to lookup 68 61 ); 69 62 -
trunk/psLib/src/sysUtils/psMemory.c
r876 r1073 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-06- 04 23:46:48$10 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-06-23 23:00:15 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 30 30 static int checkMemBlock(const psMemBlock *m, const char* funcName); 31 31 static psMemBlock *lastMemBlockAllocated = NULL; 32 pthread_mutex_tmemBlockListMutex = PTHREAD_MUTEX_INITIALIZER;33 pthread_mutex_tmemIdMutex = PTHREAD_MUTEX_INITIALIZER;32 static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER; 33 static pthread_mutex_t memIdMutex = PTHREAD_MUTEX_INITIALIZER; 34 34 35 35 /** … … 96 96 psMemoryId p_psMemFreeID = 0; // notify user this block is freed 97 97 98 psMemoryId psMemAllocateCallbackSetID(psMemoryId id) // set p_psMemAllocateID to id98 psMemoryId psMemAllocateCallbackSetID(psMemoryId id) 99 99 { 100 100 psMemoryId old = p_psMemAllocateID; … … 104 104 } 105 105 106 psMemoryId psMemFreeCallbackSetID(psMemoryId id) // set p_psMemFreeID to id106 psMemoryId psMemFreeCallbackSetID(psMemoryId id) 107 107 { 108 108 psMemoryId old = p_psMemFreeID; … … 184 184 #define ALIGNED(P) ((void *)((long)(P) & ~03) == (P)) 185 185 186 static int 187 checkMemBlock(const psMemBlock *m, 188 const char* funcName) 186 static int checkMemBlock(const psMemBlock *m, const char* funcName) 189 187 { 190 188 // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked, … … 260 258 261 259 ptr->file = file; 260 ptr->freeFcn = NULL; 262 261 *(unsigned int*)&ptr->lineno = lineno; 263 262 ptr->startblock = P_PS_MEMMAGIC; … … 346 345 if (checkMemBlock(ptr, __func__) != 0) { 347 346 memProblemCallback(ptr, file, lineno); // we may not own this block; don't free it 348 } 349 350 psMemDecrRefCounter(vptr); // this handles the free, if required. 347 return; 348 } 349 350 (void)psMemDecrRefCounter(vptr); // this handles the free, if required. 351 351 } 352 352 … … 354 354 * Check for memory leaks. Not production quality code 355 355 */ 356 int psMemCheckLeaks( 357 psMemoryId id0, // don't list blocks with id < id0 358 psMemBlock ***arr, // pointer to array of pointers to leaked blocks, or NULL 359 FILE *fd) // print list of leaks to fd (or NULL) 356 int psMemCheckLeaks(psMemoryId id0,psMemBlock ***arr,FILE *fd) 360 357 { 361 358 int nleak = 0; … … 365 362 pthread_mutex_lock(&memBlockListMutex); 366 363 367 for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) 368 { 364 for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) { 369 365 if ( (psMemGetRefCounter(iter+1) > 0) && (iter->id >= id0) ) { 370 366 nleak++; … … 382 378 pthread_mutex_unlock(&memBlockListMutex); 383 379 384 if (nleak == 0 || arr == NULL) 385 { 380 if (nleak == 0 || arr == NULL) { 386 381 return nleak; 387 382 } … … 390 385 pthread_mutex_lock(&memBlockListMutex); 391 386 392 for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) 393 { 387 for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) { 394 388 if ( (psMemGetRefCounter(iter+1) > 0) && (iter->id >= id0) ) { 395 389 (*arr)[j++] = iter; … … 408 402 * Reference counting APIs 409 403 */ 410 psReferenceCount psMemGetRefCounter(void *vptr) // return refCounter 404 // return refCounter 405 psReferenceCount psMemGetRefCounter(void *vptr) 411 406 { 412 407 psMemBlock *ptr; 413 408 unsigned int refCount; 414 409 415 if (vptr == NULL) 416 { 410 if (vptr == NULL) { 417 411 return 0; 418 412 } … … 420 414 ptr = ((psMemBlock *)vptr) - 1; 421 415 422 if (checkMemBlock(ptr, __func__) != 0) 423 { 416 if (checkMemBlock(ptr, __func__) != 0) { 424 417 memProblemCallback(ptr, __func__, __LINE__); 425 418 } … … 431 424 return refCount; 432 425 } 433 434 void *psMemIncrRefCounter(void *vptr) // increment and return refCounter426 // increment and return refCounter 427 void *psMemIncrRefCounter(void *vptr) 435 428 { 436 429 psMemBlock *ptr; 437 430 438 if (vptr == NULL) 439 { 431 if (vptr == NULL) { 440 432 return vptr; 441 433 } … … 443 435 ptr = ((psMemBlock *)vptr) - 1; 444 436 445 if (checkMemBlock(ptr, __func__)) 446 { 437 if (checkMemBlock(ptr, __func__)) { 447 438 memProblemCallback(ptr, __func__, __LINE__); 448 439 } … … 455 446 } 456 447 457 void *psMemDecrRefCounter(void *vptr)// decrement and return refCounter458 { 459 if (vptr == NULL) 460 {448 // decrement and return refCounter 449 void *psMemDecrRefCounter(void *vptr) 450 { 451 if (vptr == NULL) { 461 452 return NULL; 462 453 } … … 467 458 pthread_mutex_lock(&ptr->refCounterMutex); 468 459 469 if (ptr->refCounter > 1) 470 { 460 if (ptr->refCounter > 1) { 471 461 /// XXX - Probably should have another mutex here. 472 462 ptr->refCounter--; // multiple references, just decrement the count. 473 463 pthread_mutex_unlock(&ptr->refCounterMutex); 474 464 475 } else 476 { 465 } else { 477 466 pthread_mutex_unlock(&ptr->refCounterMutex); 478 467 … … 482 471 } 483 472 473 if (ptr->freeFcn != NULL) { 474 ptr->freeFcn(vptr); 475 } 476 484 477 pthread_mutex_lock(&memBlockListMutex); 485 478 … … 507 500 } 508 501 509 void p_psCustomFree(psFreeFcn fcn, void* ptr) 510 { 511 512 if (fcn == NULL) { 502 void p_psMemSetDeallocator(void* vptr, psFreeFcn freeFcn) 503 { 504 if (vptr == NULL) { 513 505 return; 514 } else { 515 if (fcn == PS_FREE) { 516 psFree(ptr); 517 } else { 518 fcn(ptr); 519 } 520 } 521 } 506 } 507 508 psMemBlock *ptr = ((psMemBlock *)vptr) - 1; 509 510 ptr->freeFcn = freeFcn; 511 512 } 513 psFreeFcn p_psMemGetDeallocator(void* vptr) 514 { 515 if (vptr == NULL) { 516 return NULL; 517 } 518 519 psMemBlock *ptr = ((psMemBlock *)vptr) - 1; 520 521 return ptr->freeFcn; 522 } -
trunk/psLib/src/sysUtils/psMemory.h
r978 r1073 14 14 * @ingroup MemoryManagement 15 15 * 16 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-06- 10 02:09:57$16 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-06-23 23:00:15 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 /// typedef for a memory block's reference count. Guaranteed to be some variety of integer. 51 51 typedef unsigned long psReferenceCount; 52 53 /// typedef for deallocator. 54 typedef void (*psFreeFcn)(void* ptr); 52 55 53 56 /** Book-keeping data for storage allocator. … … 58 61 typedef struct psMemBlock 59 62 { 60 const void* startblock; ///< initialised to p_psMEMMAGIC 61 struct psMemBlock* previousBlock; ///< previous block in allocation list 62 struct psMemBlock* nextBlock; ///< next block allocation list 63 size_t userMemorySize; ///< the size of the user-portion of the memory block 64 const psMemoryId id; ///< a unique ID for this allocation 65 const char* file; ///< set from __FILE__ in e.g. p_psAlloc 66 const int lineno; ///< set from __LINE__ in e.g. p_psAlloc 67 pthread_mutex_t refCounterMutex; ///< mutex to ensure exclusive access to reference counter 68 psReferenceCount refCounter; ///< how many times pointer is referenced 69 const void* endblock; ///< initialised to p_psMEMMAGIC 63 const void* startblock; ///< initialised to p_psMEMMAGIC 64 struct psMemBlock* previousBlock; ///< previous block in allocation list 65 struct psMemBlock* nextBlock; ///< next block allocation list 66 psFreeFcn freeFcn; ///< deallocator. If NULL, use generic deallocation. 67 size_t userMemorySize; ///< the size of the user-portion of the memory block 68 const psMemoryId id; ///< a unique ID for this allocation 69 const char* file; ///< set from __FILE__ in e.g. p_psAlloc 70 const int lineno; ///< set from __LINE__ in e.g. p_psAlloc 71 pthread_mutex_t refCounterMutex; ///< mutex to ensure exclusive access to reference counter 72 psReferenceCount refCounter; ///< how many times pointer is referenced 73 const void* endblock; ///< initialised to p_psMEMMAGIC 70 74 } 71 75 psMemBlock; … … 114 118 ); 115 119 116 typedef void (*psFreeFcn)(void* ptr);117 118 120 /** Memory allocation. This operates much like malloc(), but is guaranteed to return a non-NULL value. 119 121 * 120 122 * @return void* pointer to the allocated buffer. This will not be NULL. 121 * @see psFree 123 * @see psFree 122 124 */ 123 125 #ifdef DOXYGEN … … 131 133 int lineno ///< Line number of call 132 134 ); 135 136 void p_psMemSetDeallocator(void* ptr, psFreeFcn freeFcn); 137 psFreeFcn p_psMemGetDeallocator(void* ptr); 138 133 139 /// Memory allocation. psAlloc sends file and line number to p_psAlloc. 134 140 #define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__) … … 282 288 ); 283 289 284 #define PS_FREE (void*)1285 286 290 //@} End of Memory Management Functions 287 291 288 289 292 #ifndef DOXYGEN 290 291 void p_psCustomFree(psFreeFcn fcn,void* ptr);292 293 293 294 /* -
trunk/psLib/src/types/psBitSet.c
r1041 r1073 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 15 02:45:43$12 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 55 55 /* FUNCTION IMPLEMENTATION - LOCAL */ 56 56 /*****************************************************************************/ 57 static void bitSetFree(psBitSet *restrict inBitSet); 58 57 59 58 60 /** Private function to create a mask. … … 88 90 numBytes = ceil(n/8.0); 89 91 newObj = psAlloc(sizeof(psBitSet)); 92 p_psMemSetDeallocator(newObj,(psFreeFcn)bitSetFree); 90 93 newObj->n = numBytes; 91 94 … … 98 101 } 99 102 100 void psBitSetFree(psBitSet *restrict inBitSet)103 static void bitSetFree(psBitSet *restrict inBitSet) 101 104 { 102 105 if(inBitSet == NULL) { … … 105 108 } 106 109 psFree(inBitSet->bits); 107 psFree(inBitSet);108 110 } 109 111 -
trunk/psLib/src/types/psBitSet.h
r974 r1073 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-06- 10 01:58:06$14 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-06-23 23:00:15 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 54 54 psBitSet* psBitSetAlloc( 55 55 int n /**< Number of bits in psBitSet array */ 56 );57 58 /** Free a psBitSet59 *60 * Deletes a psBitSet array.61 */62 void psBitSetFree(63 psBitSet *restrict inMask /**< Pointer to psBitSet to be deleted. */64 56 ); 65 57 -
trunk/psLib/src/types/psList.c
r1024 r1073 6 6 * @author Robert Daniel DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06- 14 19:45:46$8 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-23 23:00:15 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 29 29 // private functions. 30 psListElem* listGetIterator(psList* list); 31 int listGetIteratorIndex(psList* list); 32 void listSetIterator(psList *list, int where, bool lockList); 30 static psListElem* listGetIterator(psList* list); 31 static int listGetIteratorIndex(psList* list); 32 static void listSetIterator(psList *list, int where, bool lockList); 33 static void listFree(psList *list); 33 34 34 35 … … 36 37 { 37 38 psList *list = psAlloc(sizeof(psList)); 39 p_psMemSetDeallocator(list,(psFreeFcn)listFree); 38 40 39 41 list->size = 0; … … 41 43 list->iter = ITER_INIT_HEAD; 42 44 list->iterIndex = PS_LIST_HEAD; 45 43 46 pthread_mutex_init(&(list->lock),NULL) 44 47 ; … … 51 54 } 52 55 53 void psListFree(psList *list, psFreeFcn elemFree)56 static void listFree(psList *list) 54 57 { 55 58 if (list == NULL) { … … 63 66 psListElem *next = ptr->next; 64 67 65 p _psCustomFree(elemFree, psMemDecrRefCounter(ptr->data));68 psFree(ptr->data); 66 69 psFree(ptr); 67 70 … … 75 78 ; 76 79 77 psFree(list);78 80 } 79 81 -
trunk/psLib/src/types/psList.h
r1017 r1073 10 10 * @ingroup LinkedList 11 11 * 12 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 12 22:15:39$12 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 73 73 ) 74 74 ; 75 76 #include "psMemory.h"77 /** Destroys a psList linked list object. This also frees the elements of the78 * list using the psFreeFcn given, if any. If no psFreeFcn is specified,79 * the elements are just dereferenced via psMemDecrRefCounter(...).80 *81 */82 void psListFree(83 psList* restrict list, ///< list to destroy84 psFreeFcn elemFree ///< destructor for data on list85 );86 75 87 76 /** Adds an element to a psList at position given. -
trunk/psLib/test/FullUnitTest
r1035 r1073 19 19 # RETURN : integer number of tests which failed 20 20 # 21 # $Revision: 1. 7$ $Name: not supported by cvs2svn $22 # $Date: 2004-06- 15 00:19:42$21 # $Revision: 1.8 $ $Name: not supported by cvs2svn $ 22 # $Date: 2004-06-23 23:00:15 $ 23 23 # 24 24 # Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 302 302 $retVal = $?; 303 303 # Count testpoints 304 $totalPoints = `grep -c '***** TESTPOINT *****' temp/$files[$j].stdout`; 305 $totalPoints += `grep -c '***** TESTPOINT *****' temp/$files[$j].stderr`; 304 $testPattern = "\"\\*\\*\\*\\* TESTPOINT \\*\\*\\*\\*\""; 305 $totalPoints = `grep -c $testPattern temp/$files[$j].stdout`; 306 $totalPoints += `grep -c $testPattern temp/$files[$j].stderr`; 306 307 $failPoints = `grep "> TESTPOINT FAILED" temp/$files[$j].stdout | wc -l`; 307 308 $failPoints += `grep "> TESTPOINT FAILED" temp/$files[$j].stderr | wc -l`; -
trunk/psLib/test/collections/builddir/tst_psBitSet_01.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psBitSet_02.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psBitSet_03.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psBitSet_04.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psBitSet_05.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psBitSet_06.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psImage.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h -
trunk/psLib/test/collections/builddir/tst_psList.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h -
trunk/psLib/test/collections/builddir/tst_psSort_01.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psSort_02.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psSort_03.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psSort_04.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psVector_01.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psVector_02.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/builddir/tst_psVector_03.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/collections/tst_psBitSet_01.c
r965 r1073 17 17 * @author Ross Harman, MHPCC 18 18 * 19 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $20 * @date $Date: 2004-06- 10 00:28:23$19 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2004-06-23 23:00:15 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 121 121 // Test J - Free psBitSet 122 122 printPositiveTestHeader(stdout, "psBitSet", "Free psBitSet"); 123 ps BitSetFree(bs);123 psFree(bs); 124 124 psMemCheckLeaks(0, NULL, stdout); 125 125 psMemCheckCorruption(0); -
trunk/psLib/test/collections/tst_psBitSet_02.c
r993 r1073 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 11 01:39:30$12 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 63 63 // Test C - Free psBitSets 64 64 printPositiveTestHeader(stdout, "psBitSet", "Free psBitSets"); 65 ps BitSetFree(bs1);66 ps BitSetFree(bs2);67 ps BitSetFree(outbs);65 psFree(bs1); 66 psFree(bs2); 67 psFree(outbs); 68 68 psMemCheckLeaks(0, NULL, stdout); 69 69 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/collections/tst_psBitSet_03.c
r994 r1073 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 11 01:40:45 $12 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 63 63 // Test C - Free psBitSets 64 64 printPositiveTestHeader(stdout, "psBitSet", "Free psBitSets"); 65 ps BitSetFree(bs1);66 ps BitSetFree(bs2);67 ps BitSetFree(outbs);65 psFree(bs1); 66 psFree(bs2); 67 psFree(outbs); 68 68 psMemCheckLeaks(0, NULL, stdout); 69 69 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/collections/tst_psBitSet_04.c
r995 r1073 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 11 01:46:02$12 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 63 63 // Test C - Free psBitSets 64 64 printPositiveTestHeader(stdout, "psBitSet", "Free psBitSets"); 65 ps BitSetFree(bs1);66 ps BitSetFree(bs2);67 ps BitSetFree(outbs);65 psFree(bs1); 66 psFree(bs2); 67 psFree(outbs); 68 68 psMemCheckLeaks(0, NULL, stdout); 69 69 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/collections/tst_psBitSet_05.c
r965 r1073 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 10 00:28:36$12 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 48 48 // Test C - Free psBitSets 49 49 printPositiveTestHeader(stdout, "psBitSet", "Free psBitSets"); 50 ps BitSetFree(bs1);51 ps BitSetFree(bs2);52 ps BitSetFree(outbs);50 psFree(bs1); 51 psFree(bs2); 52 psFree(outbs); 53 53 psMemCheckLeaks(0, NULL, stdout); 54 54 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/collections/tst_psBitSet_06.c
r965 r1073 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-06- 10 00:28:43$14 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-06-23 23:00:15 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 55 55 printFooter(stdout, "psBitSet", "Create negative size bitset", true); 56 56 57 58 // Test D - Attempt to free null BitSet59 printNegativeTestHeader(stdout,"psBitSet", "Attempt to free null BitSet",60 "Null psBitSet for inBitSet argument", 0);61 psBitSetFree(NULL);62 printFooter(stdout, "psBitSet", "Attempt to free null BitSet", true);63 64 65 57 // Test E - Free psBitSets 66 58 printPositiveTestHeader(stdout, "psBitSet", "Free psBitSets"); 67 ps BitSetFree(bs1);68 ps BitSetFree(bs2);69 ps BitSetFree(outbs);59 psFree(bs1); 60 psFree(bs2); 61 psFree(outbs); 70 62 psMemCheckLeaks(0, NULL, stdout); 71 63 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/collections/tst_psList.c
r1033 r1073 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06- 14 23:03:43$8 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-23 23:00:15 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 78 78 } 79 79 80 ps ListFree(list,NULL);80 psFree(list); 81 81 82 82 list = psListAlloc(data); … … 108 108 109 109 110 psListFree(list,PS_FREE); 110 psFree(list); 111 112 psFree(data); 111 113 112 114 return 0; … … 283 285 } 284 286 285 ps ListFree(list, PS_FREE);287 psFree(list); 286 288 287 289 return 0; … … 339 341 *data = 0; 340 342 list = psListAlloc(data); 343 psFree(data); 341 344 342 345 data = psAlloc(sizeof(int)); 343 346 *data = 1; 344 347 list = psListAdd(list,data,PS_LIST_TAIL); 348 psFree(data); 345 349 346 350 data = psAlloc(sizeof(int)); 347 351 *data = 2; 348 352 list = psListAdd(list,data,PS_LIST_TAIL); 353 psFree(data); 349 354 350 355 data = psAlloc(sizeof(int)); 351 356 *data = 3; 352 357 list = psListAdd(list,data,PS_LIST_TAIL); 358 psFree(data); 353 359 354 360 // 2. which>0 and which<list.n. … … 404 410 } 405 411 406 ps ListFree(list,PS_FREE);412 psFree(list); 407 413 408 414 return 0; … … 637 643 } 638 644 639 ps ListFree(list,PS_FREE);645 psFree(list); 640 646 641 647 return 0; … … 691 697 } 692 698 693 ps VectorFree(vec);694 ps ListFree(list,PS_FREE);699 psFree(vec); 700 psFree(list); 695 701 696 702 // test vector -> dlist … … 729 735 } 730 736 731 ps VectorFree(vec);732 ps ListFree(list,PS_FREE);737 psFree(vec); 738 psFree(list); 733 739 734 740 // now, make sure if input vector/list is NULL, output is NULL … … 755 761 return 1; 756 762 } 757 ps VectorFree(vec);758 ps ListFree(list,PS_FREE);763 psFree(vec); 764 psFree(list); 759 765 760 766 list = psListAlloc(NULL); … … 765 771 return 1; 766 772 } 767 ps VectorFree(vec);768 ps ListFree(list,PS_FREE);773 psFree(vec); 774 psFree(list); 769 775 770 776 return 0; … … 895 901 } 896 902 897 ps ListFree(list,PS_FREE);903 psFree(list); 898 904 899 905 return 0; … … 938 944 */ 939 945 940 ps ListFree(list,NULL);946 psFree(list); 941 947 942 948 /* -
trunk/psLib/test/collections/tst_psSort_01.c
r988 r1073 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 10 23:14:22$12 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 71 71 // Test D - Free float vectors 72 72 printPositiveTestHeader(stdout,"psSort", "Free float vectors"); 73 ps VectorFree(in);74 ps VectorFree(out);73 psFree(in); 74 psFree(out); 75 75 psMemCheckLeaks(0, NULL, stdout); 76 76 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/collections/tst_psSort_02.c
r831 r1073 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 02 23:29:29$12 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 55 55 // Test C - Free vectors 56 56 printPositiveTestHeader(stdout,"psSort", "Free vectors"); 57 ps VectorFree(in);58 ps VectorFree(out);57 psFree(in); 58 psFree(out); 59 59 psMemCheckLeaks(0, NULL, stdout); 60 60 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/collections/tst_psSort_03.c
r831 r1073 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 02 23:29:29$12 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:15 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 49 49 // Test C - Free float vectors 50 50 printPositiveTestHeader(stdout,"psSort", "Free float vectors"); 51 ps VectorFree(in);52 ps VectorFree(out);51 psFree(in); 52 psFree(out); 53 53 psMemCheckLeaks(0, NULL, stdout); 54 54 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/collections/tst_psSort_04.c
r988 r1073 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-06- 10 23:14:22$11 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-06-23 23:00:15 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 33 33 // Test B - Free vectors 34 34 printPositiveTestHeader(stdout, "psSort", "Free vectors"); 35 ps VectorFree(goodOut);35 psFree(goodOut); 36 36 psMemCheckLeaks(0, NULL, stdout); 37 37 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/collections/tst_psVector_01.c
r972 r1073 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-06- 10 01:50:43$16 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-06-23 23:00:15 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 79 79 // Test E - Free S32 vector 80 80 printPositiveTestHeader(stdout, "psVector", "Free S32 vector"); 81 ps VectorFree(psVec);81 psFree(psVec); 82 82 psMemCheckLeaks(0, NULL, stdout); 83 83 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/collections/tst_psVector_02.c
r831 r1073 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-06- 02 23:29:29$14 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-06-23 23:00:15 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 102 102 // Test E - Free void pointer vector 103 103 printPositiveTestHeader(stdout, "psVector", "Free void pointer vector"); 104 psVectorElementFree(psVec , NULL);105 ps VectorFree(psVec);104 psVectorElementFree(psVec); 105 psFree(psVec); 106 106 for(int i = 0; i < 10; i++) { 107 107 psFree(mySt[i]); -
trunk/psLib/test/collections/tst_psVector_03.c
r867 r1073 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-06- 04 19:51:49$14 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-06-23 23:00:15 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 } 29 29 testStruct; 30 31 static void freeData(void *data)32 {33 psFree(data);34 }35 36 30 37 31 int main(int argc, … … 59 53 psVec->data.PTR[i] = ts; 60 54 psVec->n++; 61 psMemIncrRefCounter(ts);62 55 } 63 56 … … 82 75 psVec->data.PTR[i] = ts; 83 76 psVec->n++; 84 psMemIncrRefCounter(ts);85 77 } 86 78 for(int i = 0; i < 10; i++) { … … 92 84 printFooter(stdout, "psVector", "Reallocate void pointer vector bigger", true); 93 85 94 95 86 // Test D - Reallocate void pointer vector smaller 96 87 printPositiveTestHeader(stdout,"psVector","Reallocate void pointer vector smaller"); 97 psVec = psVectorRealloc(3, psVec); 88 psVec = psVectorRealloc(3, psVec); // this also frees the elements trimmed 98 89 for(int i = 0; i < 3; i++) { 99 90 testStruct *ts = (testStruct*)psVec->data.PTR[i]; … … 109 100 110 101 // Free void pointer array struct and its 3 internal elements 111 psVectorElementFree(psVec, freeData); 112 psVectorFree(psVec); 102 psFree(psVec); 113 103 114 // Free 7 elements manually that were lost after array was reallocated smaller 115 for(int i = 3; i < 10; i++) { 116 psFree(mySt[i]); 104 if (psMemCheckLeaks(0, NULL, stdout) != 0) { 105 psAbort(__func__,"memory leaks"); 117 106 } 118 psMemCheckLeaks(0, NULL, stdout);119 107 int nBad = psMemCheckCorruption(0); 120 108 if(nBad) { -
trunk/psLib/test/collections/verified/tst_psBitSet_01.stderr
r1018 r1073 1 <DATE> <TIME> <HOST> |E| psBitSetTest| : Line 14 0- Bit position too small: -42 <DATE> <TIME> <HOST> |E| psBitSetTest| : Line 14 3- Bit position too large: 2003 <DATE> <TIME> <HOST> |E| psBitSetTest| : Line 13 7- Null psBitSet for inBitSet argument4 <DATE> <TIME> <HOST> |E| psBitSetSet| : Line 1 18- Bit position too small: -45 <DATE> <TIME> <HOST> |E| psBitSetSet| : Line 12 1- Bit position too large: 2006 <DATE> <TIME> <HOST> |E| psBitSetSet| : Line 11 5- Null psBitSet for inBitSet argument1 <DATE> <TIME> <HOST> |E| psBitSetTest| : Line 142 - Bit position too small: -4 2 <DATE> <TIME> <HOST> |E| psBitSetTest| : Line 145 - Bit position too large: 200 3 <DATE> <TIME> <HOST> |E| psBitSetTest| : Line 139 - Null psBitSet for inBitSet argument 4 <DATE> <TIME> <HOST> |E| psBitSetSet| : Line 120 - Bit position too small: -4 5 <DATE> <TIME> <HOST> |E| psBitSetSet| : Line 123 - Bit position too large: 200 6 <DATE> <TIME> <HOST> |E| psBitSetSet| : Line 117 - Null psBitSet for inBitSet argument -
trunk/psLib/test/collections/verified/tst_psBitSet_05.stderr
r1018 r1073 1 <DATE> <TIME> <HOST> |E| psBitSetOp| : Line 18 7- psBitSet sizes not the same1 <DATE> <TIME> <HOST> |E| psBitSetOp| : Line 189 - psBitSet sizes not the same -
trunk/psLib/test/collections/verified/tst_psBitSet_06.stderr
r1018 r1073 1 <DATE> <TIME> <HOST> |E| psBitSetOp| : Line 214 - Invalid psBitMask binary operation: ZZXOR 2 <DATE> <TIME> <HOST> |E| psBitSetAlloc| : Line 84 - Allocation size must be > 0: size = -4 3 <DATE> <TIME> <HOST> |E| psBitSetFree| : Line 103 - Null psBitSet for inBitSet argument 1 <DATE> <TIME> <HOST> |E| psBitSetOp| : Line 216 - Invalid psBitMask binary operation: ZZXOR 2 <DATE> <TIME> <HOST> |E| psBitSetAlloc| : Line 86 - Allocation size must be > 0: size = -4 -
trunk/psLib/test/collections/verified/tst_psBitSet_06.stdout
r1041 r1073 35 35 /***************************** TESTPOINT ******************************************\ 36 36 * TestFile: tst_psBitSet_06.c * 37 * TestPoint: psBitSet{Attempt to free null BitSet} *38 * TestType: Negative *39 * ExpectedErrorText: Null psBitSet for inBitSet argument *40 * ExpectedStatusValue: 0 *41 \**********************************************************************************/42 43 44 ---> TESTPOINT PASSED (psBitSet{Attempt to free null BitSet} | tst_psBitSet_06.c)45 46 /***************************** TESTPOINT ******************************************\47 * TestFile: tst_psBitSet_06.c *48 37 * TestPoint: psBitSet{Free psBitSets} * 49 38 * TestType: Positive * -
trunk/psLib/test/collections/verified/tst_psList.stderr
r1034 r1073 30 30 31 31 <DATE> <TIME> <HOST> |I| testListGet|Following should be an error 32 <DATE> <TIME> <HOST> |E|listSetIterator|Unexpected null pointer for psList parameter (psList.c:26 4).32 <DATE> <TIME> <HOST> |E|listSetIterator|Unexpected null pointer for psList parameter (psList.c:262). 33 33 34 34 ---> TESTPOINT PASSED (psList{489-testListGet} | tst_psList.c) … … 70 70 <DATE> <TIME> <HOST> |I|testListIterato| psListSetIterator/psListGetNext/psListGetPrev shall move the list cursor to the specified location 71 71 <DATE> <TIME> <HOST> |I|testListIterato|Following should error with 'Unexpected null pointer' 72 <DATE> <TIME> <HOST> |E|listSetIterator|Unexpected null pointer for psList parameter (psList.c:26 4).72 <DATE> <TIME> <HOST> |E|listSetIterator|Unexpected null pointer for psList parameter (psList.c:262). 73 73 <DATE> <TIME> <HOST> |I|testListIterato|Following should error with 'Can't move to an unknown position.' 74 74 <DATE> <TIME> <HOST> |E|listSetIterator|Can't move to an unknown position. Not moving the iterator position. -
trunk/psLib/test/collections/verified/tst_psSort_03.stderr
r1018 r1073 1 <DATE> <TIME> <HOST> |E| psSort| : Line 13 6- Input and output vector sizes are not equal: in=5 out=61 <DATE> <TIME> <HOST> |E| psSort| : Line 137 - Input and output vector sizes are not equal: in=5 out=6 -
trunk/psLib/test/collections/verified/tst_psSort_04.stderr
r1018 r1073 1 <DATE> <TIME> <HOST> |E| psSort| : Line 11 8- Null input vector1 <DATE> <TIME> <HOST> |E| psSort| : Line 119 - Null input vector -
trunk/psLib/test/dataManip/tst_psFunc00.c
r887 r1073 53 53 psEvalPolynomial1D(MISC_X_VALUE, my1DPoly)); 54 54 55 ps Polynomial1DFree(my1DPoly);55 psFree(my1DPoly); 56 56 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 57 57 if (0 != memLeaks) { … … 83 83 psEvalPolynomial2D(MISC_X_VALUE, MISC_X_VALUE, my2DPoly)); 84 84 85 ps Polynomial2DFree(my2DPoly);85 psFree(my2DPoly); 86 86 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 87 87 if (0 != memLeaks) { … … 114 114 psEvalPolynomial3D(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my3DPoly)); 115 115 116 ps Polynomial3DFree(my3DPoly);116 psFree(my3DPoly); 117 117 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 118 118 if (0 != memLeaks) { … … 148 148 psEvalPolynomial4D(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my4DPoly)); 149 149 150 ps Polynomial4DFree(my4DPoly);150 psFree(my4DPoly); 151 151 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 152 152 if (0 != memLeaks) { … … 178 178 psDEvalPolynomial1D(MISC_X_VALUE, my1DPolyD)); 179 179 180 ps DPolynomial1DFree(my1DPolyD);180 psFree(my1DPolyD); 181 181 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 182 182 if (0 != memLeaks) { … … 187 187 "Allocate/Deallocate the psDPolynomial1D structure.", 188 188 testStatus); 189 190 191 192 193 189 194 190 printPositiveTestHeader(stdout, … … 208 204 psDEvalPolynomial2D(MISC_X_VALUE, MISC_X_VALUE, my2DPolyD)); 209 205 210 ps DPolynomial2DFree(my2DPolyD);206 psFree(my2DPolyD); 211 207 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 212 208 if (0 != memLeaks) { … … 239 235 psDEvalPolynomial3D(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my3DPolyD)); 240 236 241 ps DPolynomial3DFree(my3DPolyD);237 psFree(my3DPolyD); 242 238 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 243 239 if (0 != memLeaks) { … … 273 269 psDEvalPolynomial4D(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my4DPolyD)); 274 270 275 ps DPolynomial4DFree(my4DPolyD);271 psFree(my4DPolyD); 276 272 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 277 273 if (0 != memLeaks) { -
trunk/psLib/test/dataManip/tst_psFunc01.c
r887 r1073 56 56 } 57 57 58 ps VectorFree(myGaussData);58 psFree(myGaussData); 59 59 60 60 psMemCheckCorruption(1); -
trunk/psLib/test/dataManip/tst_psHist00.c
r893 r1073 79 79 80 80 psMemCheckCorruption(1); 81 ps HistogramFree(myHist);81 psFree(myHist); 82 82 psMemCheckCorruption(1); 83 83 -
trunk/psLib/test/dataManip/tst_psHist01.c
r893 r1073 84 84 } 85 85 psMemCheckCorruption(1); 86 ps HistogramFree(myHist);86 psFree(myHist); 87 87 psMemCheckCorruption(1); 88 ps VectorFree(myBounds);88 psFree(myBounds); 89 89 90 90 printFooter(stdout, -
trunk/psLib/test/dataManip/tst_psHist02.c
r893 r1073 75 75 } 76 76 psMemCheckCorruption(1); 77 ps HistogramFree(myHist);77 psFree(myHist); 78 78 psMemCheckCorruption(1); 79 79 … … 100 100 } 101 101 psMemCheckCorruption(1); 102 ps HistogramFree(myHist);102 psFree(myHist); 103 103 psMemCheckCorruption(1); 104 104 … … 108 108 testStatus); 109 109 } 110 ps VectorFree(myMask);110 psFree(myMask); 111 111 112 112 printPositiveTestHeader(stdout, … … 122 122 testStatus = false; 123 123 } 124 ps VectorFree(myData);124 psFree(myData); 125 125 126 126 … … 135 135 testStatus = false; 136 136 } 137 ps HistogramFree(myHist);137 psFree(myHist); 138 138 139 139 … … 152 152 testStatus = false; 153 153 } 154 ps HistogramFree(myHist);155 ps VectorFree(myData);154 psFree(myHist); 155 psFree(myData); 156 156 */ 157 157 printFooter(stdout, -
trunk/psLib/test/dataManip/tst_psMatrix01.c
r899 r1073 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-06- 07 20:47:52$13 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-06-23 23:00:17 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 75 75 // Test D - Free images and check for leaks 76 76 printPositiveTestHeader(stdout, "psMatrix", "Free images and check for leaks"); 77 ps ImageFree(inImage);78 ps ImageFree(outImage);79 ps ImageFree(outImageNull);77 psFree(inImage); 78 psFree(outImage); 79 psFree(outImageNull); 80 80 psMemCheckLeaks(0, NULL, stdout); 81 81 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/dataManip/tst_psMatrix03.c
r897 r1073 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-06- 07 20:25:03$16 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-06-23 23:00:17 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 104 104 // Test D - Free input and output images and vectors 105 105 printPositiveTestHeader(stdout, "psMatrix", "Free input and output images and vectors"); 106 ps ImageFree(inImage);107 ps ImageFree(luImage);108 ps VectorFree(perm);109 ps VectorFree(outVector);110 ps VectorFree(inVector);106 psFree(inImage); 107 psFree(luImage); 108 psFree(perm); 109 psFree(outVector); 110 psFree(inVector); 111 111 psMemCheckLeaks(0, NULL, stdout); 112 112 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/dataManip/tst_psMatrix04.c
r897 r1073 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-06- 07 20:25:03$15 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-06-23 23:00:17 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 82 82 // Test D - Free input and output images 83 83 printPositiveTestHeader(stdout, "psMatrix", "Free input and output images"); 84 ps ImageFree(outImage);85 ps ImageFree(inImage);84 psFree(outImage); 85 psFree(inImage); 86 86 psFree(det2); 87 87 psMemCheckLeaks(0, NULL, stdout); -
trunk/psLib/test/dataManip/tst_psMatrix05.c
r798 r1073 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-0 5-28 02:52:23$12 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:17 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 65 65 // Test C - Free input and output images 66 66 printPositiveTestHeader(stdout, "psMatrix", "Free input and output images"); 67 ps ImageFree(outImage);68 ps ImageFree(inImage1);69 ps ImageFree(inImage2);67 psFree(outImage); 68 psFree(inImage1); 69 psFree(inImage2); 70 70 psMemCheckLeaks(0, NULL, stdout); 71 71 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/dataManip/tst_psMatrix06.c
r798 r1073 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-0 5-28 02:52:23$12 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-23 23:00:17 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 74 74 // Test C - Free input and output images 75 75 printPositiveTestHeader(stdout, "psMatrix", "Free input and output images"); 76 ps ImageFree(outImage);77 ps ImageFree(inImage);76 psFree(outImage); 77 psFree(inImage); 78 78 psMemCheckLeaks(0, NULL, stdout); 79 79 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/dataManip/tst_psMatrix07.c
r908 r1073 16 16 * @author Ross Harman, MHPCC 17 17 * 18 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $19 * @date $Date: 2004-06- 08 01:56:35$18 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 19 * @date $Date: 2004-06-23 23:00:17 $ 20 20 * 21 21 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 157 157 // Test I - Free input and output images 158 158 printPositiveTestHeader(stdout, "psMatrix", "Free input and output images and vectors"); 159 ps ImageFree(m1);160 ps VectorFree(v1);161 ps ImageFree(m2);162 ps VectorFree(v2);163 ps ImageFree(m3);164 ps ImageFree(m4);165 ps ImageFree(badImage);159 psFree(m1); 160 psFree(v1); 161 psFree(m2); 162 psFree(v2); 163 psFree(m3); 164 psFree(m4); 165 psFree(badImage); 166 166 psMemCheckLeaks(0, NULL, stdout); 167 167 int nBad = psMemCheckCorruption(0); -
trunk/psLib/test/dataManip/tst_psStats00.c
r893 r1073 186 186 "psStats(): deallocating memory"); 187 187 188 ps StatsFree(myStats);189 ps VectorFree(myVector);190 ps VectorFree(maskVector);188 psFree(myStats); 189 psFree(myVector); 190 psFree(maskVector); 191 191 192 192 psMemCheckCorruption(1); -
trunk/psLib/test/dataManip/tst_psStats01.c
r887 r1073 107 107 "psStats(): deallocating memory"); 108 108 109 ps StatsFree(myStats);110 ps VectorFree(myVector);111 ps VectorFree(maskVector);109 psFree(myStats); 110 psFree(myVector); 111 psFree(maskVector); 112 112 113 113 psMemCheckCorruption(1); -
trunk/psLib/test/dataManip/tst_psStats02.c
r887 r1073 107 107 "psStats(): deallocating memory"); 108 108 109 ps StatsFree(myStats);110 ps VectorFree(myVector);111 ps VectorFree(maskVector);109 psFree(myStats); 110 psFree(myVector); 111 psFree(maskVector); 112 112 113 113 psMemCheckCorruption(1); -
trunk/psLib/test/dataManip/tst_psStats03.c
r887 r1073 102 102 "psStats(): deallocating memory"); 103 103 104 ps StatsFree(myStats);105 ps VectorFree(myVector);106 ps VectorFree(maskVector);104 psFree(myStats); 105 psFree(myVector); 106 psFree(maskVector); 107 107 108 108 psMemCheckCorruption(1); -
trunk/psLib/test/dataManip/tst_psStats05.c
r893 r1073 59 59 "psStats functions", 60 60 "Deallocate the psStats structure."); 61 ps StatsFree(myStats);61 psFree(myStats); 62 62 63 63 psMemCheckCorruption(1); … … 73 73 testStatus); 74 74 75 76 77 printPositiveTestHeader(stdout,78 "psStats functions",79 "Deallocate NULL psStats structure.");80 psStatsFree(NULL);81 printFooter(stdout,82 "psStats functions",83 "Deallocate NULL psStats structure.",84 testStatus);85 86 87 75 return (!testStatus); 88 76 } -
trunk/psLib/test/dataManip/tst_psStats06.c
r887 r1073 110 110 "psStats(): deallocating memory"); 111 111 112 ps StatsFree(myStats);113 ps VectorFree(myVector);114 ps VectorFree(maskVector);112 psFree(myStats); 113 psFree(myVector); 114 psFree(maskVector); 115 115 116 116 psMemCheckCorruption(1); -
trunk/psLib/test/dataManip/tst_psStats07.c
r1026 r1073 395 395 "psStats(): deallocating memory"); 396 396 397 ps StatsFree(myStats);398 ps VectorFree(myVector);399 ps VectorFree(maskVector);397 psFree(myStats); 398 psFree(myVector); 399 psFree(maskVector); 400 400 401 401 psMemCheckCorruption(1); -
trunk/psLib/test/dataManip/tst_psStats08.c
r887 r1073 154 154 "psStats(): deallocating memory"); 155 155 156 ps StatsFree(myStats);157 ps VectorFree(myVector);158 ps VectorFree(maskVector);156 psFree(myStats); 157 psFree(myVector); 158 psFree(maskVector); 159 159 160 160 psMemCheckCorruption(1); -
trunk/psLib/test/dataManip/tst_psStats09.c
r887 r1073 128 128 "psStats(): deallocating memory"); 129 129 130 ps StatsFree(myStats);131 ps VectorFree(myGaussData);132 ps VectorFree(maskVector);130 psFree(myStats); 131 psFree(myGaussData); 132 psFree(maskVector); 133 133 134 134 psMemCheckCorruption(1); -
trunk/psLib/test/dataManip/tst_psVectorFFT.c
r1009 r1073 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06- 12 01:34:10$8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-23 23:00:17 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 112 112 } 113 113 114 ps VectorFree(vec);115 ps VectorFree(vec2);116 ps VectorFree(vec3);114 psFree(vec); 115 psFree(vec2); 116 psFree(vec3); 117 117 118 118 return 0; … … 177 177 } 178 178 179 ps VectorFree(vec);180 ps VectorFree(vec2);181 ps VectorFree(vec3);179 psFree(vec); 180 psFree(vec2); 181 psFree(vec3); 182 182 183 183 return 0; … … 262 262 } 263 263 264 ps VectorFree(vec);265 ps VectorFree(vec2);266 ps VectorFree(vec3);264 psFree(vec); 265 psFree(vec2); 266 psFree(vec3); 267 267 268 268 return 0; … … 307 307 } 308 308 309 ps VectorFree(vec);310 ps VectorFree(vec2);309 psFree(vec); 310 psFree(vec2); 311 311 312 312 return 0; … … 374 374 }; 375 375 376 ps VectorFree(vec);377 ps VectorFree(vec2);378 379 return 0; 380 } 376 psFree(vec); 377 psFree(vec2); 378 379 return 0; 380 } -
trunk/psLib/test/dataManip/verified/tst_psStats05.stdout
r1034 r1073 17 17 ---> TESTPOINT PASSED (psStats functions{Deallocate the psStats structure.} | tst_psStats05.c) 18 18 19 /***************************** TESTPOINT ******************************************\20 * TestFile: tst_psStats05.c *21 * TestPoint: psStats functions{Deallocate NULL psStats structure.} *22 * TestType: Positive *23 \**********************************************************************************/24 25 26 ---> TESTPOINT PASSED (psStats functions{Deallocate NULL psStats structure.} | tst_psStats05.c)27 -
trunk/psLib/test/image/tst_psImage.c
r1033 r1073 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06- 14 23:03:43$8 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-23 23:00:15 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 75 75 psError(__func__,"psImageAlloc returned NULL for type %x, size %dx%d.", 76 76 type[t], numCols[i], numRows[i]); 77 ps ImageFree(image);77 psFree(image); 78 78 return 1; 79 79 } … … 82 82 psError(__func__,"psImageAlloc allocated wrong dimen/type (%d/%d), should be " 83 83 "PS_IMAGE_DIMEN/%d", image->type.dimen, image->type.type, type[t]); 84 ps ImageFree(image);84 psFree(image); 85 85 return 2; 86 86 } … … 89 89 psError(__func__,"psImageAlloc allocated wrong size %dx%d, should be %dx%d (type = %d)", 90 90 image->numCols, image->numRows, numCols[i], numRows[i],type[t]); 91 ps ImageFree(image);91 psFree(image); 92 92 return 3; 93 93 } … … 96 96 psError(__func__,"psImageAlloc returned row0/col0 of %d/%d. Should be 0/0.", 97 97 image->row0, image->row0); 98 ps ImageFree(image);98 psFree(image); 99 99 return 4; 100 100 } … … 102 102 if (image->parent != NULL) { 103 103 psError(__func__,"psImageAlloc returned non-NULL parent"); 104 ps ImageFree(image);104 psFree(image); 105 105 return 5; 106 106 } … … 108 108 if (image->nChildren != 0) { 109 109 psError(__func__,"psImageAlloc returned non-zero number of children"); 110 ps ImageFree(image);110 psFree(image); 111 111 return 6; 112 112 } … … 114 114 if (image->children != NULL) { 115 115 psError(__func__,"psImageAlloc returned non-NULL children vector"); 116 ps ImageFree(image);116 psFree(image); 117 117 return 7; 118 118 } … … 132 132 if (image->data.U16[r][c] != 2*c+r) { 133 133 psError(__func__,"Could not set all pixels in uint16 image at (%d,%d)",c,r); 134 ps ImageFree(image);134 psFree(image); 135 135 return 8; 136 136 } … … 152 152 if (fabsf(image->data.F32[r][c] - (2.0f*c+r)) > FLT_EPSILON) { 153 153 psError(__func__,"Could not set all pixels in float image at (%d,%d)",c,r); 154 ps ImageFree(image);154 psFree(image); 155 155 return 8; 156 156 } … … 172 172 if (fabs(image->data.F64[r][c] - (2.0f*c+r)) > DBL_EPSILON) { 173 173 psError(__func__,"Could not set all pixels in double image at (%d,%d)",c,r); 174 ps ImageFree(image);174 psFree(image); 175 175 return 8; 176 176 } … … 193 193 fabsf(cimagf(image->data.C32[r][c]) - c) > FLT_EPSILON ) { 194 194 psError(__func__,"Could not set all pixels in complex image at (%d,%d)",c,r); 195 ps ImageFree(image);195 psFree(image); 196 196 return 8; 197 197 } … … 215 215 psError(__func__,"Could not set all pixels in image (type=%d) at (%d,%d)", 216 216 type[t],c,r); 217 ps ImageFree(image);217 psFree(image); 218 218 return 8; 219 219 } … … 225 225 // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with no 226 226 // children is freed. 227 ps ImageFree(image);227 psFree(image); 228 228 } 229 229 } 230 230 231 231 // #548: Verify program execution doesn't stop, if the input psImage structure pointer is null. 232 ps ImageFree(NULL);232 psFree(NULL); 233 233 234 234 // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with multiple … … 238 238 psImageSubset(NULL,image,50,50,20,20); 239 239 240 ps ImageFree(image);240 psFree(image); 241 241 242 242 return 0; … … 501 501 } 502 502 503 ps ImageFree(original);503 psFree(original); 504 504 505 505 return 0; … … 599 599 } 600 600 601 ps ImageFree(img);602 ps ImageFree(img2);601 psFree(img); 602 psFree(img2); 603 603 604 604 return 0; … … 678 678 return 2; \ 679 679 } \ 680 ps ImageFree(img);680 psFree(img); 681 681 682 682 #define testImageClipByComplexType(datatype) \ … … 718 718 return 2; \ 719 719 } \ 720 ps ImageFree(img);720 psFree(img); 721 721 722 722 psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F64 imagery"); … … 824 824 return 2; \ 825 825 } \ 826 ps ImageFree(img);826 psFree(img); 827 827 828 828 testImageClipNaNByType(F32); … … 906 906 } \ 907 907 } \ 908 ps ImageFree(img); \909 ps ImageFree(img2);908 psFree(img); \ 909 psFree(img2); 910 910 911 911 #define testOverlayType(DATATYPE) \ … … 1016 1016 } 1017 1017 1018 ps ImageFree(img);1019 ps ImageFree(img2);1018 psFree(img); 1019 psFree(img2); 1020 1020 1021 1021 return 0; -
trunk/psLib/test/image/tst_psImageFFT.c
r1014 r1073 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06- 12 19:46:04$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-23 23:00:17 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 116 116 } 117 117 118 ps ImageFree(img);119 ps ImageFree(img2);120 ps ImageFree(img3);118 psFree(img); 119 psFree(img2); 120 psFree(img3); 121 121 122 122 return 0; … … 181 181 } 182 182 183 ps ImageFree(img);184 ps ImageFree(img2);185 ps ImageFree(img3);183 psFree(img); 184 psFree(img2); 185 psFree(img3); 186 186 187 187 return 0; … … 265 265 } 266 266 267 ps ImageFree(img);268 ps ImageFree(img2);269 ps ImageFree(img3);267 psFree(img); 268 psFree(img2); 269 psFree(img3); 270 270 271 271 return 0; … … 311 311 } 312 312 313 ps ImageFree(img);314 ps ImageFree(img2);313 psFree(img); 314 psFree(img2); 315 315 316 316 return 0; … … 359 359 } 360 360 361 ps ImageFree(img);362 ps ImageFree(img2);363 364 return 0; 365 } 361 psFree(img); 362 psFree(img2); 363 364 return 0; 365 } -
trunk/psLib/test/image/tst_psImageIO.c
r1001 r1073 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06- 11 19:18:41$8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-23 23:00:17 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 107 107 return 4; \ 108 108 } \ 109 ps ImageFree(img); \109 psFree(img); \ 110 110 img_ref = img = psImageAlloc(2,2,PS_TYPE_F32); \ 111 ps ImageFree(img3); \111 psFree(img3); \ 112 112 img3 = NULL; \ 113 113 img = psImageReadSection(img,readM0,readN0,readM,readN,0,NULL,0,filename); \ … … 139 139 } \ 140 140 } \ 141 ps ImageFree(img); \141 psFree(img); \ 142 142 img = NULL; \ 143 ps ImageFree(img3); \143 psFree(img3); \ 144 144 img3 = NULL; \ 145 145 img3 = psImageReadSection(img3,readM0,readN0,readM,readN,0,NULL,1,filename); \ … … 167 167 } \ 168 168 } \ 169 ps ImageFree(img); \170 ps ImageFree(img2); \171 ps ImageFree(img3); \172 ps ImageFree(img4); \169 psFree(img); \ 170 psFree(img2); \ 171 psFree(img3); \ 172 psFree(img4); \ 173 173 } 174 174 … … 302 302 return 15; 303 303 } 304 ps ImageFree(img);305 ps ImageFree(img2);304 psFree(img); 305 psFree(img2); 306 306 307 307 // Did it really overwrite the pixel values? Let's read it in and see. … … 322 322 } 323 323 324 ps ImageFree(img);324 psFree(img); 325 325 326 326 return 0; -
trunk/psLib/test/image/tst_psImageStats00.c
r1041 r1073 96 96 myHist->nums->data.S32[i]); 97 97 } 98 ps HistogramFree(myHist);98 psFree(myHist); 99 99 100 100 psMemCheckCorruption(1); … … 133 133 "psImageStats functions", 134 134 "Deallocate the psHistogram/psImage structure."); 135 ps HistogramFree(myHist);136 ps ImageFree(tmpImage);137 ps ImageFree(tmpMask);135 psFree(myHist); 136 psFree(tmpImage); 137 psFree(tmpMask); 138 138 139 139 psMemCheckCorruption(1); … … 167 167 168 168 psMemCheckCorruption(1); 169 ps HistogramFree(myHist);170 ps ImageFree(tmpImage);169 psFree(myHist); 170 psFree(tmpImage); 171 171 psMemCheckCorruption(1); 172 172 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); -
trunk/psLib/test/image/tst_psImageStats01.c
r904 r1073 123 123 "psImageStats functions", 124 124 "Deallocate the psStats/psImage structure."); 125 ps StatsFree(myStats);126 ps ImageFree(tmpImage);127 ps ImageFree(tmpMask);125 psFree(myStats); 126 psFree(tmpImage); 127 psFree(tmpMask); 128 128 129 129 psMemCheckCorruption(1); … … 165 165 // 166 166 167 ps StatsFree(myStats);168 ps ImageFree(tmpImage);169 ps ImageFree(tmpMask);167 psFree(myStats); 168 psFree(tmpImage); 169 psFree(tmpMask); 170 170 171 171 psMemCheckCorruption(1); -
trunk/psLib/test/image/tst_psImageStats02.c
r1072 r1073 102 102 "psImageStats functions", 103 103 "Deallocate the psStats/psImage structure."); 104 ps StatsFree(myStats);105 ps ImageFree(tmpImage);106 ps ImageFree(outImage);107 ps Polynomial2DFree(my2DPoly);104 psFree(myStats); 105 psFree(tmpImage); 106 psFree(outImage); 107 psFree(my2DPoly); 108 108 109 109 psMemCheckCorruption(1); -
trunk/psLib/test/image/verified/tst_psImageStats02.stdout
r1034 r1073 5 5 \**********************************************************************************/ 6 6 7 SUM(Cheby(0) * Cheby(0)) is 3.000000 8 SUM(Cheby(0) * Cheby(1)) is -0.000000 9 SUM(Cheby(0) * Cheby(2)) is 0.000000 10 SUM(Cheby(1) * Cheby(0)) is -0.000000 11 SUM(Cheby(1) * Cheby(1)) is 1.500000 12 SUM(Cheby(1) * Cheby(2)) is 0.000000 13 SUM(Cheby(2) * Cheby(0)) is 0.000000 14 SUM(Cheby(2) * Cheby(1)) is 0.000000 15 SUM(Cheby(2) * Cheby(2)) is 1.500000 16 Cheby Polynomial (0, 0) coefficient is 6.000000 17 Cheby Polynomial (0, 1) coefficient is 1.154701 18 Cheby Polynomial (0, 2) coefficient is 0.000000 19 Cheby Polynomial (1, 0) coefficient is 5.773502 20 Cheby Polynomial (1, 1) coefficient is -0.000000 21 Cheby Polynomial (1, 2) coefficient is -0.000000 22 Cheby Polynomial (2, 0) coefficient is 0.000000 23 Cheby Polynomial (2, 1) coefficient is 0.000000 24 Cheby Polynomial (2, 2) coefficient is 0.000000 7 25 8 26 ---> TESTPOINT PASSED (psImageStats functions{Calculate Chebyshev Polynomials, no mask} | tst_psImageStats02.c) -
trunk/psLib/test/sysUtils/builddir/atst_psAbort_01.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/atst_psAbort_02.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/atst_psAbort_03.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psError.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psHash00.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psHash01.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psHash02.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psHash03.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psHash04.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psLogMsg00.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psLogMsg01.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psLogMsg02.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psLogMsg03.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psMemory.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h -
trunk/psLib/test/sysUtils/builddir/tst_psStringCopy.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psTrace00.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psTrace01.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psTrace02.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psTrace03.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/builddir/tst_psTrace04.d
r1004 r1073 3 3 ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \ 4 4 ../../include/psString.h ../../include/psType.h ../../include/psList.h \ 5 ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \ 5 ../../include/psVector.h ../../include/psHash.h \ 6 ../../include/psScalar.h ../../include/psImage.h \ 6 7 ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \ 7 ../../include/psMatrix.h ../../include/ps FFT.h \8 ../../include/ps ImageIO.h ../../include/psTest.h8 ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \ 9 ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h -
trunk/psLib/test/sysUtils/tst_psHash00.c
r881 r1073 53 53 testStatus); 54 54 55 ps HashFree(myHashTable, NULL);55 psFree(myHashTable); 56 56 57 memLeaks = psMemCheckLeaks(currentId,NULL, NULL);57 memLeaks = psMemCheckLeaks(currentId,NULL,stderr); 58 58 if (0 != memLeaks) { 59 59 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); -
trunk/psLib/test/sysUtils/tst_psHash01.c
r881 r1073 14 14 } 15 15 ID; 16 17 static void IdFree(ID *id); 18 16 19 static ID *IdAlloc(const char *name) 17 20 { 18 21 ID *id = psAlloc(sizeof(ID)); 22 p_psMemSetDeallocator(id,(psFreeFcn)IdFree); 19 23 id->name = psStringCopy(name); 20 24 … … 26 30 imGlobal++; 27 31 psFree(id->name); 28 psFree(id);29 32 } 30 33 … … 34 37 int testStatus = true; 35 38 int currentId = psMemGetId(); 39 ID* id = NULL; 36 40 int memLeaks = 0; 37 41 … … 41 45 42 46 myHashTable = psHashAlloc(NUM_HASH_TABLE_BUCKETS); 43 psHashInsert(myHashTable, "ENTRY00", IdAlloc("IDA"), 44 (void (*)(void *))IdFree); 45 psHashInsert(myHashTable, "ENTRY01", IdAlloc("IDB"), 46 (void (*)(void *))IdFree); 47 psHashInsert(myHashTable, "ENTRY02", IdAlloc("IDC"), 48 (void (*)(void *))IdFree); 49 psHashInsert(myHashTable, "ENTRY03", IdAlloc("IDD"), 50 (void (*)(void *))IdFree); 51 psHashFree(myHashTable, (void (*)(void *))IdFree); 47 id = IdAlloc("IDA"); 48 psHashInsert(myHashTable, "ENTRY00", id); 49 psFree(id); 50 id = IdAlloc("IDB"); 51 psHashInsert(myHashTable, "ENTRY01", id); 52 psFree(id); 53 id = IdAlloc("IDC"); 54 psHashInsert(myHashTable, "ENTRY02", id); 55 psFree(id); 56 id = IdAlloc("IDD"); 57 psHashInsert(myHashTable, "ENTRY03", id); 58 psFree(id); 59 psFree(myHashTable); 52 60 53 61 if (imGlobal != 4) { -
trunk/psLib/test/sysUtils/tst_psHash02.c
r1022 r1073 19 19 } 20 20 ID; 21 static void IdFree(ID *id); 22 21 23 static ID *IdAlloc(const char *name) 22 24 { 23 25 ID *id = psAlloc(sizeof(ID)); 26 p_psMemSetDeallocator(id,(psFreeFcn)IdFree); 24 27 id->name = psStringCopy(name); 25 28 … … 31 34 imGlobal++; 32 35 psFree(id->name); 33 psFree(id);34 36 } 35 37 … … 52 54 i = 0; 53 55 while (myKeys[i] != NULL) { 54 psHashInsert(myHashTable, myKeys[i], IdAlloc(myData[i]), 55 (void (*)(void *))IdFree); 56 id = IdAlloc(myData[i]); 57 psHashInsert(myHashTable, myKeys[i], id); 58 psFree(id); 56 59 i++; 57 60 } … … 78 81 79 82 // psHashFree(myHashTable, NULL); 80 ps HashFree(myHashTable, (void (*)(void *))IdFree);83 psFree(myHashTable); 81 84 82 85 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); -
trunk/psLib/test/sysUtils/tst_psHash03.c
r1022 r1073 19 19 } 20 20 ID; 21 static void IdFree(ID *id); 21 22 22 23 // NOTE: This is my own little routine I used in debugging a memory … … 48 49 49 50 id = psAlloc(sizeof(ID)); 51 p_psMemSetDeallocator(id,(psFreeFcn)IdFree); 50 52 51 53 id->name = psStringCopy(name); … … 58 60 imGlobal++; 59 61 psFree(id->name); 60 psFree(id);61 62 } 62 63 … … 82 83 i = 0; 83 84 while (myKeys[i] != NULL) { 84 psHashInsert(myHashTable, myKeys[i], IdAlloc(myData[i]), 85 (void (*)(void *))IdFree); 85 psHashInsert(myHashTable, myKeys[i], IdAlloc(myData[i])); 86 86 i++; 87 87 } … … 101 101 i = 0; 102 102 while (myKeys[i] != NULL) { 103 id = psHashRemove(myHashTable, myKeys[i] , (void (*)(void *))IdFree);103 id = psHashRemove(myHashTable, myKeys[i]); 104 104 // The psHashRemove() procedure removes the entry from the hash 105 105 // table, but does not delete the data. The following is necessary 106 106 // to delete the data as well (which is returned from the call). 107 IdFree(id);107 psFree(id); 108 108 id = psHashLookup(myHashTable, myKeys[i]); 109 109 if (id != NULL) { … … 119 119 testStatus); 120 120 121 ps HashFree(myHashTable, (void (*)(void *))IdFree);122 memLeaks = psMemCheckLeaks(currentId,NULL, NULL);121 psFree(myHashTable); 122 memLeaks = psMemCheckLeaks(currentId,NULL,stdout); 123 123 if (0 != memLeaks) { 124 124 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); -
trunk/psLib/test/sysUtils/tst_psHash04.c
r929 r1073 14 14 } 15 15 ID; 16 static void IdFree(ID *id); 17 16 18 static ID *IdAlloc(const char *name) 17 19 { 18 20 ID *id = psAlloc(sizeof(ID)); 21 p_psMemSetDeallocator(id,(psFreeFcn)IdFree); 22 19 23 id->name = psStringCopy(name); 20 24 … … 26 30 imGlobal++; 27 31 psFree(id->name); 28 psFree(id);29 32 } 30 33 … … 40 43 psList *myLinkList = NULL; 41 44 psListElem *tmp = NULL; 45 ID* id = NULL; 42 46 43 47 printPositiveTestHeader(stdout, … … 48 52 i = 0; 49 53 while (myKeys[i] != NULL) { 50 psHashInsert(myHashTable, myKeys[i], IdAlloc(myData[i]), 51 (void (*)(void *))IdFree); 54 id = IdAlloc(myData[i]); 55 psHashInsert(myHashTable, myKeys[i], id); 56 psFree(id); 52 57 i++; 53 58 } … … 59 64 } 60 65 61 ps ListFree(myLinkList, NULL);66 psFree(myLinkList); 62 67 63 68 printFooter(stdout, … … 66 71 testStatus); 67 72 68 ps HashFree(myHashTable, (void (*)(void *))IdFree);73 psFree(myHashTable); 69 74 70 memLeaks = psMemCheckLeaks(currentId,NULL, NULL);75 memLeaks = psMemCheckLeaks(currentId,NULL,stderr); 71 76 if (0 != memLeaks) { 72 77 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); -
trunk/psLib/test/sysUtils/verified/tst_psMemory.stderr
r1034 r1073 81 81 <DATE> <TIME> <HOST> |I|TPmemCorruption|psMemCheckCorruption should output an error message and memProblemCallback callback should be called. 82 82 <DATE> <TIME> <HOST> |E|psMemCheckCorru|psMemCheckCorruption: memory block 1 is corrupted (buffer underflow) 83 <DATE> <TIME> <HOST> |I|memProblemCallb|memory callback called for id 1 (psMemCheckCorruption:22 8).83 <DATE> <TIME> <HOST> |I|memProblemCallb|memory callback called for id 1 (psMemCheckCorruption:226). 84 84 85 85 ---> TESTPOINT PASSED (psMemory{455-TPmemCorruption} | tst_psMemory.c)
Note:
See TracChangeset
for help on using the changeset viewer.
