File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -475,14 +475,15 @@ static bool do_dedup(int argc, char *argv[])
475
475
}
476
476
477
477
struct list_head * l_tmp = current -> q -> next ;
478
+ bool is_this_dup = false;
478
479
// Compare between new list and old one
479
480
list_for_each_entry (item , & l_copy , list ) {
480
481
// Skip comparison with new list if the string is duplicate
481
482
bool is_next_dup =
482
483
item -> list .next != & l_copy &&
483
484
strcmp (list_entry (item -> list .next , element_t , list )-> value ,
484
485
item -> value ) == 0 ;
485
- if (is_next_dup ) {
486
+ if (is_this_dup || is_next_dup ) {
486
487
// Update list size
487
488
current -> size -- ;
488
489
} else if (l_tmp != current -> q &&
@@ -491,6 +492,7 @@ static bool do_dedup(int argc, char *argv[])
491
492
l_tmp = l_tmp -> next ;
492
493
else
493
494
ok = false;
495
+ is_this_dup = is_next_dup ;
494
496
}
495
497
// All elements in new list should be traversed
496
498
ok = ok && l_tmp == current -> q ;
You can’t perform that action at this time.
0 commit comments