From: Akim Demaille Date: Sun, 15 Nov 2020 11:23:10 +0000 (+0100) Subject: bitset: fix the copy from lbitset to other types X-Git-Tag: v1.0~3511 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=7b440439681dea63d5f441dbcb82202225a1119c;p=gnulib.git bitset: fix the copy from lbitset to other types 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. --- diff --git a/ChangeLog b/ChangeLog index b554d61e68..64cacdefb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2020-11-15 Akim Demaille + + 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 bitset: making debug traces more useful diff --git a/lib/bitset/list.c b/lib/bitset/list.c index c1f3d9b153..dc00fdc294 100644 --- a/lib/bitset/list.c +++ b/lib/bitset/list.c @@ -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