Changeset 1385 for trunk/psLib/src/collections/psArray.c
- Timestamp:
- Aug 4, 2004, 1:37:39 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psArray.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psArray.c
r1228 r1385 8 8 * @author Ross Harman, MHPCC 9 9 * 10 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-0 7-15 22:18:02$10 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-04 23:37:39 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 67 67 psError(__func__, "Null input vector\n"); 68 68 return NULL; 69 } else if(in->nalloc != nalloc) { // No need to realloc to same size 70 if(nalloc < in->n) { 71 for (int i = nalloc; i < in->n; i++) { // For reduction in vector size 72 psFree(in->data[i]); 69 } else 70 if(in->nalloc != nalloc) { // No need to realloc to same size 71 if(nalloc < in->n) { 72 for (int i = nalloc; i < in->n; i++) { // For reduction in vector size 73 psFree(in->data[i]); 74 } 75 in->n = nalloc; 73 76 } 74 in->n = nalloc; 77 78 // Realloc after decrementation to avoid accessing freed array elements 79 in->data = psRealloc(in->data,nalloc*sizeof(psPTR)); 80 in->nalloc = nalloc; 75 81 } 76 77 // Realloc after decrementation to avoid accessing freed array elements78 in->data = psRealloc(in->data,nalloc*sizeof(psPTR));79 in->nalloc = nalloc;80 }81 82 82 83 return in;
Note:
See TracChangeset
for help on using the changeset viewer.
