diff --git a/gtk/gtkbitset.c b/gtk/gtkbitset.c index 2b98b740f3..ef5e835656 100644 --- a/gtk/gtkbitset.c +++ b/gtk/gtkbitset.c @@ -546,7 +546,7 @@ gtk_bitset_union (GtkBitset *self, { g_return_if_fail (self != NULL); g_return_if_fail (other != NULL); - + if (self == other) return; @@ -571,7 +571,7 @@ gtk_bitset_intersect (GtkBitset *self, { g_return_if_fail (self != NULL); g_return_if_fail (other != NULL); - + if (self == other) return; @@ -596,7 +596,7 @@ gtk_bitset_subtract (GtkBitset *self, { g_return_if_fail (self != NULL); g_return_if_fail (other != NULL); - + if (self == other) { roaring_bitmap_clear (&self->roaring); @@ -626,7 +626,7 @@ gtk_bitset_difference (GtkBitset *self, { g_return_if_fail (self != NULL); g_return_if_fail (other != NULL); - + if (self == other) { roaring_bitmap_clear (&self->roaring); @@ -756,6 +756,24 @@ gtk_bitset_splice (GtkBitset *self, G_STATIC_ASSERT (sizeof (GtkBitsetIter) >= sizeof (roaring_uint32_iterator_t)); +static GtkBitsetIter * +gtk_bitset_iter_copy (GtkBitsetIter *iter) +{ + roaring_uint32_iterator_t *riter = (roaring_uint32_iterator_t *) iter; + + return (GtkBitsetIter *) roaring_copy_uint32_iterator (riter); +} + +static void +gtk_bitset_iter_free (GtkBitsetIter *iter) +{ + roaring_uint32_iterator_t *riter = (roaring_uint32_iterator_t *) iter; + + roaring_free_uint32_iterator (riter); +} + +G_DEFINE_BOXED_TYPE (GtkBitsetIter, gtk_bitset_iter, gtk_bitset_iter_copy, gtk_bitset_iter_free) + /** * gtk_bitset_iter_init_first: * @iter: (out): a pointer to an uninitialized `GtkBitsetIter` diff --git a/gtk/gtkbitset.h b/gtk/gtkbitset.h index d85626b20e..9ec5d15bc2 100644 --- a/gtk/gtkbitset.h +++ b/gtk/gtkbitset.h @@ -148,6 +148,9 @@ struct _GtkBitsetIter gpointer private_data[10]; }; +GDK_AVAILABLE_IN_4_6 +GType gtk_bitset_iter_get_type (void) G_GNUC_CONST; + GDK_AVAILABLE_IN_ALL gboolean gtk_bitset_iter_init_first (GtkBitsetIter *iter, const GtkBitset *set, @@ -171,8 +174,6 @@ GDK_AVAILABLE_IN_ALL guint gtk_bitset_iter_get_value (const GtkBitsetIter *iter); GDK_AVAILABLE_IN_ALL gboolean gtk_bitset_iter_is_valid (const GtkBitsetIter *iter); - - G_END_DECLS