Return the next element of an iterator. * It's valid to remove the currently returned element using * listDelNode(), but not to remove other elements. * * The function returns a pointer to the next element of the list, * or NULL if there are no more elements, so the classical usage * pattern is: * * iter = listGetIterator(list, ); * while ((node = listNext(iter)) != NULL) { *
| 228 | * |
| 229 | * */ |
| 230 | listNode *listNext(listIter *iter) |
| 231 | { |
| 232 | listNode *current = iter->next; |
| 233 | |
| 234 | if (current != NULL) { |
| 235 | if (iter->direction == AL_START_HEAD) |
| 236 | iter->next = current->next; |
| 237 | else |
| 238 | iter->next = current->prev; |
| 239 | } |
| 240 | return current; |
| 241 | } |
| 242 | |
| 243 | /* Duplicate the whole list. On out of memory NULL is returned. |
| 244 | * On success a copy of the original list is returned. |
no outgoing calls
no test coverage detected