]> Savannah Git Hosting - gnulib.git/commitdiff
bitset: fix the copy from lbitset to other types
authorAkim Demaille <akim.demaille@gmail.com>
Sun, 15 Nov 2020 11:23:10 +0000 (12:23 +0100)
committerAkim Demaille <akim.demaille@gmail.com>
Sun, 15 Nov 2020 16:58:37 +0000 (17:58 +0100)
bitset_copy from an lbitset did not check whether the destination has
the same type.  Apply the same strategy as elsewhere.

Without this commit, the following one fails.

* lib/bitset/list.c (lbitset_copy): Rename as...
(lbitset_copy_): this.
(lbitset_copy): New.
Dispatch to heterogeneous/homogeneous copy.

ChangeLog
lib/bitset/list.c

index b554d61e68da26dea90a260888c5b8db9daf20c4..64cacdefb0ee1aee46ab8da66b6317bf8f070c9e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-11-15  Akim Demaille  <akim@lrde.epita.fr>
+
+       bitset: fix the copy from lbitset to other types
+       * lib/bitset/list.c (lbitset_copy): Rename as...
+       (lbitset_copy_): this.
+       (lbitset_copy): New.
+       Dispatch to heterogeneous/homogeneous copy.
+
 2020-11-15  Akim Demaille  <akim@lrde.epita.fr>
 
        bitset: making debug traces more useful
index c1f3d9b153a6dd7e22236e0573657cdcb4f30bc4..dc00fdc2940255ec84d4c0423ef9df57971faa55 100644 (file)
@@ -428,7 +428,7 @@ lbitset_equal_p (bitset dst, bitset src)
 
 /* Copy bits from bitset SRC to bitset DST.  */
 static inline void
-lbitset_copy (bitset dst, bitset src)
+lbitset_copy_ (bitset dst, bitset src)
 {
   if (src == dst)
     return;
@@ -463,6 +463,15 @@ lbitset_copy (bitset dst, bitset src)
 }
 
 
+static void
+lbitset_copy (bitset dst, bitset src)
+{
+  if (BITSET_COMPATIBLE_ (dst, src))
+    lbitset_copy_ (dst, src);
+  else
+    bitset_copy_ (dst, src);
+}
+
 /* Copy bits from bitset SRC to bitset DST.  Return true if
    bitsets different.  */
 static inline bool