diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2020-11-15 12:23:10 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2020-11-15 17:58:37 +0100 |
commit | 7b440439681dea63d5f441dbcb82202225a1119c (patch) | |
tree | 3faf4e324205eb2749f9bc02fdf768aebd5a50bd /lib/bitset | |
parent | 31e0a7a99d8e3077277e4900521d2a429b1faef9 (diff) | |
download | gnulib-7b440439681dea63d5f441dbcb82202225a1119c.tar.gz |
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.
Diffstat (limited to 'lib/bitset')
-rw-r--r-- | lib/bitset/list.c | 11 |
1 files changed, 10 insertions, 1 deletions
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 |