[totem] main: Use g_clear_pointer()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] main: Use g_clear_pointer()
- Date: Wed, 13 Mar 2013 11:06:07 +0000 (UTC)
commit 1960c365af1b4fdebf3c21b384a6d64ea7363d5e
Author: Bastien Nocera <hadess hadess net>
Date: Wed Mar 13 11:57:07 2013 +0100
main: Use g_clear_pointer()
src/totem-fullscreen.c | 8 ++------
src/totem-object.c | 6 ++----
src/totem-open-location.c | 4 ++--
src/totem-properties-view.c | 13 +++----------
src/totem.c | 3 +--
5 files changed, 10 insertions(+), 24 deletions(-)
---
diff --git a/src/totem-fullscreen.c b/src/totem-fullscreen.c
index fac1b05..2f1d625 100644
--- a/src/totem-fullscreen.c
+++ b/src/totem-fullscreen.c
@@ -509,8 +509,7 @@ totem_fullscreen_dispose (GObject *object)
TotemFullscreenPrivate *priv = TOTEM_FULLSCREEN_GET_PRIVATE (object);
if (priv->xml != NULL) {
- g_object_unref (priv->xml);
- priv->xml = NULL;
+ g_clear_object (&priv->xml);
gtk_widget_destroy (priv->exit_popup);
gtk_widget_destroy (priv->control_popup);
}
@@ -524,10 +523,7 @@ totem_fullscreen_finalize (GObject *object)
TotemFullscreen *fs = TOTEM_FULLSCREEN (object);
totem_fullscreen_popup_timeout_remove (fs);
- if (fs->priv->filter) {
- g_object_unref (fs->priv->filter);
- fs->priv->filter = NULL;
- }
+ g_clear_object (&fs->priv->filter);
g_signal_handlers_disconnect_by_func (fs->priv->parent_window,
G_CALLBACK (totem_fullscreen_window_realize_cb),
diff --git a/src/totem-object.c b/src/totem-object.c
index 15cf9b6..cfb9447 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -1179,8 +1179,7 @@ totem_action_eject (TotemObject *totem)
if (mount == NULL)
return;
- g_free (totem->mrl);
- totem->mrl = NULL;
+ g_clear_pointer (&totem->mrl, g_free);
bacon_video_widget_close (totem->bvw);
totem_file_closed (totem);
totem->has_played_emitted = FALSE;
@@ -1631,8 +1630,7 @@ totem_action_set_mrl_with_warning (TotemObject *totem,
totem->seek_to = 0;
totem->seek_to_start = 0;
- g_free (totem->mrl);
- totem->mrl = NULL;
+ g_clear_pointer (&totem->mrl, g_free);
bacon_video_widget_close (totem->bvw);
totem_file_closed (totem);
totem->has_played_emitted = FALSE;
diff --git a/src/totem-open-location.c b/src/totem-open-location.c
index f53446e..6ac2fa8 100644
--- a/src/totem-open-location.c
+++ b/src/totem-open-location.c
@@ -119,8 +119,8 @@ totem_open_location_get_uri (TotemOpenLocation *open_location)
uri = g_strdup (gtk_entry_get_text (open_location->priv->uri_entry));
- if (strcmp (uri, "") == 0)
- uri = NULL;
+ if (*uri == '\0')
+ g_clear_pointer (&uri, g_free);
if (uri != NULL && g_strrstr (uri, "://") == NULL)
{
diff --git a/src/totem-properties-view.c b/src/totem-properties-view.c
index b5f7eda..86a22f1 100644
--- a/src/totem-properties-view.c
+++ b/src/totem-properties-view.c
@@ -334,16 +334,9 @@ totem_properties_view_finalize (GObject *object)
props = TOTEM_PROPERTIES_VIEW (object);
- if (props->priv != NULL)
- {
- if (props->priv->disco != NULL) {
- g_object_unref (G_OBJECT (props->priv->disco));
- props->priv->disco = NULL;
- }
- if (props->priv->label != NULL) {
- g_object_unref (G_OBJECT (props->priv->label));
- props->priv->label = NULL;
- }
+ if (props->priv != NULL) {
+ g_clear_object (&props->priv->disco);
+ g_clear_object (&props->priv->label);
g_free (props->priv);
}
props->priv = NULL;
diff --git a/src/totem.c b/src/totem.c
index c191c54..c713d59 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -217,8 +217,7 @@ app_command_line (GApplication *app,
gdk_notify_startup_complete ();
/* Don't add files again through totem_options_process_for_server() */
- g_strfreev (optionstate.filenames);
- optionstate.filenames = NULL;
+ g_clear_pointer (&optionstate.filenames, g_strfreev);
startup_called = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]