Changeset 1073 for trunk/psLib/test/collections/tst_psVector_03.c
- Timestamp:
- Jun 23, 2004, 1:00:17 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/collections/tst_psVector_03.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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) {
Note:
See TracChangeset
for help on using the changeset viewer.
