queue.c
/*
 * Delete all nodes that have duplicate string,
 * leaving only distinct strings from the original list.
 * Return true if successful.
 * Return false if list is NULL.
 *
 * Note: this function always be called after sorting, in other words,
 * list is guaranteed to be sorted in ascending order.
 */
Delete all nodes that have duplicate string,
leaving only distinct strings from the original list.
Return true if successful.
Return false if list is NULL.

this function always be called after sorting, in other words,
list is guaranteed to be sorted in ascending order.
Delete all nodes that have duplicate string leaving only distinct strings from the original list . Return true if successful . Return false if list is NULL . this function always be called after sorting in other words list is guaranteed to be sorted in ascending order .
bool q_delete_dup(struct list_head *head)
{
    if (!head)
        return false;
    element_t *node, *safe;
    list_for_each_entry_safe (node, safe, head, list) {
        if (&safe->list != head) {
            if (node->value && safe->value) {
                if (!strcmp(node->value, safe->value)) {
                    list_del(&node->list);
                    q_release_element(node);
                }
            }
        }
    }
    return true;
}
bool q_delete_dup ( struct list_head * head ) { if ( ! head ) return false ; element_t * node , * safe ; list_for_each_entry_safe ( node , safe , head , list ) { if ( & safe -> list != head ) { if ( node -> value && safe -> value ) { if ( ! strcmp ( node -> value , safe -> value ) ) { list_del ( & node -> list ) ; q_release_element ( node ) ; } } } } return true ; }
Delete all nodes that have duplicate string,
 leaving only distinct strings from the original list.
Delete all nodes that have duplicate string leaving only distinct strings from the original list .
// https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/ // if &safe->list == head, safe->value will dereference a null pointer