From 212d9c7152e688d569240cdae0833b5d629c0fb2 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Wed, 8 Mar 2006 11:02:18 +0000 Subject: [PATCH] free the whole list instead of deleting it one element at a time. 2006-03-08 Sven Neumann * app/base/siox.c (find_max_blob): free the whole list instead of deleting it one element at a time. --- ChangeLog | 5 +++++ app/base/siox.c | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 06885885a4..ca2f5a78a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-03-08 Sven Neumann + + * app/base/siox.c (find_max_blob): free the whole list instead of + deleting it one element at a time. + 2006-03-06 Sven Neumann * app/display/gimpdisplay.c (gimp_display_reconnect): keep a diff --git a/app/base/siox.c b/app/base/siox.c index 9029f051ea..487e2f918f 100644 --- a/app/base/siox.c +++ b/app/base/siox.c @@ -584,6 +584,7 @@ find_max_blob (TileManager *mask, const gint sizeFactorToKeep) { GSList *list = NULL; + GSList *iter; PixelRegion region; gpointer pr; gint row, col; @@ -633,11 +634,9 @@ find_max_blob (TileManager *mask, } } - while (list != NULL) + for (iter = list; iter; iter = iter->next) { - struct blob *b = list->data; - - list = g_slist_delete_link (list, list); + struct blob *b = iter->data; depth_first_search (mask, x, y, x + width, y + height, b, (b->mustkeep @@ -645,6 +644,8 @@ find_max_blob (TileManager *mask, FIND_BLOB_FINAL : 0); g_free (b); } + + g_slist_free (list); } /* Creates a key for the hashtable from a given pixel color value */ @@ -797,11 +798,11 @@ siox_foreground_extract (SioxState *state, gint x, y; gint width, height; gfloat clustersize; + lab *surebg = NULL; + lab *surefg = NULL; gint surebgcount = 0; gint surefgcount = 0; gint i, j; - lab *surebg; - lab *surefg; gfloat limits[3]; g_return_if_fail (state != NULL);