Remove mgu_clear_list() function

Its remaining uses were unnecessary, because in each
case, the list was being freed immediately afterwards,
without freeing the data. This function only set the
list items' data pointer to NULL, which served no
purpose here.
This commit is contained in:
Andrej Kacian 2019-03-13 20:55:36 +01:00
parent 92074af6a1
commit fd2dcd76f6
5 changed files with 2 additions and 20 deletions

View file

@ -3777,7 +3777,6 @@ static void addressbook_folder_load_person( GtkCMCTree *clist, ItemFolder *itemF
addressbook_folder_load_one_person( clist, cur->data, atci, atciMail );
}
/* Free up the list */
mgu_clear_list( items );
g_list_free( items );
}
@ -3855,7 +3854,6 @@ static void addressbook_folder_load_group( GtkCMCTree *clist, ItemFolder *itemFo
gtk_sctree_sort_node(clist, NULL);
}
/* Free up the list */
mgu_clear_list( items );
g_list_free( items );
}
@ -5254,7 +5252,6 @@ static void addrbookctl_build_ifselect( void ) {
g_free( selectStr );
/* Replace existing list */
mgu_clear_list( _addressIFaceSelection_ );
g_list_free( _addressIFaceSelection_ );
_addressIFaceSelection_ = newList;
newList = NULL;

View file

@ -2960,8 +2960,8 @@ gboolean addrindex_load_completion(
nodeM = g_list_next( nodeM );
}
}
/* Free up the list */
mgu_clear_list( items );
/* Free up the list (but not the data inside the
* individual list items) */
g_list_free( items );
return TRUE;

View file

@ -688,7 +688,6 @@ void addritem_free_item_group( ItemGroup *group ) {
g_free( ADDRITEM_ID(group) );
g_free( ADDRITEM_NAME(group) );
g_free( group->remarks );
mgu_clear_list( group->listEMail );
g_list_free( group->listEMail );
ADDRITEM_TYPE(group) = ITEMTYPE_NONE;
@ -864,7 +863,6 @@ void addritem_free_item_folder( ItemFolder *folder ) {
g_free( ADDRITEM_ID(folder) );
g_free( ADDRITEM_NAME(folder) );
g_free( folder->remarks );
mgu_clear_list( folder->listItems );
g_list_free( folder->listItems );
ADDRITEM_TYPE(folder) = ITEMTYPE_NONE;

View file

@ -133,18 +133,6 @@ gchar *mgu_replace_string( gchar *str, const gchar *value ) {
return str;
}
/*
* Clear a linked list by setting node data pointers to NULL. Note that
* items are not freed.
*/
void mgu_clear_list( GList *list ) {
GList *node = list;
while( node ) {
node->data = NULL;
node = g_list_next( node );
}
}
/*
* Test and reformat an email address.
* Enter: address.

View file

@ -47,7 +47,6 @@ void mgu_free_list ( GSList *list );
void mgu_free_dlist ( GList *list );
gchar *mgu_list_coalesce ( GSList *list );
gchar *mgu_replace_string ( gchar *str, const gchar *value );
void mgu_clear_list ( GList *list );
gchar *mgu_email_check_empty ( gchar *address );
GList *mgu_parse_string ( gchar *line, const gint maxTokens,
gint *tokenCnt );