[pango/wip/baedert/for-master: 60/61] attributes: Rename attributes2 back to attributes



commit 2ada6204e095e33b2ba2858329d53f9a884df5c1
Author: Timm Bäder <mail baedert org>
Date:   Mon Jun 8 19:02:16 2020 +0200

    attributes: Rename attributes2 back to attributes

 pango/pango-attributes-private.h |  2 +-
 pango/pango-attributes.c         | 98 ++++++++++++++++++++--------------------
 2 files changed, 50 insertions(+), 50 deletions(-)
---
diff --git a/pango/pango-attributes-private.h b/pango/pango-attributes-private.h
index 660c1828..e2b9a2d5 100644
--- a/pango/pango-attributes-private.h
+++ b/pango/pango-attributes-private.h
@@ -36,7 +36,7 @@ struct _PangoAttrIterator
 struct _PangoAttrList
 {
   guint ref_count;
-  GPtrArray *attributes2;
+  GPtrArray *attributes;
 };
 
 void     _pango_attr_list_init         (PangoAttrList     *list);
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index c786df9e..00346f35 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1310,7 +1310,7 @@ void
 _pango_attr_list_init (PangoAttrList *list)
 {
   list->ref_count = 1;
-  list->attributes2 = NULL;
+  list->attributes = NULL;
 }
 
 /**
@@ -1357,17 +1357,17 @@ _pango_attr_list_destroy (PangoAttrList *list)
 {
   guint i, p;
 
-  if (!list->attributes2)
+  if (!list->attributes)
     return;
 
-  for (i = 0, p = list->attributes2->len; i < p; i++)
+  for (i = 0, p = list->attributes->len; i < p; i++)
     {
-      PangoAttribute *attr = g_ptr_array_index (list->attributes2, i);
+      PangoAttribute *attr = g_ptr_array_index (list->attributes, i);
 
       attr->klass->destroy (attr);
     }
 
-  g_ptr_array_free (list->attributes2, TRUE);
+  g_ptr_array_free (list->attributes, TRUE);
 }
 
 /**
@@ -1413,10 +1413,10 @@ pango_attr_list_copy (PangoAttrList *list)
     return NULL;
 
   new = pango_attr_list_new ();
-  if (!list->attributes2 || list->attributes2->len == 0)
+  if (!list->attributes || list->attributes->len == 0)
     return new;
 
-  new->attributes2 = g_ptr_array_copy (list->attributes2, (GCopyFunc)pango_attribute_copy, NULL);
+  new->attributes = g_ptr_array_copy (list->attributes, (GCopyFunc)pango_attribute_copy, NULL);
 
   return new;
 }
@@ -1429,36 +1429,36 @@ pango_attr_list_insert_internal (PangoAttrList  *list,
   const guint start_index = attr->start_index;
   PangoAttribute *last_attr;
 
-  if (G_UNLIKELY (!list->attributes2))
-    list->attributes2 = g_ptr_array_new ();
+  if (G_UNLIKELY (!list->attributes))
+    list->attributes = g_ptr_array_new ();
 
-  if (list->attributes2->len == 0)
+  if (list->attributes->len == 0)
     {
-      g_ptr_array_add (list->attributes2, attr);
+      g_ptr_array_add (list->attributes, attr);
       return;
     }
 
-  g_assert (list->attributes2->len > 0);
+  g_assert (list->attributes->len > 0);
 
-  last_attr = g_ptr_array_index (list->attributes2, list->attributes2->len - 1);
+  last_attr = g_ptr_array_index (list->attributes, list->attributes->len - 1);
 
   if (last_attr->start_index < start_index ||
       (!before && last_attr->start_index == start_index))
     {
-      g_ptr_array_add (list->attributes2, attr);
+      g_ptr_array_add (list->attributes, attr);
     }
   else
     {
       guint i, p;
 
-      for (i = 0, p = list->attributes2->len; i < p; i++)
+      for (i = 0, p = list->attributes->len; i < p; i++)
         {
-          PangoAttribute *cur = g_ptr_array_index (list->attributes2, i);
+          PangoAttribute *cur = g_ptr_array_index (list->attributes, i);
 
           if (cur->start_index > start_index ||
               (before && cur->start_index == start_index))
             {
-              g_ptr_array_insert (list->attributes2, i, attr);
+              g_ptr_array_insert (list->attributes, i, attr);
               break;
             }
         }
@@ -1537,19 +1537,19 @@ pango_attr_list_change (PangoAttrList  *list,
       return;
     }
 
-  if (!list->attributes2 || list->attributes2->len == 0)
+  if (!list->attributes || list->attributes->len == 0)
     {
       pango_attr_list_insert (list, attr);
       return;
     }
 
-  for (i = 0, p = list->attributes2->len; i < p; i++)
+  for (i = 0, p = list->attributes->len; i < p; i++)
     {
-      PangoAttribute *tmp_attr = g_ptr_array_index (list->attributes2, i);
+      PangoAttribute *tmp_attr = g_ptr_array_index (list->attributes, i);
 
       if (tmp_attr->start_index > start_index)
         {
-          g_ptr_array_insert (list->attributes2, i, attr);
+          g_ptr_array_insert (list->attributes, i, attr);
           break;
         }
 
@@ -1571,7 +1571,7 @@ pango_attr_list_change (PangoAttrList  *list,
               /* We are totally overlapping the previous attribute.
                * No action is needed.
                */
