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_remove(Dlist* list, DL_node* killme, int direction)
{
    if (killme != NULL)
    {
        void* killer_data = killme->data;
        // take care of head and marker pointers.
        if (list->marker == killme)
            _dlist_mark_move(list, direction);
        if (killme == list->head->next)
            list->head->next = killme->next;
        if (killme == list->head->prev)
            list->head->prev = killme->prev;
        // remove from list
        if (killme->prev != NULL)
            killme->prev->next = killme->next;
        if (killme->next != NULL)
            killme->next->prev = killme->prev;
        list->count--;
        free(killme);
        return (killer_data);
    }
    else
        return (NULL);
}
/*
 * Remove DL_node from list without deallocating data.
 * if marker == killme .
 *  when direction true it moves marker after
 *  when direction false it moves marker before.
 * to previous if there is no next.
 */
Remove DL_node from list without deallocating data.
if marker == killme .
when direction true it moves marker after
when direction false it moves marker before.
to previous if there is no next.
Remove DL_node from list without deallocating data . if marker == killme . when direction true it moves marker after when direction false it moves marker before . to previous if there is no next .
void* _dlist_remove(Dlist* list, DL_node* killme, int direction)
{
    if (killme != NULL)
    {
        void* killer_data = killme->data;
        if (list->marker == killme)
            _dlist_mark_move(list, direction);
        if (killme == list->head->next)
            list->head->next = killme->next;
        if (killme == list->head->prev)
            list->head->prev = killme->prev;
        if (killme->prev != NULL)
            killme->prev->next = killme->next;
        if (killme->next != NULL)
            killme->next->prev = killme->prev;
        list->count--;
        free(killme);
        return (killer_data);
    }
    else
        return (NULL);
}
void * _dlist_remove ( Dlist * list , DL_node * killme , int direction ) { if ( killme != NULL ) { void * killer_data = killme -> data ; if ( list -> marker == killme ) _dlist_mark_move ( list , direction ) ; if ( killme == list -> head -> next ) list -> head -> next = killme -> next ; if ( killme == list -> head -> prev ) list -> head -> prev = killme -> prev ; if ( killme -> prev != NULL ) killme -> prev -> next = killme -> next ; if ( killme -> next != NULL ) killme -> next -> prev = killme -> prev ; list -> count -- ; free ( killme ) ; return ( killer_data ) ; } else return ( NULL ) ; }
Remove DL_node from list without deallocating data.
Remove DL_node from list without deallocating data .
// take care of head and marker pointers. // remove from list