[svn r25] String list cleaning function.
1.1 --- a/gmyth/src/gmyth_stringlist.c Thu Sep 28 16:11:10 2006 +0100
1.2 +++ b/gmyth/src/gmyth_stringlist.c Thu Sep 28 22:04:16 2006 +0100
1.3 @@ -245,6 +245,16 @@
1.4 return (GString *) g_list_nth_data (strlist->glist, index);
1.5 }
1.6
1.7 +
1.8 +static void
1.9 +gmyth_string_list_clear_element( GString *str_elem, void *data_aux )
1.10 +{
1.11 + if ( str_elem != NULL ) {
1.12 + g_string_free( str_elem, FALSE );
1.13 + str_elem = NULL;
1.14 + }
1.15 +}
1.16 +
1.17 /** Removes all strings from the string list.
1.18 *
1.19 * @param strlist The GMythStringList instance.
1.20 @@ -253,6 +263,7 @@
1.21 gmyth_string_list_clear_all ( GMythStringList *strlist )
1.22 {
1.23 if ( strlist != NULL && strlist->glist ) {
1.24 + g_list_foreach( strlist->glist, (GFunc)gmyth_string_list_clear_element, NULL );
1.25 g_list_free (strlist->glist);
1.26 strlist->glist = NULL;
1.27 }