openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/sysfsutils/2.1.0-r5/sysfsutils-2.1.0/lib/dlist.c
void dlist_delete(Dlist* list, int direction)
{
    if ((list->marker != list->head) && (list->marker != NULL))
    {
        DL_node* corpse;
        corpse = list->marker;
        _dlist_mark_move(list, direction);
        if (list->head->next == corpse)
            list->head->next = corpse->next;
        if (list->head->prev == corpse)
            list->head->prev = corpse->prev;
        if (corpse->prev != NULL) // should be impossible
            corpse->prev->next = corpse->next;
        if (corpse->next != NULL) // should be impossible
            corpse->next->prev = corpse->prev;
        list->del_func(corpse->data);
        list->count--;
        free(corpse);
    }
}
/*
 * remove marker node from list
 * call data_delete function on data if registered.
 * otherwise call free.
 * when direction true it moves marker after
 * when direction false it moves marker before.
 * free marker node
 * return nothing.
 */
remove marker node from list
call data_delete function on data if registered.
otherwise call free.
when direction true it moves marker after
when direction false it moves marker before.
free marker node
return nothing.
remove marker node from list call data_delete function on data if registered . otherwise call free . when direction true it moves marker after when direction false it moves marker before . free marker node return nothing .
void dlist_delete(Dlist* list, int direction)
{
    if ((list->marker != list->head) && (list->marker != NULL))
    {
        DL_node* corpse;
        corpse = list->marker;
        _dlist_mark_move(list, direction);
        if (list->head->next == corpse)
            list->head->next = corpse->next;
        if (list->head->prev == corpse)
            list->head->prev = corpse->prev;
        if (corpse->prev != NULL) 
            corpse->prev->next = corpse->next;
        if (corpse->next != NULL) 
            corpse->next->prev = corpse->prev;
        list->del_func(corpse->data);
        list->count--;
        free(corpse);
    }
}
void dlist_delete ( Dlist * list , int direction ) { if ( ( list -> marker != list -> head ) && ( list -> marker != NULL ) ) { DL_node * corpse ; corpse = list -> marker ; _dlist_mark_move ( list , direction ) ; if ( list -> head -> next == corpse ) list -> head -> next = corpse -> next ; if ( list -> head -> prev == corpse ) list -> head -> prev = corpse -> prev ; if ( corpse -> prev != NULL ) corpse -> prev -> next = corpse -> next ; if ( corpse -> next != NULL ) corpse -> next -> prev = corpse -> prev ; list -> del_func ( corpse -> data ) ; list -> count -- ; free ( corpse ) ; } }
remove marker node from list
 call data_delete function on data if registered.
remove marker node from list call data_delete function on data if registered .
// should be impossible // should be impossible