src/adlist.c
void listRotateHeadToTail(list *list) {
    if (listLength(list) <= 1) return;

    listNode *head = list->head;
    /* Detach current head */
    list->head = head->next;
    list->head->prev = NULL;
    /* Move it as tail */
    list->tail->next = head;
    head->next = NULL;
    head->prev = list->tail;
    list->tail = head;
}
/* Rotate the list removing the head node and inserting it to the tail. */
Rotate the list removing the head node and inserting it to the tail.
Rotate the list removing the head node and inserting it to the tail .
void listRotateHeadToTail(list *list) {
    if (listLength(list) <= 1) return;
    listNode *head = list->head;
    list->head = head->next;
    list->head->prev = NULL;
    list->tail->next = head;
    head->next = NULL;
    head->prev = list->tail;
    list->tail = head;
}
void listRotateHeadToTail ( list * list ) { if ( listLength ( list ) <= 1 ) return ; listNode * head = list -> head ; list -> head = head -> next ; list -> head -> prev = NULL ; list -> tail -> next = head ; head -> next = NULL ; head -> prev = list -> tail ; list -> tail = head ; }
Rotate the list removing the head node and inserting it to the tail.
Rotate the list removing the head node and inserting it to the tail .
/* Detach current head */ /* Move it as tail */