-              g_ptr_array_remove_index (list->attributes2, i);
+              g_ptr_array_remove_index (list->attributes, i);
               pango_attribute_destroy (attr);
               return;
             }
@@ -1597,7 +1597,7 @@ pango_attr_list_change (PangoAttrList  *list,
           if (tmp_attr->start_index == attr->start_index)
             {
               pango_attribute_destroy (tmp_attr);
-              g_ptr_array_remove_index (list->attributes2, i);
+              g_ptr_array_remove_index (list->attributes, i);
               break;
             }
           else
@@ -1610,9 +1610,9 @@ pango_attr_list_change (PangoAttrList  *list,
   /* We now have the range inserted into the list one way or the
    * other. Fix up the remainder */
   /* Attention: No i = 0 here. */
-  for (i = i + 1, p = list->attributes2->len; i < p; i++)
+  for (i = i + 1, p = list->attributes->len; i < p; i++)
     {
-      PangoAttribute *tmp_attr = g_ptr_array_index (list->attributes2, i);
+      PangoAttribute *tmp_attr = g_ptr_array_index (list->attributes, i);
 
       if (tmp_attr->start_index > end_index)
         break;
@@ -1626,7 +1626,7 @@ pango_attr_list_change (PangoAttrList  *list,
           /* We can merge the new attribute with this attribute. */
           attr->end_index = MAX (end_index, tmp_attr->end_index);
           pango_attribute_destroy (tmp_attr);
-          g_ptr_array_remove_index (list->attributes2, i);
+          g_ptr_array_remove_index (list->attributes, i);
           i--;
           p--;
           continue;
@@ -1642,9 +1642,9 @@ pango_attr_list_change (PangoAttrList  *list,
 
           tmp_attr->start_index = attr->end_index;
 
-          for (k = i + 1, m = list->attributes2->len; k < m; k++)
+          for (k = i + 1, m = list->attributes->len; k < m; k++)
             {
-              PangoAttribute *tmp_attr2 = g_ptr_array_index (list->attributes2, k);
+              PangoAttribute *tmp_attr2 = g_ptr_array_index (list->attributes, k);
 
               if (tmp_attr2->start_index >= tmp_attr->start_index)
                 break;
@@ -1687,15 +1687,15 @@ pango_attr_list_update (PangoAttrList *list,
 {
   guint i, p;
 
-  for (i = 0, p = list->attributes2->len; i < p; i++)
+  for (i = 0, p = list->attributes->len; i < p; i++)
     {
-      PangoAttribute *attr = g_ptr_array_index (list->attributes2, i);
+      PangoAttribute *attr = g_ptr_array_index (list->attributes, i);
 
       if (attr->start_index >= pos &&
           attr->end_index < pos + remove)
         {
           pango_attribute_destroy (attr);
-          g_ptr_array_remove_index (list->attributes2, i);
+          g_ptr_array_remove_index (list->attributes, i);
           i--; /* Look at this index again */
           p--;
           continue;
@@ -1765,9 +1765,9 @@ pango_attr_list_splice (PangoAttrList *list,
  */
 #define CLAMP_ADD(a,b) (((a) + (b) < (a)) ? G_MAXUINT : (a) + (b))
 
-  for (i = 0, p = list->attributes2->len; i < p; i++)
+  for (i = 0, p = list->attributes->len; i < p; i++)
     {
-      PangoAttribute *attr = g_ptr_array_index (list->attributes2, i);;
+      PangoAttribute *attr = g_ptr_array_index (list->attributes, i);;
 
       if (attr->start_index <= upos)
        {
@@ -1786,12 +1786,12 @@ pango_attr_list_splice (PangoAttrList *list,
         }
     }
 
-  if (!other->attributes2 || other->attributes2->len == 0)
+  if (!other->attributes || other->attributes->len == 0)
     return;
 
-  for (i = 0, p = other->attributes2->len; i < p; i++)
+  for (i = 0, p = other->attributes->len; i < p; i++)
     {
-      PangoAttribute *attr = pango_attribute_copy (g_ptr_array_index (other->attributes2, i));
+      PangoAttribute *attr = pango_attribute_copy (g_ptr_array_index (other->attributes, i));
       attr->start_index = CLAMP_ADD (attr->start_index, upos);
       attr->end_index = CLAMP_ADD (attr->end_index, upos);
 
@@ -1824,12 +1824,12 @@ pango_attr_list_get_attributes (PangoAttrList *list)
 
   g_return_val_if_fail (list != NULL, NULL);
 
-  if (!list->attributes2 || list->attributes2->len == 0)
+  if (!list->attributes || list->attributes->len == 0)
     return NULL;
 
-  for (i = 0, p = list->attributes2->len; i < p; i++)
+  for (i = 0, p = list->attributes->len; i < p; i++)
     {
-      PangoAttribute *attr = g_ptr_array_index (list->attributes2, i);
+      PangoAttribute *attr = g_ptr_array_index (list->attributes, i);
 
       result = g_slist_prepend (result, pango_attribute_copy (attr));
     }
@@ -1863,8 +1863,8 @@ pango_attr_list_equal (PangoAttrList *list,
   if (list == NULL || other_list == NULL)
     return FALSE;
 
-  attrs = list->attributes2;
-  other_attrs = other_list->attributes2;
+  attrs = list->attributes;
+  other_attrs = other_list->attributes;
 
   if (attrs->len != other_attrs->len)
     return FALSE;
@@ -1903,7 +1903,7 @@ pango_attr_list_equal (PangoAttrList *list,
 gboolean
 _pango_attr_list_has_attributes (const PangoAttrList *list)
 {
-  return list && (list->attributes2 != NULL && list->attributes2->len > 0);
+  return list && (list->attributes != NULL && list->attributes->len > 0);
 }
 
 G_DEFINE_BOXED_TYPE (PangoAttrIterator,
@@ -1916,7 +1916,7 @@ _pango_attr_list_get_iterator (PangoAttrList     *list,
                                PangoAttrIterator *iterator)
 {
   iterator->attribute_stack = NULL;
-  iterator->attrs = list->attributes2;
+  iterator->attrs = list->attributes;
   iterator->n_attrs = iterator->attrs ? iterator->attrs->len : 0;
 
   iterator->attr_index = 0;
@@ -2328,26 +2328,26 @@ pango_attr_list_filter (PangoAttrList       *list,
 
   g_return_val_if_fail (list != NULL, NULL);
 
-  if (!list->attributes2 || list->attributes2->len == 0)
+  if (!list->attributes || list->attributes->len == 0)
     return NULL;
 
-  for (i = 0, p = list->attributes2->len; i < p; i++)
+  for (i = 0, p = list->attributes->len; i < p; i++)
     {
-      PangoAttribute *tmp_attr = g_ptr_array_index (list->attributes2, i);
+      PangoAttribute *tmp_attr = g_ptr_array_index (list->attributes, i);
 
       if ((*func) (tmp_attr, data))
         {
-          g_ptr_array_remove_index (list->attributes2, i);
+          g_ptr_array_remove_index (list->attributes, i);
           i--; /* Need to look at this index again */
           p--;
 
           if (G_UNLIKELY (!new))
             {
               new = pango_attr_list_new ();
-              new->attributes2 = g_ptr_array_new ();
+              new->attributes = g_ptr_array_new ();
             }
 
-          g_ptr_array_add (new->attributes2, tmp_attr);
+          g_ptr_array_add (new->attributes, tmp_attr);
         }
     }
 


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