Changeset 1193 for trunk/psLib/src/collections/psList.c
- Timestamp:
- Jul 7, 2004, 3:05:01 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psList.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psList.c
r1127 r1193 6 6 * @author Robert Daniel DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-0 6-29 23:19:11$8 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-07-08 01:05:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 80 80 } 81 81 82 psList*psListAdd(psList *list, void *data, int where)82 bool psListAdd(psList *list, void *data, int where) 83 83 { 84 84 psListElem* position; … … 87 87 88 88 if (list == NULL) { 89 return NULL;89 return false; 90 90 } 91 91 92 92 if (data == NULL) { 93 return list; 94 } 95 elem = psAlloc(sizeof(psListElem)); 96 97 pthread_mutex_lock(&list->lock) 98 ; 93 return false; 94 } 99 95 100 96 if (where <= PS_LIST_UNKNOWN) { 101 97 /// XXX What is the better way to communicate this failure to the caller? 102 98 psLogMsg(__func__,PS_LOG_WARN, 103 "The given insert location (%i) for psListAdd is invalid. Adding to head instead.",99 "The given insert location (%i) for psListAdd is invalid.", 104 100 where); 105 where = PS_LIST_HEAD; // given I can't tell caller about this, should just add it somewhere??? 106 } 101 return false; 102 } 103 104 elem = psAlloc(sizeof(psListElem)); 105 106 pthread_mutex_lock(&list->lock) 107 ; 107 108 108 109 if (where > 0 && where > list->size) { … … 162 163 ; 163 164 164 return list; 165 } 166 167 /*****************************************************************************/ 168 169 psList *psListAppend(psList *list, void *data) 170 { 171 return psListAdd(list, data, PS_LIST_TAIL); 165 return true; 172 166 } 173 167 … … 452 446 n = arr->n; 453 447 for (int i = 0; i < n; i++) { 454 psListA ppend(list,arr->data.PTR[i]);448 psListAdd(list,arr->data.PTR[i],PS_LIST_TAIL); 455 449 } 456 450
Note:
See TracChangeset
for help on using the changeset viewer.
