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