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

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