Skip to content

Commit

Permalink
Revert "Fix duplicate item detection issue"
Browse files Browse the repository at this point in the history
  • Loading branch information
eecheng87 committed Nov 11, 2023
1 parent 8692fc1 commit b900e2d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion qtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,15 @@ static bool do_dedup(int argc, char *argv[])
}

struct list_head *l_tmp = current->q->next;
bool is_this_dup = false;
// Compare between new list and old one
list_for_each_entry (item, &l_copy, list) {
// Skip comparison with new list if the string is duplicate
bool is_next_dup =
item->list.next != &l_copy &&
strcmp(list_entry(item->list.next, element_t, list)->value,
item->value) == 0;
if (is_next_dup) {
if (is_this_dup || is_next_dup) {
// Update list size
current->size--;
} else if (l_tmp != current->q &&
Expand All @@ -491,6 +492,7 @@ static bool do_dedup(int argc, char *argv[])
l_tmp = l_tmp->next;
else
ok = false;
is_this_dup = is_next_dup;
}
// All elements in new list should be traversed
ok = ok && l_tmp == current->q;
Expand Down

0 comments on commit b900e2d

Please sign in to comment.