[gtk+/wip/css-bitmasks: 3/6] Change all gtk_bitmask modifier functions to take a GtkBitmask**



commit 0fa10388ddb49eee07ef84011c66db09303a6fb8
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Feb 8 10:41:17 2012 +0100

    Change all gtk_bitmask modifier functions to take a GtkBitmask**
    
    This way we can do some smart things when modifiying bitmasks,
    like:
     * Special case empty bitmasks as NULL (yet still allow them to be modified)
     * Use the GtkBitmask object to contain the actual array of items,
       rather than a pointer to it
     * Use bit trickery to store "small" data in the actual pointer

 gtk/gtkbitmask.c        |   78 +++++++++++++++++++++++-----------------------
 gtk/gtkbitmaskprivate.h |   14 ++++----
 gtk/gtkcsslookup.c      |    6 ++--
 gtk/gtkcssprovider.c    |    2 +-
 gtk/gtkstylecontext.c   |   16 +++++-----
 gtk/gtkwidgetpath.c     |   26 ++++++---------
 gtk/tests/bitmask.c     |   44 +++++++++++++-------------
 7 files changed, 90 insertions(+), 96 deletions(-)
---
diff --git a/gtk/gtkbitmask.c b/gtk/gtkbitmask.c
index ae64f70..159eba3 100644
--- a/gtk/gtkbitmask.c
+++ b/gtk/gtkbitmask.c
@@ -42,7 +42,7 @@ _gtk_bitmask_copy (const GtkBitmask *mask)
   g_return_val_if_fail (mask != NULL, NULL);
 
   copy = _gtk_bitmask_new ();
-  _gtk_bitmask_union (copy, mask);
+  _gtk_bitmask_union (&copy, mask);
 
   return copy;
 }
@@ -97,21 +97,21 @@ _gtk_bitmask_to_string (const GtkBitmask *mask)
  * _gtk_bitmask_is_empty() depends on this.
  */
 static void
-gtk_bitmask_shrink (GtkBitmask *mask)
+gtk_bitmask_shrink (GtkBitmask **mask)
 {
   guint i;
 
-  for (i = mask->len; i; i--)
+  for (i = (*mask)->len; i; i--)
     {
-      if (g_array_index (mask, VALUE_TYPE, i - 1))
+      if (g_array_index (*mask, VALUE_TYPE, i - 1))
         break;
     }
 
-  g_array_set_size (mask, i);
+  g_array_set_size (*mask, i);
 }
 
 void
