Changeset 8804
- Timestamp:
- Sep 12, 2006, 11:55:49 AM (20 years ago)
- Location:
- trunk/psLib/src/types
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/types/psArray.c
r8799 r8804 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.5 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-09-12 21: 08:15$11 * @version $Revision: 1.51 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-09-12 21:55:49 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 27 27 #include "psArray.h" 28 28 #include "psLogMsg.h" 29 #include "psAssert.h" 29 30 30 31 … … 158 159 } 159 160 161 bool psArrayRemoveByPos(psArray* array, 162 long position) 163 { 164 PS_ASSERT_PTR_NON_NULL(array, false); 165 166 if (position > array->n) { 167 psError(PS_ERR_BAD_PARAMETER_NULL, true, 168 _("position > then the number of elements in the array.")); 169 return false; 170 } 171 172 long i = position; 173 long n = array->n; 174 psFree(array->data[i]); 175 memmove(&array->data[i], &array->data[i + 1], (n - i - 1) * sizeof(psPtr)); 176 array->n = --i; // reset the array size to indicate the removed item(s) 177 178 return true; 179 } 180 160 181 void psArrayElementsFree(psArray* array) 161 182 { -
trunk/psLib/src/types/psArray.h
r8798 r8804 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.3 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2006-09-12 21: 04:11$13 * @version $Revision: 1.39 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2006-09-12 21:55:49 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 97 97 ); 98 98 99 /** Remove an element from the array 99 /** Remove an element from the array by it's pointer 100 100 * 101 101 * Finds and removes the specified data pointer from the list. … … 108 108 psArray* array, ///< array to operate on 109 109 const psPtr data ///< the data pointer to remove from psArray 110 ); 111 112 /** Remove an element from the array 113 * 114 * Finds and removes the elements as the specified position 115 * 116 * @return bool: TRUE if the specified data pointer was found and removed, 117 * otherwise FALSE. 118 * 119 */ 120 bool psArrayRemoveByPos( 121 psArray* array, ///< array to operate on 122 long position ///< the element to remove 110 123 ); 111 124 -
trunk/psLib/src/types/psMetadataConfig.c
r8794 r8804 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.8 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-09-12 04:18:56$12 * @version $Revision: 1.85 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-09-12 21:55:49 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1118 1118 } else { 1119 1119 // Remove lower info level 1120 if(!psArrayRemove (levelArray,levelArray->data[*level])) {1120 if(!psArrayRemoveByPos(levelArray, *level)) { 1121 1121 psFree(keyName); 1122 1122 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
