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_filter_sort(struct dlist* list, int (*filter)(void*),
                       int (*compare)(void*, void*))
{
    struct dl_node *nodepointer, *temp;
    void* data;

    if (!list->count)
        return;

    /* if there is no filter function, directly sort all the entries */
    if (!filter)
        goto sort;

    /* filter the unwanted entries in the list */
    nodepointer = list->head->next;
    while (nodepointer != list->head)
    {
        if (!filter(nodepointer->data))
        {
            temp = nodepointer->next;
            data = _dlist_remove(list, nodepointer, 0);
            if (data)
                list->del_func(data);
            nodepointer = temp;
        }
        else
            nodepointer = nodepointer->next;
    }

sort:
    /* sort out the entries */
    dlist_sort_custom(list, compare);
}
/*
 * The dlist_filter_sort() function scans the list, calling
 * filter() on each list entry. Entries for which filter()
 * returns zero are discarded from the list. Then the list is
 * sorted using mergesort() with the comparison function compare()
 * and returned. If filter is NULL, all entries are selected.
 */
The dlist_filter_sort() function scans the list, calling
filter() on each list entry. Entries for which filter()
returns zero are discarded from the list. Then the list is
sorted using mergesort() with the comparison function compare()
and returned. If filter is NULL, all entries are selected.
The dlist_filter_sort () function scans the list calling filter () on each list entry . Entries for which filter () returns zero are discarded from the list . Then the list is sorted using mergesort () with the comparison function compare () and returned . If filter is NULL all entries are selected .
void dlist_filter_sort(struct dlist* list, int (*filter)(void*),
                       int (*compare)(void*, void*))
{
    struct dl_node *nodepointer, *temp;
    void* data;
    if (!list->count)
        return;
    if (!filter)
        goto sort;
    nodepointer = list->head->next;
    while (nodepointer != list->head)
    {
        if (!filter(nodepointer->data))
        {
            temp = nodepointer->next;
            data = _dlist_remove(list, nodepointer, 0);
            if (data)
                list->del_func(data);
            nodepointer = temp;
        }
        else
            nodepointer = nodepointer->next;
    }
sort:
    dlist_sort_custom(list, compare);
}
void dlist_filter_sort ( struct dlist * list , int ( * filter ) ( void * ) , int ( * compare ) ( void * , void * ) ) { struct dl_node * nodepointer , * temp ; void * data ; if ( ! list -> count ) return ; if ( ! filter ) goto sort ; nodepointer = list -> head -> next ; while ( nodepointer != list -> head ) { if ( ! filter ( nodepointer -> data ) ) { temp = nodepointer -> next ; data = _dlist_remove ( list , nodepointer , 0 ) ; if ( data ) list -> del_func ( data ) ; nodepointer = temp ; } else nodepointer = nodepointer -> next ; } sort : dlist_sort_custom ( list , compare ) ; }
The dlist_filter_sort() function scans the list, calling
 filter() on each list entry.
The dlist_filter_sort () function scans the list calling filter () on each list entry .
/* if there is no filter function, directly sort all the entries */ /* filter the unwanted entries in the list */ /* sort out the entries */