summaryrefslogtreecommitdiff
path: root/src/grl-source.c
diff options
context:
space:
mode:
authorJuan A. Suarez Romero <jasuarez@igalia.com>2014-03-06 17:28:08 +0000
committerJuan A. Suarez Romero <jasuarez@igalia.com>2014-03-06 18:31:32 +0100
commit806a8598c34d5b408eeebd3b699d50a03bd5c105 (patch)
treeb27efc3e695ee6c86189939defcfb547a459df13 /src/grl-source.c
parent0d380b7e10b84740a54ec108df61fc4c62b43e0f (diff)
downloadgrilo-806a8598c34d5b408eeebd3b699d50a03bd5c105.tar.gz
core: Use g_clear_pointer/object when possible
Reduces the number of lines and makes the code more readable.
Diffstat (limited to 'src/grl-source.c')
-rw-r--r--src/grl-source.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/grl-source.c b/src/grl-source.c
index 2cf1cc7..8fd7597 100644
--- a/src/grl-source.c
+++ b/src/grl-source.c
@@ -544,9 +544,7 @@ grl_source_finalize (GObject *object)
static void
set_string_property (gchar **property, const GValue *value)
{
- if (*property) {
- g_free (*property);
- }
+ g_clear_pointer (property, g_free);
*property = g_value_dup_string (value);
}
@@ -1177,9 +1175,7 @@ resolve_relay_free (struct ResolveRelayCb *rrc)
}
g_hash_table_unref (rrc->map);
}
-
- if (rrc->resolve_specs)
- g_hash_table_unref (rrc->resolve_specs);
+ g_clear_pointer (&rrc->resolve_specs, g_hash_table_unref);
g_slice_free (struct ResolveRelayCb, rrc);
}
@@ -1193,9 +1189,8 @@ browse_relay_free (struct BrowseRelayCb *brc)
if (brc->auto_split) {
g_slice_free (struct AutoSplitCtl, brc->auto_split);
}
- if (brc->queue) {
- g_queue_free (brc->queue);
- }
+ g_clear_pointer (&brc->queue, g_queue_free);
+
g_slice_free (struct BrowseRelayCb, brc);
}