Changeset 18955
- Timestamp:
- Aug 8, 2008, 8:06:27 AM (18 years ago)
- Location:
- trunk/psLib/src/types
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/types/psList.c
r18825 r18955 7 7 * @author Joshua Hoblitt, University of Hawaii 8 8 * 9 * @version $Revision: 1.7 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2008-0 7-31 23:41:04$9 * @version $Revision: 1.71 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2008-08-08 18:06:27 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 457 457 458 458 // simultaneous get and remove (ie, 'pop') 459 psPtr psListGetAndRemove (psList *list, long location) {459 psPtr psListGetAndRemove(psList *list, long location) { 460 460 461 461 PS_ASSERT_LIST_NON_NULL(list, NULL); 462 462 463 // empty list : 463 // empty list : 464 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); 465 if (list->head == NULL) { 466 return NULL; 467 } 468 469 psPtr *item = psListGet (list, location); // Item of interest 470 if (psMemIncrRefCounter(item)) { // To prevent psListRemove from killing the item before it gets out 471 psListRemove(list, location); 472 } 473 470 474 return item; 471 475 } -
trunk/psLib/src/types/psList.h
r18825 r18955 5 5 * @author Robert Daniel DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.4 7$ $Name: not supported by cvs2svn $8 * @date $Date: 2008-0 7-31 23:41:04$7 * @version $Revision: 1.48 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-08-08 18:06:27 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 215 215 * NULL is returned. 216 216 */ 217 psPtr psListGetAndRemove (218 psList *list, ///< list from which to get and remove the element219 long location ///< index of item217 psPtr psListGetAndRemove( 218 psList *list, ///< list from which to get and remove the element 219 long location ///< index of item 220 220 ); 221 221
Note:
See TracChangeset
for help on using the changeset viewer.
