Changeset 4342 for trunk/psLib/src/collections/psArray.c
- Timestamp:
- Jun 21, 2005, 4:05:41 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psArray.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psArray.c
r4312 r4342 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 29$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-06- 18 00:53:32$11 * @version $Revision: 1.30 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-22 02:05:41 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 49 49 FUNCTION IMPLEMENTATION - PUBLIC 50 50 *****************************************************************************/ 51 psArray* psArrayAlloc( psU32nalloc)51 psArray* psArrayAlloc(unsigned long nalloc) 52 52 { 53 53 psArray* psArr = NULL; … … 66 66 } 67 67 68 psArray* psArrayRealloc(psArray* in, psU32nalloc)68 psArray* psArrayRealloc(psArray* in, unsigned long nalloc) 69 69 { 70 70 if (in == NULL) { … … 159 159 160 160 /// Set an element in the array. 161 psBool psArraySet(psArray* in,///< input array to set element in162 psU32 position,///< the element position to set163 void* value)///< the value to set it to164 { 165 if ( in== NULL)161 bool psArraySet(psArray* array, ///< input array to set element in 162 unsigned long position, ///< the element position to set 163 psPtr data) ///< the value to set it to 164 { 165 if (array == NULL) 166 166 { 167 167 psError(PS_ERR_BAD_PARAMETER_NULL, true, … … 170 170 } 171 171 172 if (position >= in->nalloc)172 if (position >= array->nalloc) 173 173 { 174 174 psError(PS_ERR_BAD_PARAMETER_NULL, true, 175 175 PS_ERRORTEXT_psArray_POSITION_BEYOND_NALLOC, 176 position, in->nalloc);176 position, array->nalloc); 177 177 return false; 178 178 } 179 179 180 psFree( in->data[position]);181 in->data[position] = value;180 psFree(array->data[position]); 181 array->data[position] = data; 182 182 183 183 return true; … … 185 185 186 186 /// Get an element in the array. 187 void* psArrayGet(psArray* in, psU32position )188 { 189 if ( in== NULL) {187 psPtr psArrayGet(const psArray* array, unsigned long position ) 188 { 189 if (array == NULL) { 190 190 psError(PS_ERR_BAD_PARAMETER_NULL, true, 191 191 PS_ERRORTEXT_psArray_ARRAY_NULL); … … 193 193 } 194 194 195 if (position >= in->nalloc) {195 if (position >= array->nalloc) { 196 196 psError(PS_ERR_BAD_PARAMETER_NULL, true, 197 197 PS_ERRORTEXT_psArray_POSITION_BEYOND_NALLOC, 198 position, in->nalloc);199 return NULL; 200 } 201 202 return in->data[position];203 } 204 205 206 207 198 position, array->nalloc); 199 return NULL; 200 } 201 202 return array->data[position]; 203 } 204 205 206 207
Note:
See TracChangeset
for help on using the changeset viewer.
