All pastes #2106947 Raw Edit

Something

public text v1 · immutable
#2106947 ·published 2012-01-28 03:49 UTC
rendered paste body
static int check_labels(struct label_list *labels)
{
    int rc = 0;

    // check for and reject duplicates
    void *tree;
    while (labels) {
        struct label **node = tsearch(labels->label, &tree,
                compare_label_names);

        if (*node != labels->label) {
            rc = 1;
            goto cleanup;
        }

        labels = labels->next;
    }

cleanup:
    // TODO tdestroy-like
    return rc;
}