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; }