talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit ddfa3c24f186ce768680dd4b97433752a27a1210
parent 59fdc07ddeff92ab869956e142de8716c973330e
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Wed, 13 Mar 2019 21:58:56 +0100

Remove mgu_free_list() and mgu_free_dlist()

We depend on glib 2.28, which has g_slist_free_full()
and g_list_free_full(), which we can use instead.

Diffstat:
Msrc/addressbook.c | 2+-
Msrc/addrharvest.c | 4++--
Msrc/addrindex.c | 2+-
Msrc/common/mgutils.c | 26--------------------------
Msrc/common/mgutils.h | 2--
Msrc/editjpilot.c | 2+-
Msrc/editldap.c | 2+-
Msrc/editldap_basedn.c | 2+-
Msrc/jpilot.c | 4++--
Msrc/ldapctrl.c | 2+-
Msrc/ldapquery.c | 12++++++------
Msrc/ldif.c | 10+++++-----
Msrc/mutt.c | 8++++----
Msrc/pine.c | 4++--
Msrc/vcard.c | 10+++++-----
15 files changed, 32 insertions(+), 60 deletions(-)

diff --git a/src/addressbook.c b/src/addressbook.c @@ -2389,7 +2389,7 @@ static void addressbook_mail_to_cb( GtkAction *action, gpointer data ) { if( ! addrselect_test_empty( _addressSelect_ ) ) { listAddress = addrselect_build_list( _addressSelect_ ); compose_new_with_list( NULL, listAddress ); - mgu_free_dlist( listAddress ); + g_list_free_full( listAddress, g_free ); listAddress = NULL; } } diff --git a/src/addrharvest.c b/src/addrharvest.c @@ -731,7 +731,7 @@ static gint addrharvest_readfile( } buf = mgu_list_coalesce( list ); - mgu_free_list( list ); + g_slist_free_full( list, g_free ); if(( p = strchr( buf, ':' ) ) != NULL ) { addr = p + 1; @@ -891,7 +891,7 @@ gint addrharvest_harvest( else { addrharvest_harvest_list( harvester, cache, listHdr, msgList ); } - mgu_free_dlist( listHdr ); + g_list_free_full( listHdr, g_free ); #ifndef USE_ALT_ADDRBOOK /* Mark cache */ diff --git a/src/addrindex.c b/src/addrindex.c @@ -1295,7 +1295,7 @@ static void addrindex_parse_ldap_attrlist( XMLFile *file, LdapControl *ctl ) { rc = xml_parse_next_tag( file ); if( rc != 0 ) { /* Terminate prematurely */ - mgu_free_dlist( list ); + g_list_free_full( list, g_free ); list = NULL; return; } diff --git a/src/common/mgutils.c b/src/common/mgutils.c @@ -58,32 +58,6 @@ void mgu_print_dlist( GList *list, FILE *stream ) { } /* -* Free linked list of character strings. -*/ -void mgu_free_list( GSList *list ) { - GSList *node = list; - while( node ) { - g_free( node->data ); - node->data = NULL; - node = g_slist_next( node ); - } - g_slist_free( list ); -} - -/* -* Free linked list of character strings. -*/ -void mgu_free_dlist( GList *list ) { - GList *node = list; - while( node ) { - g_free( node->data ); - node->data = NULL; - node = g_list_next( node ); - } - g_list_free( list ); -} - -/* * Coalesce linked list of characaters into one long string. */ gchar *mgu_list_coalesce( GSList *list ) { diff --git a/src/common/mgutils.h b/src/common/mgutils.h @@ -43,8 +43,6 @@ /* Function prototypes */ void mgu_print_list ( GSList *list, FILE *stream ); void mgu_print_dlist ( GList *list, FILE *stream ); -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 ); gchar *mgu_email_check_empty ( gchar *address ); diff --git a/src/editjpilot.c b/src/editjpilot.c @@ -123,7 +123,7 @@ static void edit_jpilot_fill_check_box( JPilotFile *jpf ) { done = TRUE; } } - mgu_free_dlist( customLbl ); + g_list_free_full( customLbl, g_free ); customLbl = NULL; } diff --git a/src/editldap.c b/src/editldap.c @@ -254,7 +254,7 @@ static void edit_ldap_server_check( void ) { } node = g_list_next( node ); } - mgu_free_dlist( baseDN ); + g_list_free_full( baseDN, g_free ); baseDN = node = NULL; flg = TRUE; } else { diff --git a/src/editldap_basedn.c b/src/editldap_basedn.c @@ -311,7 +311,7 @@ static void edit_ldap_bdn_load_data( if (gtk_tree_model_get_iter_first(model, &iter)) gtk_tree_selection_select_iter(sel, &iter); - mgu_free_dlist( baseDN ); + g_list_free_full( baseDN, g_free ); baseDN = node = NULL; } ldapedit_basedn_bad_server = FALSE; diff --git a/src/jpilot.c b/src/jpilot.c @@ -256,7 +256,7 @@ void jpilot_clear_custom_labels( JPilotFile *pilotFile ) { cm_return_if_fail( pilotFile != NULL ); /* Release custom labels */ - mgu_free_dlist( pilotFile->customLabels ); + g_list_free_full( pilotFile->customLabels, g_free ); pilotFile->customLabels = NULL; /* Release indexes */ @@ -1079,7 +1079,7 @@ static void jpilot_parse_label( JPilotFile *pilotFile, gchar *labelEntry, ItemPe addrcache_person_add_email( pilotFile->addressCache, person, email ); node = g_list_next( node ); } - mgu_free_dlist( list ); + g_list_free_full( list, g_free ); list = NULL; } } diff --git a/src/ldapctrl.c b/src/ldapctrl.c @@ -241,7 +241,7 @@ GList *ldapctl_get_criteria_list( const LdapControl* ctl ) { */ void ldapctl_criteria_list_clear( LdapControl *ctl ) { cm_return_if_fail( ctl != NULL ); - mgu_free_dlist( ctl->listCriteria ); + g_list_free_full( ctl->listCriteria, g_free ); ctl->listCriteria = NULL; } diff --git a/src/ldapquery.c b/src/ldapquery.c @@ -370,11 +370,11 @@ static void ldapqry_free_lists( GSList *listLast, GSList *listDisplay, GSList *other_attrs ) { GSList *cur = other_attrs; - mgu_free_list( listName ); - mgu_free_list( listAddr ); - mgu_free_list( listFirst ); - mgu_free_list( listLast ); - mgu_free_list( listDisplay ); + g_slist_free_full( listName, g_free ); + g_slist_free_full( listAddr, g_free ); + g_slist_free_full( listFirst, g_free ); + g_slist_free_full( listLast, g_free ); + g_slist_free_full( listDisplay, g_free ); for(;cur; cur = cur->next) addritem_free_attribute((UserAttribute *)cur->data); g_slist_free(other_attrs); @@ -625,7 +625,7 @@ static GList *ldapqry_process_single_entry( addritem_attrib_set_value( attrib, attvalue ); other_attrs = g_slist_prepend(other_attrs, attrib); } - mgu_free_list(attlist); + g_slist_free_full(attlist, g_free); } /* Free memory used to store attribute */ ldap_memfree( attribute ); diff --git a/src/ldif.c b/src/ldif.c @@ -651,7 +651,7 @@ static void ldif_read_file( LdifFile *ldifFile, AddressCache *cache ) { ldif_build_items( ldifFile, rec, cache ); ldif_clear_rec( rec ); g_free( lastTag ); - mgu_free_list( listValue ); + g_slist_free_full( listValue, g_free ); g_free(fullValue); lastTag = NULL; listValue = NULL; @@ -696,7 +696,7 @@ static void ldif_read_file( LdifFile *ldifFile, AddressCache *cache ) { rec, lastTag, fullValue, hashField ); g_free( lastTag ); - mgu_free_list( listValue ); + g_slist_free_full( listValue, g_free ); lastTag = NULL; listValue = NULL; } @@ -719,7 +719,7 @@ static void ldif_read_file( LdifFile *ldifFile, AddressCache *cache ) { ldif_clear_rec( rec ); g_free( rec ); g_free( lastTag ); - mgu_free_list( listValue ); + g_slist_free_full( listValue, g_free ); } /** @@ -854,7 +854,7 @@ static void ldif_read_tag_list( LdifFile *ldifFile ) { ldif_hash_add_list( ldifFile->hashFields, listTags ); } - mgu_free_list( listTags ); + g_slist_free_full( listTags, g_free ); listTags = NULL; flagMail = FALSE; } @@ -891,7 +891,7 @@ static void ldif_read_tag_list( LdifFile *ldifFile ) { } /* Release data */ - mgu_free_list( listTags ); + g_slist_free_full( listTags, g_free ); listTags = NULL; } diff --git a/src/mutt.c b/src/mutt.c @@ -416,7 +416,7 @@ static void mutt_build_items( MuttFile *muttFile, AddressCache *cache, gchar *li list = mgu_parse_string( line, 3, &tCount ); if( tCount < 3 ) { if( list ) { - mgu_free_dlist( list ); + g_list_free_full( list, g_free ); list = NULL; } return; @@ -438,7 +438,7 @@ static void mutt_build_items( MuttFile *muttFile, AddressCache *cache, gchar *li mutt_build_address( muttFile, cache, aliasName, addrList, aCount ); } - mgu_free_dlist( list ); + g_list_free_full( list, g_free ); list = NULL; } @@ -479,7 +479,7 @@ static void mutt_read_file( MuttFile *muttFile, AddressCache *cache ) { } g_free( lineValue ); lineValue = NULL; - mgu_free_list( listValue ); + g_slist_free_full( listValue, g_free ); listValue = NULL; } lastCont = flagCont; @@ -492,7 +492,7 @@ static void mutt_read_file( MuttFile *muttFile, AddressCache *cache ) { } /* Release data */ - mgu_free_list( listValue ); + g_slist_free_full( listValue, g_free ); listValue = NULL; } diff --git a/src/pine.c b/src/pine.c @@ -576,7 +576,7 @@ static void pine_read_file( PineFile *pineFile, AddressCache *cache ) { } g_free( lineValue ); lineValue = NULL; - mgu_free_list( listValue ); + g_slist_free_full( listValue, g_free ); listValue = NULL; } if( line != NULL ) { @@ -591,7 +591,7 @@ static void pine_read_file( PineFile *pineFile, AddressCache *cache ) { } /* Release data */ - mgu_free_list( listValue ); + g_slist_free_full( listValue, g_free ); listValue = NULL; } diff --git a/src/vcard.c b/src/vcard.c @@ -248,10 +248,10 @@ static gchar *vcard_get_line( VCardFile *cardFile ) { * Free linked lists of character strings. */ static void vcard_free_lists( GSList *listName, GSList *listAddr, GSList *listRem, GSList* listID ) { - mgu_free_list( listName ); - mgu_free_list( listAddr ); - mgu_free_list( listRem ); - mgu_free_list( listID ); + g_slist_free_full( listName, g_free ); + g_slist_free_full( listAddr, g_free ); + g_slist_free_full( listRem, g_free ); + g_slist_free_full( listID, g_free ); } /* @@ -275,7 +275,7 @@ static gchar *vcard_read_qp( VCardFile *cardFile, char *tagvalue ) { line = mgu_list_coalesce( listQP ); /* Clean up */ - mgu_free_list( listQP ); + g_slist_free_full( listQP, g_free ); listQP = NULL; return line; }