diff options
author | Timm Bäder <mail@baedert.org> | 2016-04-23 16:06:01 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2016-06-20 12:39:44 +0200 |
commit | 5c98143086a37b728ac187a934028e650d1a6c0f (patch) | |
tree | fbd8e634a523f7b81df68ba6b2657f63dadb68d3 | |
parent | 4ea1fca79b719d5f7c5458d96bce9b62a762c715 (diff) | |
download | librest-5c98143086a37b728ac187a934028e650d1a6c0f.tar.gz |
RestProxy(Call): Simplify _dispose
-rw-r--r-- | rest/rest-proxy-call.c | 27 | ||||
-rw-r--r-- | rest/rest-proxy.c | 6 |
2 files changed, 5 insertions, 28 deletions
diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c index 7abf367..4a5425a 100644 --- a/rest/rest-proxy-call.c +++ b/rest/rest-proxy-call.c @@ -144,29 +144,10 @@ rest_proxy_call_dispose (GObject *object) g_clear_object (&priv->cancellable); } - if (priv->params) - { - rest_params_free (priv->params); - priv->params = NULL; - } - - if (priv->headers) - { - g_hash_table_unref (priv->headers); - priv->headers = NULL; - } - - if (priv->response_headers) - { - g_hash_table_unref (priv->response_headers); - priv->response_headers = NULL; - } - - if (priv->proxy) - { - g_object_unref (priv->proxy); - priv->proxy = NULL; - } + g_clear_pointer (&priv->params, rest_params_free); + g_clear_pointer (&priv->headers, g_hash_table_unref); + g_clear_pointer (&priv->response_headers, g_hash_table_unref); + g_clear_object (&priv->proxy); G_OBJECT_CLASS (rest_proxy_call_parent_class)->dispose (object); } diff --git a/rest/rest-proxy.c b/rest/rest-proxy.c index d79d204..9061221 100644 --- a/rest/rest-proxy.c +++ b/rest/rest-proxy.c @@ -194,11 +194,7 @@ rest_proxy_dispose (GObject *object) { RestProxyPrivate *priv = GET_PRIVATE (object); - if (priv->session) - { - g_object_unref (priv->session); - priv->session = NULL; - } + g_clear_object (&priv->session); G_OBJECT_CLASS (rest_proxy_parent_class)->dispose (object); } |