Changeset 18750
- Timestamp:
- Jul 25, 2008, 5:49:12 PM (18 years ago)
- Location:
- branches/eam_branch_20080719/psLib/src/types
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080719/psLib/src/types/psList.c
r17515 r18750 7 7 * @author Joshua Hoblitt, University of Hawaii 8 8 * 9 * @version $Revision: 1.69 $ $Name: not supported by cvs2svn $10 * @date $Date: 2008-0 5-05 00:09:04$9 * @version $Revision: 1.69.8.1 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2008-07-26 03:49:12 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 437 437 PS_ASSERT_LIST_NON_NULL(list, NULL); 438 438 439 // XXX this should not be an error, right? 439 440 if (list->head == NULL) { // list empty? 440 441 psError(PS_ERR_BAD_PARAMETER_NULL, true, … … 453 454 454 455 return iterator->cursor->data; 456 } 457 458 // simultaneous get and remove (ie, 'pop') 459 psPtr psListGetAndRemove (psList *list, long location) { 460 461 PS_ASSERT_LIST_NON_NULL(list, NULL); 462 463 // empty list : 464 // XXX handle this explicitly since psListGet raises an error in this case 465 if (list->head == NULL) return NULL; 466 467 psPtr *item = psListGet (list, location); 468 469 psListRemove (list, location); 470 return item; 455 471 } 456 472 -
branches/eam_branch_20080719/psLib/src/types/psList.h
r14452 r18750 5 5 * @author Robert Daniel DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.46 $ $Name: not supported by cvs2svn $8 * @date $Date: 200 7-08-09 01:40:08$7 * @version $Revision: 1.46.20.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-07-26 03:49:12 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 208 208 ); 209 209 210 /** Retrieve an item from a list. 211 * 212 * @return psPtr the item corresponding to the location parameter. If 213 * location is invalid (e.g., a numbered index greater 214 * than the list size or if the list is empty), a 215 * NULL is returned. 216 */ 217 psPtr psListGetAndRemove ( 218 psList *list, ///< list from which to get and remove the element 219 long location ///< index of item 220 ); 210 221 211 222 /** Position the specified iterator to the next item in list.
Note:
See TracChangeset
for help on using the changeset viewer.
