Changeset 3107 for trunk/psLib/src/collections/psList.c
- Timestamp:
- Feb 2, 2005, 10:22:22 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psList.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psList.c
r3085 r3107 6 6 * @author Robert Daniel DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-0 1-25 01:04:17$8 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-02-02 20:21:48 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 137 137 138 138 // create a default iterator 139 psListIteratorAlloc(list,PS_LIST_HEAD );139 psListIteratorAlloc(list,PS_LIST_HEAD,true); 140 140 141 141 pthread_mutex_init(&(list->lock), NULL) … … 149 149 } 150 150 151 psListIterator* psListIteratorAlloc(psList* list, int location )151 psListIterator* psListIteratorAlloc(psList* list, int location, bool mutable) 152 152 { 153 153 psListIterator* iter = psAlloc(sizeof(psListIterator)); … … 160 160 iter->index = 0; 161 161 iter->offEnd = false; 162 iter->mutable = mutable; 162 163 163 164 // add to the list's array of iterators … … 201 202 iterator->offEnd = false; 202 203 return true; 204 } 205 206 if (location < 0) { 207 location = list->size + location; 203 208 } 204 209 … … 289 294 psError(PS_ERR_BAD_PARAMETER_NULL, true, 290 295 PS_ERRORTEXT_psList_ITERATOR_NULL); 296 return false; 297 } 298 299 // Check if the list pointed by the iterator can be changed 300 if (!iterator->mutable) { 301 psError(PS_ERR_BAD_PARAMETER_NULL, true, 302 PS_ERRORTEXT_psList_ITERATOR_NONMUTABLE); 291 303 return false; 292 304 } … … 360 372 } 361 373 374 // Check if the list pointed by the iterator can be changed 375 if (!iterator->mutable) { 376 psError(PS_ERR_BAD_PARAMETER_NULL, true, 377 PS_ERRORTEXT_psList_ITERATOR_NONMUTABLE); 378 return false; 379 } 380 362 381 psListElem* cursor = iterator->cursor; 363 382 psList* list = iterator->list; … … 493 512 * and now return the previous/next element of the list 494 513 */ 495 psPtr psListGet Next(psListIterator* iterator)514 psPtr psListGetAndIncrement(psListIterator* iterator) 496 515 { 497 516 if (iterator == NULL ) { … … 518 537 } 519 538 520 psPtr psListGet Previous(psListIterator* iterator)539 psPtr psListGetAndDecrement(psListIterator* iterator) 521 540 { 522 541 if (iterator == NULL ) {
Note:
See TracChangeset
for help on using the changeset viewer.
