Changeset 4307 for trunk/psLib/src/collections/psArray.c
- Timestamp:
- Jun 17, 2005, 1:39:51 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psArray.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psArray.c
r3682 r4307 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-0 4-07 20:27:41 $11 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-17 23:39:51 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 109 109 } 110 110 111 psBool psArrayRemove(psArray* psArr,112 psPtr data)113 { 114 psBool success = false;115 116 if ( psArr== NULL) {111 bool psArrayRemove(psArray* array, 112 const psPtr data) 113 { 114 bool success = false; 115 116 if (array == NULL) { 117 117 psError(PS_ERR_BAD_PARAMETER_NULL, true, 118 118 PS_ERRORTEXT_psArray_ARRAY_NULL); … … 120 120 } 121 121 122 psS32 n = psArr->n;123 psPtr* psArrData = psArr->data;122 psS32 n = array->n; 123 psPtr* psArrData = array->data; 124 124 for (psS32 i = n-1; i >= 0; i--) { 125 125 if (psArrData[i] == data) { 126 memmove(& psArr->data[i],&psArr->data[i+1],(n-i-1)*sizeof(psPtr));126 memmove(&array->data[i],&array->data[i+1],(n-i-1)*sizeof(psPtr)); 127 127 n--; 128 128 success = true; 129 129 } 130 130 } 131 psArr->n = n; // reset the array size to indicate the removed item(s)131 array->n = n; // reset the array size to indicate the removed item(s) 132 132 133 133 return success;
Note:
See TracChangeset
for help on using the changeset viewer.
