summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@gnome.org>2018-07-26 00:18:59 +0100
committerAlberto Ruiz <aruiz@gnome.org>2018-08-06 11:13:47 +0100
commitff5c37d0c7cb3514857401012ef5418415bf676e (patch)
tree81cbdd2d422240a79ba6180732679f080644b6a5
parent453d8008083d2eefe5e9128137790c8357c58ed4 (diff)
downloadlibgdata-ff5c37d0c7cb3514857401012ef5418415bf676e.tar.gz
Remove use of foreach with wrong function prototype and use g_list_free_full
-rw-r--r--gdata/app/gdata-app-categories.c5
-rw-r--r--gdata/gd/gdata-gd-when.c5
-rw-r--r--gdata/gdata-entry.c15
-rw-r--r--gdata/gdata-feed.c20
-rw-r--r--gdata/media/gdata-media-group.c10
-rw-r--r--gdata/services/calendar/gdata-calendar-event.c15
-rw-r--r--gdata/services/contacts/gdata-contacts-contact.c70
7 files changed, 28 insertions, 112 deletions
diff --git a/gdata/app/gdata-app-categories.c b/gdata/app/gdata-app-categories.c
index 31585ff0..c21fa104 100644
--- a/gdata/app/gdata-app-categories.c
+++ b/gdata/app/gdata-app-categories.c
@@ -106,10 +106,7 @@ gdata_app_categories_dispose (GObject *object)
{
GDataAPPCategoriesPrivate *priv = GDATA_APP_CATEGORIES (object)->priv;
- if (priv->categories != NULL) {
- g_list_foreach (priv->categories, (GFunc) g_object_unref, NULL);
- g_list_free (priv->categories);
- }
+ g_list_free_full (priv->categories, g_object_unref);
priv->categories = NULL;
/* Chain up to the parent class */
diff --git a/gdata/gd/gdata-gd-when.c b/gdata/gd/gdata-gd-when.c
index 5b45aaae..98010934 100644
--- a/gdata/gd/gdata-gd-when.c
+++ b/gdata/gd/gdata-gd-when.c
@@ -193,10 +193,7 @@ gdata_gd_when_dispose (GObject *object)
{
GDataGDWhenPrivate *priv = GDATA_GD_WHEN (object)->priv;
- if (priv->reminders != NULL) {
- g_list_foreach (priv->reminders, (GFunc) g_object_unref, NULL);
- g_list_free (priv->reminders);
- }
+ g_list_free_full (priv->reminders, g_object_unref);
priv->reminders = NULL;
/* Chain up to the parent class */
diff --git a/gdata/gdata-entry.c b/gdata/gdata-entry.c
index 1833e3d1..2d84bc63 100644
--- a/gdata/gdata-entry.c
+++ b/gdata/gdata-entry.c
@@ -301,22 +301,13 @@ gdata_entry_dispose (GObject *object)
{
GDataEntryPrivate *priv = GDATA_ENTRY (object)->priv;
- if (priv->categories != NULL) {
- g_list_foreach (priv->categories, (GFunc) g_object_unref, NULL);
- g_list_free (priv->categories);
- }
+ g_list_free_full (priv->categories, g_object_unref);
priv->categories = NULL;
- if (priv->links != NULL) {
- g_list_foreach (priv->links, (GFunc) g_object_unref, NULL);
- g_list_free (priv->links);
- }
+ g_list_free_full (priv->links, g_object_unref);
priv->links = NULL;
- if (priv->authors != NULL) {
- g_list_foreach (priv->authors, (GFunc) g_object_unref, NULL);
- g_list_free (priv->authors);
- }
+ g_list_free_full (priv->authors, g_object_unref);
priv->authors = NULL;
/* Chain up to the parent class */
diff --git a/gdata/gdata-feed.c b/gdata/gdata-feed.c
index 8db1f7da..00655511 100644
--- a/gdata/gdata-feed.c
+++ b/gdata/gdata-feed.c
@@ -328,28 +328,16 @@ gdata_feed_dispose (GObject *object)
{
GDataFeedPrivate *priv = GDATA_FEED (object)->priv;
- if (priv->entries != NULL) {
- g_list_foreach (priv->entries, (GFunc) g_object_unref, NULL);
- g_list_free (priv->entries);
- }
+ g_list_free_full (priv->entries, g_object_unref);
priv->entries = NULL;
- if (priv->categories != NULL) {
- g_list_foreach (priv->categories, (GFunc) g_object_unref, NULL);
- g_list_free (priv->categories);
- }
+ g_list_free_full (priv->categories, g_object_unref);
priv->categories = NULL;
- if (priv->links != NULL) {
- g_list_foreach (priv->links, (GFunc) g_object_unref, NULL);
- g_list_free (priv->links);
- }
+ g_list_free_full (priv->links, g_object_unref);
priv->links = NULL;
- if (priv->authors != NULL) {
- g_list_foreach (priv->authors, (GFunc) g_object_unref, NULL);
- g_list_free (priv->authors);
- }
+ g_list_free_full (priv->authors, g_object_unref);
priv->authors = NULL;
if (priv->generator != NULL)
diff --git a/gdata/media/gdata-media-group.c b/gdata/media/gdata-media-group.c
index 1ab5be71..af2bf479 100644
--- a/gdata/media/gdata-media-group.c
+++ b/gdata/media/gdata-media-group.c
@@ -106,16 +106,10 @@ gdata_media_group_dispose (GObject *object)
g_object_unref (priv->credit);
priv->credit = NULL;
- if (priv->contents != NULL) {
- g_list_foreach (priv->contents, (GFunc) g_object_unref, NULL);
- g_list_free (priv->contents);
- }
+ g_list_free_full (priv->contents, g_object_unref);
priv->contents = NULL;
- if (priv->thumbnails != NULL) {
- g_list_foreach (priv->thumbnails, (GFunc) g_object_unref, NULL);
- g_list_free (priv->thumbnails);
- }
+ g_list_free_full (priv->thumbnails, g_object_unref);
priv->thumbnails = NULL;
/* Chain up to the parent class */
diff --git a/gdata/services/calendar/gdata-calendar-event.c b/gdata/services/calendar/gdata-calendar-event.c
index bd58a07c..7602798f 100644
--- a/gdata/services/calendar/gdata-calendar-event.c
+++ b/gdata/services/calendar/gdata-calendar-event.c
@@ -392,22 +392,13 @@ gdata_calendar_event_dispose (GObject *object)
{
GDataCalendarEventPrivate *priv = GDATA_CALENDAR_EVENT (object)->priv;
- if (priv->times != NULL) {
- g_list_foreach (priv->times, (GFunc) g_object_unref, NULL);
- g_list_free (priv->times);
- }
+ g_list_free_full(priv->times, g_object_unref);
priv->times = NULL;
- if (priv->people != NULL) {
- g_list_foreach (priv->people, (GFunc) g_object_unref, NULL);
- g_list_free (priv->people);
- }
+ g_list_free_full (priv->people, g_object_unref);
priv->people = NULL;
- if (priv->places != NULL) {
- g_list_foreach (priv->places, (GFunc) g_object_unref, NULL);
- g_list_free (priv->places);
- }
+ g_list_free_full (priv->places, g_object_unref);
priv->places = NULL;
/* Chain up to the parent class */
diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c
index 070ec780..389eceea 100644
--- a/gdata/services/contacts/gdata-contacts-contact.c
+++ b/gdata/services/contacts/gdata-contacts-contact.c
@@ -644,10 +644,7 @@ gdata_contacts_contact_finalize (GObject *object)
g_free (priv->short_name);
g_free (priv->subject);
- if (priv->hobbies != NULL) {
- g_list_foreach (priv->hobbies, (GFunc) g_free, NULL);
- g_list_free (priv->hobbies);
- }
+ g_list_free_full (priv->hobbies, g_free);
/* Chain up to the parent class */
G_OBJECT_CLASS (gdata_contacts_contact_parent_class)->finalize (object);
@@ -1966,10 +1963,7 @@ gdata_contacts_contact_remove_all_email_addresses (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->email_addresses != NULL) {
- g_list_foreach (priv->email_addresses, (GFunc) g_object_unref, NULL);
- g_list_free (priv->email_addresses);
- }
+ g_list_free_full (priv->email_addresses, g_object_unref);
priv->email_addresses = NULL;
}
@@ -2055,10 +2049,7 @@ gdata_contacts_contact_remove_all_im_addresses (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->im_addresses != NULL) {
- g_list_foreach (priv->im_addresses, (GFunc) g_object_unref, NULL);
- g_list_free (priv->im_addresses);
- }
+ g_list_free_full (priv->im_addresses, g_object_unref);
priv->im_addresses = NULL;
}
@@ -2144,10 +2135,7 @@ gdata_contacts_contact_remove_all_phone_numbers (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->phone_numbers != NULL) {
- g_list_foreach (priv->phone_numbers, (GFunc) g_object_unref, NULL);
- g_list_free (priv->phone_numbers);
- }
+ g_list_free_full (priv->phone_numbers, g_object_unref);
priv->phone_numbers = NULL;
}
@@ -2233,10 +2221,7 @@ gdata_contacts_contact_remove_all_postal_addresses (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->postal_addresses != NULL) {
- g_list_foreach (priv->postal_addresses, (GFunc) g_object_unref, NULL);
- g_list_free (priv->postal_addresses);
- }
+ g_list_free_full (priv->postal_addresses, g_object_unref);
priv->postal_addresses = NULL;
}
@@ -2322,10 +2307,7 @@ gdata_contacts_contact_remove_all_organizations (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->organizations != NULL) {
- g_list_foreach (priv->organizations, (GFunc) g_object_unref, NULL);
- g_list_free (priv->organizations);
- }
+ g_list_free_full (priv->organizations, g_object_unref);
priv->organizations = NULL;
}
@@ -2381,10 +2363,7 @@ gdata_contacts_contact_remove_all_jots (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->jots != NULL) {
- g_list_foreach (priv->jots, (GFunc) g_object_unref, NULL);
- g_list_free (priv->jots);
- }
+ g_list_free_full (priv->jots, g_object_unref);
priv->jots = NULL;
}
@@ -2441,10 +2420,7 @@ gdata_contacts_contact_remove_all_relations (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->relations != NULL) {
- g_list_foreach (priv->relations, (GFunc) g_object_unref, NULL);
- g_list_free (priv->relations);
- }
+ g_list_free_full (priv->relations, g_object_unref);
priv->relations = NULL;
}
@@ -2527,10 +2503,7 @@ gdata_contacts_contact_remove_all_websites (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->websites != NULL) {
- g_list_foreach (priv->websites, (GFunc) g_object_unref, NULL);
- g_list_free (priv->websites);
- }
+ g_list_free_full (priv->websites, g_object_unref);
priv->websites = NULL;
}
@@ -2587,10 +2560,7 @@ gdata_contacts_contact_remove_all_events (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->events != NULL) {
- g_list_foreach (priv->events, (GFunc) g_object_unref, NULL);
- g_list_free (priv->events);
- }
+ g_list_free_full (priv->events, g_object_unref);
priv->events = NULL;
}
@@ -2673,10 +2643,7 @@ gdata_contacts_contact_remove_all_calendars (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->calendars != NULL) {
- g_list_foreach (priv->calendars, (GFunc) g_object_unref, NULL);
- g_list_free (priv->calendars);
- }
+ g_list_free_full (priv->calendars, g_object_unref);
priv->calendars = NULL;
}
@@ -2733,10 +2700,7 @@ gdata_contacts_contact_remove_all_external_ids (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->external_ids != NULL) {
- g_list_foreach (priv->external_ids, (GFunc) g_object_unref, NULL);
- g_list_free (priv->external_ids);
- }
+ g_list_free_full (priv->external_ids, g_object_unref);
priv->external_ids = NULL;
}
@@ -2793,10 +2757,7 @@ gdata_contacts_contact_remove_all_hobbies (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->hobbies != NULL) {
- g_list_foreach (priv->hobbies, (GFunc) g_free, NULL);
- g_list_free (priv->hobbies);
- }
+ g_list_free_full (priv->hobbies, g_free);
priv->hobbies = NULL;
}
@@ -2853,10 +2814,7 @@ gdata_contacts_contact_remove_all_languages (GDataContactsContact *self)
g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
- if (priv->languages != NULL) {
- g_list_foreach (priv->languages, (GFunc) g_object_unref, NULL);
- g_list_free (priv->languages);
- }
+ g_list_free_full (priv->languages, g_object_unref);
priv->languages = NULL;
}