Changeset 1228 for trunk/psLib/src/collections/psVector.c
- Timestamp:
- Jul 15, 2004, 12:18:02 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psVector.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psVector.c
r1103 r1228 8 8 * @author Ross Harman, MHPCC 9 9 * 10 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-0 6-26 00:24:30$10 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-07-15 22:18:02 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 100 100 elementSize = PSELEMTYPE_SIZEOF(elemType); 101 101 if(nalloc < in->n) { 102 if (elemType == PS_TYPE_PTR) {103 for (int i = nalloc; i < in->n; i++) { // For reduction in vector size104 psMemDecrRefCounter(in->data.PTR[i]);105 }106 }107 102 in->n = nalloc; 108 103 } … … 139 134 140 135 141 // if vector of pointers, dereference old values.142 if (elemType == PS_TYPE_PTR) {143 for (int i = 0; i < in->n; i++) { // For reduction in vector size144 psMemDecrRefCounter(in->data.PTR[i]);145 in->data.PTR[i] = NULL;146 }147 }148 149 136 in->data.V = psRealloc(in->data.V,nalloc*PSELEMTYPE_SIZEOF(type)); 150 137 … … 162 149 } 163 150 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 171 151 psFree(psVec->data.V); 172 152 } 173 174 void psVectorElementFree(psVector *restrict psVec)175 {176 177 if(psVec == NULL) {178 return;179 }180 181 if (psVec->type.type != PS_TYPE_PTR) {182 psLogMsg(__func__,PS_LOG_WARN,"psVectorElementFree only operates on void* vectors");183 return;184 }185 186 for(int i = 0; i < psVec->n; i++) {187 psFree(psVec->data.PTR[i]);188 psVec->data.PTR[i] = NULL;189 }190 }191
Note:
See TracChangeset
for help on using the changeset viewer.
