From b900e2d3a0bf6303251cfad36a1124a4919c58ac Mon Sep 17 00:00:00 2001 From: Steven Cheng Date: Sat, 11 Nov 2023 17:44:18 +0800 Subject: [PATCH] Revert "Fix duplicate item detection issue" --- qtest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qtest.c b/qtest.c index 64624705d..0de4842ce 100644 --- a/qtest.c +++ b/qtest.c @@ -475,6 +475,7 @@ 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 @@ -482,7 +483,7 @@ static bool do_dedup(int argc, char *argv[]) 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 && @@ -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;