From 159e654dbcc452614c67e2c7e58d3dbf44ba4fc5 Mon Sep 17 00:00:00 2001 From: Padraig O'Briain Date: Tue, 9 Oct 2001 14:01:44 +0000 Subject: [PATCH] Avoid leaking of AtkAttributeSet data structure; speed up code. * atk/atktext.c (atk_attribute_set_free): Avoid leaking of AtkAttributeSet data structure; speed up code. --- ChangeLog | 5 +++++ atk/atktext.c | 23 ++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6f0b90..fdaf905 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-10-09 Padraig O'Briain + + * atk/atktext.c (atk_attribute_set_free): + Avoid leaking of AtkAttributeSet data structure; speed up code. + 2001-10-01 jacob berkman * docs/Makefile.am (dist-hook-local): depend on all-local so that diff --git a/atk/atktext.c b/atk/atktext.c index f7cd043..f54501f 100755 --- a/atk/atktext.c +++ b/atk/atktext.c @@ -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); } -- 2.7.4