src/list.c
/** insert the element at the tail of the list if it is not already in the list */
insert the element at the tail of the list if it is not already in the list
insert the element at the tail of the list if it is not already in the list
void dllist_insert_tail_unique(dllist_node_st **head, dllist_node_st *item)
{
    dllist_node_st *p;
    if (*head == NULL) {
        item->prev = NULL;
        item->next = NULL;
        *head = item;
        return;
    }
    p = *head;
    while (1) {
        if (p == item) {
            return;
        }
        if (p->next == NULL) {
            item->next = NULL;
            item->prev = p;
            p->next = item;
            return;
        }
        p = p->next;
    }
}
void dllist_insert_tail_unique ( dllist_node_st * * head , dllist_node_st * item ) { dllist_node_st * p ; if ( * head == NULL ) { item -> prev = NULL ; item -> next = NULL ; * head = item ; return ; } p = * head ; while ( 1 ) { if ( p == item ) { return ; } if ( p -> next == NULL ) { item -> next = NULL ; item -> prev = p ; p -> next = item ; return ; } p = p -> next ; } }
insert the element at the tail of the list if it is not already in the list
insert the element at the tail of the list if it is not already in the list