bitset: Silence gcc warning.
authorBruno Haible <bruno@clisp.org>
Thu, 18 May 2023 20:40:12 +0000 (22:40 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 18 May 2023 20:59:25 +0000 (22:59 +0200)
* lib/bitset/list.c (lbitset_copy_): Remove redundant test from the
loop's first iteration.

ChangeLog
lib/bitset/list.c

index 0216321fc6dbee51efd1a4382aeb7acb7ad0b0a0..1796c625ee65333752e6dd718426b919ac4dd609 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-05-18  Bruno Haible  <bruno@clisp.org>
+
+       bitset: Silence gcc warning.
+       * lib/bitset/list.c (lbitset_copy_): Remove redundant test from the
+       loop's first iteration.
+
 2023-05-18  Bruno Haible  <bruno@clisp.org>
 
        stack: Silence gcc warning in tests.
index f73ea70feed542a01350222ff5be84890ab94588..eee7fefeebb79a657716c6722ae620121c2cfcad 100644 (file)
@@ -441,7 +441,8 @@ lbitset_copy_ (bitset dst, bitset src)
 
   lbitset_elt *prev = 0;
   lbitset_elt *tmp;
-  for (lbitset_elt *elt = head; elt; elt = elt->next)
+  lbitset_elt *elt = head;
+  do
     {
       tmp = lbitset_elt_alloc ();
       tmp->index = elt->index;
@@ -454,7 +455,10 @@ lbitset_copy_ (bitset dst, bitset src)
       prev = tmp;
 
       memcpy (tmp->words, elt->words, sizeof (elt->words));
+
+      elt = elt->next;
     }
+  while (elt);
   LBITSET_TAIL (dst) = tmp;
 
   dst->b.csize = LBITSET_ELT_WORDS;