* lib/bitset/array.c (abitset_small_list): Always update *next and
return a value.
---
 ChangeLog          |  6 ++++++
 lib/bitset/array.c | 10 ++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d50f4d1a2..88ae15003 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-11-19  Akim Demaille  <a...@lrde.epita.fr>
+
+       bitset: be sure to always return a value
+       * lib/bitset/array.c (abitset_small_list): Always update *next and
+       return a value.
+
 2020-11-17  Akim Demaille  <a...@lrde.epita.fr>
 
        bitset: strengthen tests
diff --git a/lib/bitset/array.c b/lib/bitset/array.c
index 3f8bcca87..0e90b6b1f 100644
--- a/lib/bitset/array.c
+++ b/lib/bitset/array.c
@@ -65,12 +65,8 @@ abitset_small_list (bitset src, bitset_bindex *list,
   bitset_bindex count = 0;
   /* Is there enough room to avoid checking in each iteration? */
   if (num >= BITSET_WORD_BITS)
-    {
-      BITSET_FOR_EACH_BIT (pos, word)
-        list[count++] = bitno + pos;
-      *next = bitno + BITSET_WORD_BITS;
-      return count;
-    }
+    BITSET_FOR_EACH_BIT (pos, word)
+      list[count++] = bitno + pos;
   else
     BITSET_FOR_EACH_BIT (pos, word)
       {
@@ -81,6 +77,8 @@ abitset_small_list (bitset src, bitset_bindex *list,
             return count;
           }
       }
+  *next = bitno + BITSET_WORD_BITS;
+  return count;
 }
 
 
-- 
2.29.2


Reply via email to