[Xfce4-commits] <xfconf:master> Use g_clear_error where possible.

Nick Schermer noreply at xfce.org
Mon Feb 8 19:56:03 CET 2010


Updating branch refs/heads/master
         to 3451406146461eda8548c6561432dad35b8c6214 (commit)
       from 128fad2d48fbaf23254249a4ec43587bf5958735 (commit)

commit 3451406146461eda8548c6561432dad35b8c6214
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Feb 8 18:44:58 2010 +0100

    Use g_clear_error where possible.

 xfconfd/xfconf-backend-perchannel-xml.c |   10 ++--------
 xfconfd/xfconf-daemon.c                 |   29 ++++++++++-------------------
 2 files changed, 12 insertions(+), 27 deletions(-)

diff --git a/xfconfd/xfconf-backend-perchannel-xml.c b/xfconfd/xfconf-backend-perchannel-xml.c
index 5ac5dae..324938f 100644
--- a/xfconfd/xfconf-backend-perchannel-xml.c
+++ b/xfconfd/xfconf-backend-perchannel-xml.c
@@ -309,10 +309,7 @@ xfconf_backend_perchannel_xml_set(XfconfBackend *backend,
 #endif
         if(!channel) {
 #ifdef XFCONF_ENABLE_CHECKS
-            if(error && *error) {
-                g_error_free(*error);
-                *error = NULL;
-            }
+            g_clear_error(error);
 #endif
             channel = xfconf_backend_perchannel_xml_create_channel(xbpx,
                                                                    channel_name);
@@ -511,10 +508,7 @@ xfconf_backend_perchannel_xml_exists(XfconfBackend *backend,
 #endif
         if(!channel) {
 #ifdef XFCONF_ENABLE_CHECKS
-            if(error && *error) {
-                g_error_free(*error);
-                *error = NULL;
-            }
+            g_clear_error(error);
 #endif
 
             *exists = FALSE;
diff --git a/xfconfd/xfconf-daemon.c b/xfconfd/xfconf-daemon.c
index ba5ea96..c023f86 100644
--- a/xfconfd/xfconf-daemon.c
+++ b/xfconfd/xfconf-daemon.c
@@ -270,10 +270,8 @@ xfconf_get_property(XfconfDaemon *xfconfd,
     for(l = xfconfd->backends; l; l = l->next) {
         if(xfconf_backend_get(l->data, channel, property, value, error))
             return TRUE;
-        else if(l->next && error && *error) {
-            g_error_free(*error);
-            *error = NULL;
-        }
+        else if(l->next)
+            g_clear_error(error);
     }
     
     return FALSE;
@@ -301,10 +299,8 @@ xfconf_get_all_properties(XfconfDaemon *xfconfd,
                                   *properties, error))
         {
             ret = TRUE;
-        } else if(l->next && error && *error) {
-            g_error_free(*error);
-            *error = NULL;
-        }
+        } else if(l->next)
+            g_clear_error(error);
     }
     
     if(!ret) {
@@ -336,10 +332,8 @@ xfconf_property_exists(XfconfDaemon *xfconfd,
             *exists = exists_tmp;
             if(*exists)
                 return TRUE;
-        } else if(l->next && error && *error) {
-            g_error_free(*error);
-            *error = NULL;
-        }
+        } else if(l->next)
+            g_clear_error(error);
     }
     
     return ret;
@@ -362,10 +356,8 @@ xfconf_reset_property(XfconfDaemon *xfconfd,
     for(l = xfconfd->backends; l; l = l->next) {
         if(xfconf_backend_reset(l->data, channel, property, recursive, error))
             ret = TRUE;
-        else if(l->next && error && *error) {
-            g_error_free(*error);
-            *error = NULL;
-        }
+        else if(l->next)
+            g_clear_error(error);
     }
     
     return ret;
@@ -385,7 +377,7 @@ xfconf_list_channels(XfconfDaemon *xfconfd,
         chans_tmp = NULL;
         if(xfconf_backend_list_channels(l->data, &chans_tmp, error))
             lchannels = g_slist_concat(lchannels, chans_tmp);
-        else if(error)
+        else
             g_clear_error(error);
     }
 
@@ -480,8 +472,7 @@ xfconf_daemon_load_config(XfconfDaemon *xfconfd,
         if(!backend) {
             g_warning("Unable to start backend \"%s\": %s", backend_ids[i],
                       error1->message);
-            g_error_free(error1);
-            error1 = NULL;
+            g_clear_error(&error1);
         } else {
             xfconfd->backends = g_list_prepend(xfconfd->backends, backend);
             xfconf_backend_register_property_changed_func(backend,



More information about the Xfce4-commits mailing list