Rotate the list removing the head node and inserting it to the tail. */
| 344 | |
| 345 | /* Rotate the list removing the head node and inserting it to the tail. */ |
| 346 | void listRotateHeadToTail(list *list) { |
| 347 | if (listLength(list) <= 1) return; |
| 348 | |
| 349 | listNode *head = list->head; |
| 350 | /* Detach current head */ |
| 351 | list->head = head->next; |
| 352 | list->head->prev = NULL; |
| 353 | /* Move it as tail */ |
| 354 | list->tail->next = head; |
| 355 | head->next = NULL; |
| 356 | head->prev = list->tail; |
| 357 | list->tail = head; |
| 358 | } |
| 359 | |
| 360 | /* Add all the elements of the list 'o' at the end of the |
| 361 | * list 'l'. The list 'other' remains empty but otherwise valid. */ |
no outgoing calls
no test coverage detected