Skip to content

Commit be86d0f

Browse files
authored
Merge pull request #146 from sysprog21/revert-145-dedup_bug
Revert "Fix duplicate item detection issue"
2 parents 8692fc1 + b900e2d commit be86d0f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

qtest.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,14 +475,15 @@ static bool do_dedup(int argc, char *argv[])
475475
}
476476

477477
struct list_head *l_tmp = current->q->next;
478+
bool is_this_dup = false;
478479
// Compare between new list and old one
479480
list_for_each_entry (item, &l_copy, list) {
480481
// Skip comparison with new list if the string is duplicate
481482
bool is_next_dup =
482483
item->list.next != &l_copy &&
483484
strcmp(list_entry(item->list.next, element_t, list)->value,
484485
item->value) == 0;
485-
if (is_next_dup) {
486+
if (is_this_dup || is_next_dup) {
486487
// Update list size
487488
current->size--;
488489
} else if (l_tmp != current->q &&
@@ -491,6 +492,7 @@ static bool do_dedup(int argc, char *argv[])
491492
l_tmp = l_tmp->next;
492493
else
493494
ok = false;
495+
is_this_dup = is_next_dup;
494496
}
495497
// All elements in new list should be traversed
496498
ok = ok && l_tmp == current->q;

0 commit comments

Comments
 (0)