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_move(struct dlist* source, struct dlist* dest,
                struct dl_node* target, int direction)
{

    if (target != NULL)
    {
        if (target == source->head)
        {
            // not even going to try
        }
        else
        {
            // take care of head and marker pointers.
            if (source->marker == target)
                _dlist_mark_move(source, direction);
            if (target == source->head->next)
                source->head->next = target->next;
            if (target == source->head->prev)
                source->head->prev = target->prev;
            // remove from list
            if (source->count == 1)
            {
                target->prev = NULL;
                target->next = NULL;
                source->head->next = NULL;
                source->head->prev = NULL;
            }
            else
            {
                if (target->prev != NULL)
                    target->prev->next = target->next;
                if (target->next != NULL)
                    target->next->prev = target->prev;
                target->prev = NULL;
                target->next = NULL;
            }
            source->count--;
            _dlist_insert_dlnode(dest, target, direction);
        }
    }
}
/*
 * move dl_node from source to dest
 * if marker == target .
 *  when direction true it moves marker after
 *  when direction false it moves marker before.
 * to previous if there is no next.
 */
move dl_node from source to dest
if marker == target .
when direction true it moves marker after
when direction false it moves marker before.
to previous if there is no next.
move dl_node from source to dest if marker == target . when direction true it moves marker after when direction false it moves marker before . to previous if there is no next .
void dlist_move(struct dlist* source, struct dlist* dest,
                struct dl_node* target, int direction)
{
    if (target != NULL)
    {
        if (target == source->head)
        {
        }
        else
        {
            if (source->marker == target)
                _dlist_mark_move(source, direction);
            if (target == source->head->next)
                source->head->next = target->next;
            if (target == source->head->prev)
                source->head->prev = target->prev;
            if (source->count == 1)
            {
                target->prev = NULL;
                target->next = NULL;
                source->head->next = NULL;
                source->head->prev = NULL;
            }
            else
            {
                if (target->prev != NULL)
                    target->prev->next = target->next;
                if (target->next != NULL)
                    target->next->prev = target->prev;
                target->prev = NULL;
                target->next = NULL;
            }
            source->count--;
            _dlist_insert_dlnode(dest, target, direction);
        }
    }
}
void dlist_move ( struct dlist * source , struct dlist * dest , struct dl_node * target , int direction ) { if ( target != NULL ) { if ( target == source -> head ) { } else { if ( source -> marker == target ) _dlist_mark_move ( source , direction ) ; if ( target == source -> head -> next ) source -> head -> next = target -> next ; if ( target == source -> head -> prev ) source -> head -> prev = target -> prev ; if ( source -> count == 1 ) { target -> prev = NULL ; target -> next = NULL ; source -> head -> next = NULL ; source -> head -> prev = NULL ; } else { if ( target -> prev != NULL ) target -> prev -> next = target -> next ; if ( target -> next != NULL ) target -> next -> prev = target -> prev ; target -> prev = NULL ; target -> next = NULL ; } source -> count -- ; _dlist_insert_dlnode ( dest , target , direction ) ; } } }
move dl_node from source to dest
 if marker == target .
move dl_node from source to dest if marker == target .
// not even going to try // take care of head and marker pointers. // remove from list