Avoid leaking of AtkAttributeSet data structure; speed up code.
authorPadraig O'Briain <padraigo@src.gnome.org>
Tue, 9 Oct 2001 14:01:44 +0000 (14:01 +0000)
committerPadraig O'Briain <padraigo@src.gnome.org>
Tue, 9 Oct 2001 14:01:44 +0000 (14:01 +0000)
* atk/atktext.c (atk_attribute_set_free):
Avoid leaking of AtkAttributeSet data structure; speed up code.

ChangeLog
atk/atktext.c

index a6f0b90..fdaf905 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-09  Padraig O'Briain  <padraig.obriain@sun.com>
+
+       * atk/atktext.c (atk_attribute_set_free):
+       Avoid leaking of AtkAttributeSet data structure; speed up code.
+
 2001-10-01  jacob berkman  <jacob@ximian.com>
 
        * docs/Makefile.am (dist-hook-local): depend on all-local so that
index f7cd043..f54501f 100755 (executable)
@@ -678,15 +678,20 @@ atk_text_set_caret_offset (AtkText *text,
 void
 atk_attribute_set_free(AtkAttributeSet *attrib_set)
 {
-  gint index;
+  GSList *temp;
 
-  if (attrib_set == NULL)
-    return;
+  temp = attrib_set;
 
-  for (index = 0; index < g_slist_length(attrib_set); index++)
-  {
-    g_free(((AtkAttribute*) (g_slist_nth(attrib_set,index)->data))->name);
-    g_free(((AtkAttribute*) (g_slist_nth(attrib_set,index)->data))->value);
-  }
-  g_slist_free(attrib_set);
+  while (temp != NULL)
+    {
+      AtkAttribute *att;
+
+      att = temp->data;
+
+      g_free (att->name);
+      g_free (att->value);
+      g_free (att);
+      temp = temp->next;
+    }
+  g_slist_free (attrib_set);
 }