-_gtk_bitmask_intersect (GtkBitmask       *mask,
+_gtk_bitmask_intersect (GtkBitmask      **mask,
                         const GtkBitmask *other)
 {
   guint i;
@@ -119,17 +119,17 @@ _gtk_bitmask_intersect (GtkBitmask       *mask,
   g_return_if_fail (mask != NULL);
   g_return_if_fail (other != NULL);
 
-  g_array_set_size (mask, MIN (mask->len, other->len));
-  for (i = 0; i < mask->len; i++)
+  g_array_set_size (*mask, MIN ((*mask)->len, other->len));
+  for (i = 0; i < (*mask)->len; i++)
     {
-      g_array_index (mask, VALUE_TYPE, i) &= g_array_index (other, VALUE_TYPE, i);
+      g_array_index (*mask, VALUE_TYPE, i) &= g_array_index (other, VALUE_TYPE, i);
     }
 
   gtk_bitmask_shrink (mask);
 }
 
 void
-_gtk_bitmask_union (GtkBitmask       *mask,
+_gtk_bitmask_union (GtkBitmask      **mask,
                     const GtkBitmask *other)
 {
   guint i;
@@ -137,15 +137,15 @@ _gtk_bitmask_union (GtkBitmask       *mask,
   g_return_if_fail (mask != NULL);
   g_return_if_fail (other != NULL);
 
-  g_array_set_size (mask, MAX (mask->len, other->len));
+  g_array_set_size (*mask, MAX ((*mask)->len, other->len));
   for (i = 0; i < other->len; i++)
     {
-      g_array_index (mask, VALUE_TYPE, i) |= g_array_index (other, VALUE_TYPE, i);
+      g_array_index (*mask, VALUE_TYPE, i) |= g_array_index (other, VALUE_TYPE, i);
     }
 }
 
 void
-_gtk_bitmask_subtract (GtkBitmask       *mask,
+_gtk_bitmask_subtract (GtkBitmask      **mask,
                        const GtkBitmask *other)
 {
   guint i;
@@ -155,7 +155,7 @@ _gtk_bitmask_subtract (GtkBitmask       *mask,
 
   for (i = 0; i < other->len; i++)
     {
-      g_array_index (mask, VALUE_TYPE, i) &= ~g_array_index (other, VALUE_TYPE, i);
+      g_array_index (*mask, VALUE_TYPE, i) &= ~g_array_index (other, VALUE_TYPE, i);
     }
 
   gtk_bitmask_shrink (mask);
@@ -187,9 +187,9 @@ _gtk_bitmask_get (const GtkBitmask *mask,
 }
 
 void
-_gtk_bitmask_set (GtkBitmask *mask,
-                  guint       index_,
-                  gboolean    value)
+_gtk_bitmask_set (GtkBitmask **mask,
+                  guint        index_,
+                  gboolean     value)
 {
   guint array_index, bit_index;
 
@@ -199,25 +199,25 @@ _gtk_bitmask_set (GtkBitmask *mask,
 
   if (value)
     {
-      if (array_index >= mask->len)
-        g_array_set_size (mask, array_index + 1);
+      if (array_index >= (*mask)->len)
+        g_array_set_size (*mask, array_index + 1);
       
-      g_array_index (mask, VALUE_TYPE, array_index) |= VALUE_BIT (bit_index);
+      g_array_index (*mask, VALUE_TYPE, array_index) |= VALUE_BIT (bit_index);
     }
   else
     {
-      if (array_index < mask->len)
+      if (array_index < (*mask)->len)
         {
-          g_array_index (mask, VALUE_TYPE, array_index) &= ~ VALUE_BIT (bit_index);
+          g_array_index (*mask, VALUE_TYPE, array_index) &= ~ VALUE_BIT (bit_index);
           gtk_bitmask_shrink (mask);
         }
     }
 }
 
 void
-_gtk_bitmask_invert_range (GtkBitmask *mask,
-                           guint       start,
-                           guint       end)
+_gtk_bitmask_invert_range (GtkBitmask **mask,
+                           guint        start,
+                           guint        end)
 {
   guint i;
 
@@ -227,7 +227,7 @@ _gtk_bitmask_invert_range (GtkBitmask *mask,
   /* I CAN HAS SPEEDUP? */
 
   for (i = start; i < end; i++)
-    _gtk_bitmask_set (mask, i, !_gtk_bitmask_get (mask, i));
+    _gtk_bitmask_set (mask, i, !_gtk_bitmask_get (*mask, i));
 }
 
 gboolean
@@ -278,14 +278,14 @@ _gtk_bitmask_intersects (const GtkBitmask *mask,
 }
 
 void
-_gtk_bitmask_clear (GtkBitmask *mask)
+_gtk_bitmask_clear (GtkBitmask **mask)
 {
   int i;
 
   g_return_if_fail (mask != NULL);
 
-  for (i = mask->len - 1; i >= 0; i--)
-    g_array_index (mask, VALUE_TYPE, i) = 0;
+  for (i = (*mask)->len - 1; i >= 0; i--)
+    g_array_index (*mask, VALUE_TYPE, i) = 0;
 }
 
 guint
@@ -315,9 +315,9 @@ _gtk_bitmask_get_uint (const GtkBitmask  *mask,
 }
 
 void
-_gtk_bitmask_set_uint (GtkBitmask  *mask,
-		       guint        index_,
-		       guint        bits)
+_gtk_bitmask_set_uint (GtkBitmask  **mask,
+		       guint         index_,
+		       guint         bits)
 {
   guint array_index, bit_index;
   VALUE_TYPE value1, value2;
@@ -328,10 +328,10 @@ _gtk_bitmask_set_uint (GtkBitmask  *mask,
   gtk_bitmask_indexes (index_, &array_index, &bit_index);
 
   value1 = value2 = 0;
-  if (array_index < mask->len)
-    value1 = g_array_index (mask, VALUE_TYPE, array_index);
-  if (array_index + 1 < mask->len)
-    value2 = g_array_index (mask, VALUE_TYPE, array_index + 1);
+  if (array_index < (*mask)->len)
+    value1 = g_array_index (*mask, VALUE_TYPE, array_index);
+  if (array_index + 1 < (*mask)->len)
+    value2 = g_array_index (*mask, VALUE_TYPE, array_index + 1);
 
   /* Mask out old uint value */
   new_value1 = ((VALUE_TYPE)G_MAXUINT) << bit_index;
@@ -352,10 +352,10 @@ _gtk_bitmask_set_uint (GtkBitmask  *mask,
   value2 |= new_value2;
 
   /* Ensure there is space to write back */
-  g_array_set_size (mask, MAX (mask->len, array_index + 2));
+  g_array_set_size (*mask, MAX ((*mask)->len, array_index + 2));
 
-  g_array_index (mask, VALUE_TYPE, array_index) = value1;
-  g_array_index (mask, VALUE_TYPE, array_index + 1) = value2;
+  g_array_index (*mask, VALUE_TYPE, array_index) = value1;
+  g_array_index (*mask, VALUE_TYPE, array_index + 1) = value2;
 
   gtk_bitmask_shrink (mask);
 }
diff --git a/gtk/gtkbitmaskprivate.h b/gtk/gtkbitmaskprivate.h
index 9c699a8..2ee6cdf 100644
--- a/gtk/gtkbitmaskprivate.h
+++ b/gtk/gtkbitmaskprivate.h
@@ -40,26 +40,26 @@ char *         _gtk_bitmask_to_string            (const GtkBitmask  *mask);
 void           _gtk_bitmask_print                (const GtkBitmask  *mask,
                                                   GString           *string);
 
-void           _gtk_bitmask_intersect            (GtkBitmask        *mask,
+void           _gtk_bitmask_intersect            (GtkBitmask       **mask,
                                                   const GtkBitmask  *other);
-void           _gtk_bitmask_union                (GtkBitmask        *mask,
+void           _gtk_bitmask_union                (GtkBitmask       **mask,
                                                   const GtkBitmask  *other);
-void           _gtk_bitmask_subtract             (GtkBitmask        *mask,
+void           _gtk_bitmask_subtract             (GtkBitmask       **mask,
                                                   const GtkBitmask  *other);
 
 gboolean       _gtk_bitmask_get                  (const GtkBitmask  *mask,
                                                   guint              index_);
-void           _gtk_bitmask_set                  (GtkBitmask        *mask,
+void           _gtk_bitmask_set                  (GtkBitmask       **mask,
                                                   guint              index_,
                                                   gboolean           value);
-void           _gtk_bitmask_clear                (GtkBitmask        *mask);
+void           _gtk_bitmask_clear                (GtkBitmask       **mask);
 guint          _gtk_bitmask_get_uint             (const GtkBitmask  *mask,
                                                   guint              index_);
-void           _gtk_bitmask_set_uint             (GtkBitmask        *mask,
+void           _gtk_bitmask_set_uint             (GtkBitmask       **mask,
                                                   guint              index_,
 						  guint              bits);
 
-void           _gtk_bitmask_invert_range         (GtkBitmask        *mask,
+void           _gtk_bitmask_invert_range         (GtkBitmask       **mask,
                                                   guint              start,
                                                   guint              end);
 
diff --git a/gtk/gtkcsslookup.c b/gtk/gtkcsslookup.c
index c3dd7d0..41cce87 100644
--- a/gtk/gtkcsslookup.c
+++ b/gtk/gtkcsslookup.c
@@ -45,7 +45,7 @@ _gtk_css_lookup_new (void)
 
   lookup = g_malloc0 (sizeof (GtkCssLookup) + sizeof (GtkCssLookupValue) * n);
   lookup->missing = _gtk_bitmask_new ();
-  _gtk_bitmask_invert_range (lookup->missing, 0, n);
+  _gtk_bitmask_invert_range (&lookup->missing, 0, n);
 
   return lookup;
 }
@@ -99,7 +99,7 @@ _gtk_css_lookup_set (GtkCssLookup  *lookup,
   g_return_if_fail (_gtk_bitmask_get (lookup->missing, id));
   g_return_if_fail (value != NULL);
 
-  _gtk_bitmask_set (lookup->missing, id, FALSE);
+  _gtk_bitmask_set (&lookup->missing, id, FALSE);
   lookup->values[id].value = value;
   lookup->values[id].section = section;
 }
@@ -133,7 +133,7 @@ _gtk_css_lookup_set_computed (GtkCssLookup  *lookup,
   g_return_if_fail (_gtk_bitmask_get (lookup->missing, id));
   g_return_if_fail (value != NULL);
 
-  _gtk_bitmask_set (lookup->missing, id, FALSE);
+  _gtk_bitmask_set (&lookup->missing, id, FALSE);
   lookup->values[id].computed = value;
   lookup->values[id].section = section;
 }
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index a637eee..a6e778d 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -1216,7 +1216,7 @@ gtk_css_ruleset_add (GtkCssRuleset    *ruleset,
       g_return_if_fail (_gtk_css_style_property_is_specified_type (GTK_CSS_STYLE_PROPERTY (prop),
                                                                    G_VALUE_TYPE (&value->value)));
 
-      _gtk_bitmask_set (ruleset->set_styles,
+      _gtk_bitmask_set (&ruleset->set_styles,
                         _gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (prop)),
                         TRUE);
       g_hash_table_insert (ruleset->style, prop, value);
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index b117d71..37c441e 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -491,9 +491,9 @@ style_info_copy (const GtkStyleInfo *info)
   GtkStyleInfo *copy;
 
   copy = style_info_new ();
-  _gtk_bitmask_union (copy->style_classes,
+  _gtk_bitmask_union (&copy->style_classes,
 		      info->style_classes);
-  _gtk_bitmask_union (copy->regions,
+  _gtk_bitmask_union (&copy->regions,
 		      info->regions);
 
   copy->junction_sides = info->junction_sides;
@@ -1840,7 +1840,7 @@ _gtk_style_class_get_mask (const gchar *class_name)
     value = GPOINTER_TO_INT (ptr_value);
   else
     {
-      const char *str = g_intern_string (class_name);
+      char *str = (char *)g_intern_string (class_name);
       value = style_class_masks_next++;
       ptr_value = GINT_TO_POINTER (value);
       g_hash_table_insert (style_class_masks, str, ptr_value);
@@ -1874,7 +1874,7 @@ _gtk_style_region_get_mask (const gchar *region_name)
     value = GPOINTER_TO_INT (ptr_value);
   else
     {
-      const char *str = g_intern_string (region_name);
+      char *str = (char *)g_intern_string (region_name);
       value = style_region_masks_next++;
       ptr_value = GINT_TO_POINTER (value);
       g_hash_table_insert (style_region_masks, str, ptr_value);
@@ -1934,7 +1934,7 @@ gtk_style_context_add_class (GtkStyleContext *context,
 
   if (!_gtk_bitmask_get (info->style_classes, class_mask))
     {
-      _gtk_bitmask_set (info->style_classes, class_mask, TRUE);
+      _gtk_bitmask_set (&info->style_classes, class_mask, TRUE);
 
       /* Unset current data, as it likely changed due to the class change */
       priv->current_data = NULL;
@@ -1970,7 +1970,7 @@ gtk_style_context_remove_class (GtkStyleContext *context,
 
   if (_gtk_bitmask_get (info->style_classes, class_mask))
     {
-      _gtk_bitmask_set (info->style_classes, class_mask, FALSE);
+      _gtk_bitmask_set (&info->style_classes, class_mask, FALSE);
 
       /* Unset current data, as it likely changed due to the class change */
       priv->current_data = NULL;
@@ -2172,7 +2172,7 @@ gtk_style_context_add_region (GtkStyleContext *context,
       /* Ensure *some* flag is always set so we know this is added */
       old_flags |= flags | GTK_REGION_ADDED;
 
-      _gtk_bitmask_set_uint (info->regions, i, old_flags);
+      _gtk_bitmask_set_uint (&info->regions, i, old_flags);
 
       /* Unset current data, as it likely changed due to the region change */
       priv->current_data = NULL;
@@ -2215,7 +2215,7 @@ gtk_style_context_remove_region (GtkStyleContext *context,
   if ((old_flags & GTK_REGION_ADDED) != 0)
     {
       old_flags &= ~(GTK_REGION_FLAGS_MASK | GTK_REGION_ADDED);
-      _gtk_bitmask_set_uint (info->regions, i, old_flags);
+      _gtk_bitmask_set_uint (&info->regions, i, old_flags);
 
       /* Unset current data, as it likely changed due to the region change */
       priv->current_data = NULL;
diff --git a/gtk/gtkwidgetpath.c b/gtk/gtkwidgetpath.c
index 0d90a0c..b63d191 100644
--- a/gtk/gtkwidgetpath.c
+++ b/gtk/gtkwidgetpath.c
@@ -138,16 +138,10 @@ gtk_path_element_copy (GtkPathElement       *dest,
   dest->sibling_index = src->sibling_index;
 
   if (src->regions)
-    {
-      dest->regions = _gtk_bitmask_new ();
-      _gtk_bitmask_union (dest->regions, src->regions);
-    }
+    dest->regions = _gtk_bitmask_copy (src->regions);
 
   if (src->classes)
-    {
-      dest->classes = _gtk_bitmask_new ();
-      _gtk_bitmask_union (dest->classes, src->classes);
-    }
+    dest->classes = _gtk_bitmask_copy (src->classes);
 }
 
 /**
@@ -730,7 +724,7 @@ gtk_widget_path_iter_add_class (GtkWidgetPath *path,
   if (!elem->classes)
     elem->classes = _gtk_bitmask_new ();
 
-  _gtk_bitmask_set (elem->classes, _gtk_style_class_get_mask (name), TRUE);
+  _gtk_bitmask_set (&elem->classes, _gtk_style_class_get_mask (name), TRUE);
 }
 
 void
@@ -752,7 +746,7 @@ _gtk_widget_path_iter_add_classes (GtkWidgetPath *path,
   if (!elem->classes)
     elem->classes = _gtk_bitmask_new ();
 
-  _gtk_bitmask_union (elem->classes, classes);
+  _gtk_bitmask_union (&elem->classes, classes);
 }
 
 /**
@@ -785,7 +779,7 @@ gtk_widget_path_iter_remove_class (GtkWidgetPath *path,
   if (!elem->classes)
     elem->classes = _gtk_bitmask_new ();
 
-  _gtk_bitmask_set (elem->classes, _gtk_style_class_get_mask (name), FALSE);
+  _gtk_bitmask_set (&elem->classes, _gtk_style_class_get_mask (name), FALSE);
 }
 
 /**
@@ -815,7 +809,7 @@ gtk_widget_path_iter_clear_classes (GtkWidgetPath *path,
   if (!elem->classes)
     return;
 
-  _gtk_bitmask_clear (elem->classes);
+  _gtk_bitmask_clear (&elem->classes);
 }
 
 /**
@@ -969,7 +963,7 @@ gtk_widget_path_iter_add_region (GtkWidgetPath  *path,
   old_flags &= ~(GTK_REGION_FLAGS_MASK | GTK_REGION_ADDED);
   /* Ensure *some* flag is always set so we know this is added */
   old_flags |= flags | GTK_REGION_ADDED;
-  _gtk_bitmask_set_uint (elem->regions, i, old_flags);
+  _gtk_bitmask_set_uint (&elem->regions, i, old_flags);
 }
 
 void
@@ -991,7 +985,7 @@ _gtk_widget_path_iter_add_regions (GtkWidgetPath  *path,
   if (!elem->regions)
     elem->regions = _gtk_bitmask_new ();
 
-  _gtk_bitmask_union (elem->regions, regions);
+  _gtk_bitmask_union (&elem->regions, regions);
 }
 
 /**
@@ -1032,7 +1026,7 @@ gtk_widget_path_iter_remove_region (GtkWidgetPath *path,
 
   old_flags = _gtk_bitmask_get_uint (elem->regions, i);
   old_flags &= ~(GTK_REGION_FLAGS_MASK | GTK_REGION_ADDED);
-  _gtk_bitmask_set_uint (elem->regions, i, old_flags);
+  _gtk_bitmask_set_uint (&elem->regions, i, old_flags);
 }
 
 /**
@@ -1060,7 +1054,7 @@ gtk_widget_path_iter_clear_regions (GtkWidgetPath *path,
   elem = &g_array_index (path->elems, GtkPathElement, pos);
 
   if (elem->regions)
-    _gtk_bitmask_clear (elem->regions);
+    _gtk_bitmask_clear (&elem->regions);
 }
 
 /**
diff --git a/gtk/tests/bitmask.c b/gtk/tests/bitmask.c
index 4bbfa96..2dcc4a6 100644
--- a/gtk/tests/bitmask.c
+++ b/gtk/tests/bitmask.c
@@ -48,9 +48,9 @@ gtk_bitmask_new_parse (const char *string)
   for (i = 0; i < length; i++)
     {
       if (string[i] == '0')
-        _gtk_bitmask_set (mask, length - i - 1, FALSE);
+        _gtk_bitmask_set (&mask, length - i - 1, FALSE);
       else if (string[i] == '1')
-        _gtk_bitmask_set (mask, length - i - 1, TRUE);
+        _gtk_bitmask_set (&mask, length - i - 1, TRUE);
       else
         g_assert_not_reached ();
     }
@@ -142,12 +142,12 @@ test_set (void)
       for (j = 0; j < N_TRIES; j++)
         {
           indexes[j] = g_test_rand_int_range (0, MAX_INDEX);
-          _gtk_bitmask_set (copy, indexes[j], g_test_rand_bit ());
+          _gtk_bitmask_set (&copy, indexes[j], g_test_rand_bit ());
         }
 
       for (j = 0; j < N_TRIES; j++)
         {
-          _gtk_bitmask_set (copy, indexes[j], _gtk_bitmask_get (mask, indexes[j]));
+          _gtk_bitmask_set (&copy, indexes[j], _gtk_bitmask_get (mask, indexes[j]));
         }
 
       assert_cmpmasks (copy, mask);
@@ -174,10 +174,10 @@ test_set_uint (void)
         {
 	  index = g_test_rand_int_range (0, MAX_INDEX);
 
-	  _gtk_bitmask_set_uint (copy, index, val);
+	  _gtk_bitmask_set_uint (&copy, index, val);
 
 	  for (k = 0; k < sizeof (guint) * 8; k++)
-	    _gtk_bitmask_set (mask, index + k, val & (1<<k));
+	    _gtk_bitmask_set (&mask, index + k, val & (1<<k));
 
 	  assert_cmpmasks (copy, mask);
         }
@@ -228,15 +228,15 @@ test_union (void)
           guint id = g_test_rand_int_range (0, MAX_INDEX);
 
           if (g_test_rand_bit ())
-            _gtk_bitmask_set (left, id, TRUE);
+            _gtk_bitmask_set (&left, id, TRUE);
           else
-            _gtk_bitmask_set (right, id, TRUE);
+            _gtk_bitmask_set (&right, id, TRUE);
 
-          _gtk_bitmask_set (expected, id, TRUE);
+          _gtk_bitmask_set (&expected, id, TRUE);
         }
 
-      _gtk_bitmask_union (left, right);
-      _gtk_bitmask_union (right, left);
+      _gtk_bitmask_union (&left, right);
+      _gtk_bitmask_union (&right, left);
 
       assert_cmpmasks (left, expected);
       assert_cmpmasks (right, expected);
@@ -266,13 +266,13 @@ test_intersect (void)
 
           if (g_test_rand_bit ())
             {
-              _gtk_bitmask_set (left, id, set);
-              _gtk_bitmask_set (expected, id, set ? _gtk_bitmask_get (right, id) : 0);
+              _gtk_bitmask_set (&left, id, set);
+              _gtk_bitmask_set (&expected, id, set ? _gtk_bitmask_get (right, id) : 0);
             }
           else
             {
-              _gtk_bitmask_set (right, id, set);
-              _gtk_bitmask_set (expected, id, set ? _gtk_bitmask_get (left, id) : 0);
+              _gtk_bitmask_set (&right, id, set);
+              _gtk_bitmask_set (&expected, id, set ? _gtk_bitmask_get (left, id) : 0);
             }
         }
 
@@ -280,8 +280,8 @@ test_intersect (void)
       g_assert_cmpint (intersects, ==, _gtk_bitmask_intersects (right, left));
       g_assert_cmpint (intersects, !=, _gtk_bitmask_is_empty (expected));
 
-      _gtk_bitmask_intersect (left, right);
-      _gtk_bitmask_intersect (right, left);
+      _gtk_bitmask_intersect (&left, right);
+      _gtk_bitmask_intersect (&right, left);
 
       assert_cmpmasks (left, expected);
       assert_cmpmasks (right, expected);
@@ -322,19 +322,19 @@ test_invert_range (void)
       end = MIN (left_end, right_end);
 
       if (left_start != left_end)
-        _gtk_bitmask_invert_range (left, left_start, left_end);
+        _gtk_bitmask_invert_range (&left, left_start, left_end);
       if (right_start != right_end)
-        _gtk_bitmask_invert_range (right, right_start, right_end);
+        _gtk_bitmask_invert_range (&right, right_start, right_end);
       if (start < end)
-        _gtk_bitmask_invert_range (expected, start, end);
+        _gtk_bitmask_invert_range (&expected, start, end);
 
       intersection = _gtk_bitmask_copy (left);
-      _gtk_bitmask_intersect (intersection, right);
+      _gtk_bitmask_intersect (&intersection, right);
 
       assert_cmpmasks (intersection, expected);
 
       if (start < end)
-        _gtk_bitmask_invert_range (expected, start, end);
+        _gtk_bitmask_invert_range (&expected, start, end);
 
       g_assert_cmpint (_gtk_bitmask_is_empty (expected), ==, TRUE);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]