Changeset 3165 for trunk/psLib/src/collections/psArray.c
- Timestamp:
- Feb 8, 2005, 3:04:01 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psArray.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psArray.c
r3115 r3165 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-02-0 3 00:54:10$11 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-02-09 01:04:01 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 157 157 return in; 158 158 } 159 160 /// Set an element in the array. 161 psBool psArraySet(psArray* in, ///< input array to set element in 162 psU32 position, ///< the element position to set 163 void* value) ///< the value to set it to 164 { 165 if (in == NULL) 166 { 167 psError(PS_ERR_BAD_PARAMETER_NULL, true, 168 PS_ERRORTEXT_psArray_ARRAY_NULL); 169 return false; 170 } 171 172 if (position >= in->nalloc) 173 { 174 psError(PS_ERR_BAD_PARAMETER_NULL, true, 175 PS_ERRORTEXT_psArray_POSITION_BEYOND_NALLOC, 176 position, in->nalloc); 177 return false; 178 } 179 180 psFree(in->data[position]); 181 in->data[position] = value; 182 183 return true; 184 } 185 186 /// Get an element in the array. 187 void* psArrayGet(psArray* in, psU32 position ) 188 { 189 if (in == NULL) { 190 psError(PS_ERR_BAD_PARAMETER_NULL, true, 191 PS_ERRORTEXT_psArray_ARRAY_NULL); 192 return NULL; 193 } 194 195 if (position >= in->nalloc) { 196 psError(PS_ERR_BAD_PARAMETER_NULL, true, 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
Note:
See TracChangeset
for help on using the changeset viewer.
