# HG changeset patch # User rosfran # Date 1159477456 -3600 # Node ID 084148043ccf129faae2477ed5d4d8875c45a08d # Parent 915ef81992c09b2a862447a1838a91798426a5ce [svn r25] String list cleaning function. diff -r 915ef81992c0 -r 084148043ccf gmyth/src/gmyth_stringlist.c --- a/gmyth/src/gmyth_stringlist.c Thu Sep 28 16:11:10 2006 +0100 +++ b/gmyth/src/gmyth_stringlist.c Thu Sep 28 22:04:16 2006 +0100 @@ -245,6 +245,16 @@ return (GString *) g_list_nth_data (strlist->glist, index); } + +static void +gmyth_string_list_clear_element( GString *str_elem, void *data_aux ) +{ + if ( str_elem != NULL ) { + g_string_free( str_elem, FALSE ); + str_elem = NULL; + } +} + /** Removes all strings from the string list. * * @param strlist The GMythStringList instance. @@ -253,6 +263,7 @@ gmyth_string_list_clear_all ( GMythStringList *strlist ) { if ( strlist != NULL && strlist->glist ) { + g_list_foreach( strlist->glist, (GFunc)gmyth_string_list_clear_element, NULL ); g_list_free (strlist->glist); strlist->glist = NULL; }