[krb5-auth-dialog] Use g_clear_error (&error) instead of g_error_free (error)



commit e3bf7f23494478e5225229ea099edc2f52297c7c
Author: Guido Günther <agx sigxcpu org>
Date:   Sat Jun 5 14:46:26 2010 +0200

    Use g_clear_error (&error) instead of g_error_free (error)
    
    so we don't have to check if error is set.

 preferences/ka-preferences.c |    2 +-
 src/ka-applet.c              |    4 ++--
 src/ka-dialog.c              |    5 ++---
 src/ka-gconf-tools.c         |   10 +++++-----
 src/ka-gconf.c               |    2 +-
 src/ka-tools.c               |    2 +-
 6 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/preferences/ka-preferences.c b/preferences/ka-preferences.c
index f925b7e..e408dac 100644
--- a/preferences/ka-preferences.c
+++ b/preferences/ka-preferences.c
@@ -826,7 +826,7 @@ main (int argc, char *argv[])
       g_print ("%s\n%s\n",
                error->message,
                help_msg);
-     g_error_free (error);
+     g_clear_error (&error);
      return 1;
   }
   textdomain (PACKAGE);
diff --git a/src/ka-applet.c b/src/ka-applet.c
index 472f4f5..a7f8598 100644
--- a/src/ka-applet.c
+++ b/src/ka-applet.c
@@ -620,7 +620,7 @@ ka_applet_cb_preferences (GtkWidget* menuitem G_GNUC_UNUSED,
 				  G_CALLBACK (gtk_widget_destroy),
 				  NULL);
 		gtk_widget_show (message_dialog);
-		g_error_free (error);
+		g_clear_error (&error);
 	  }
 }
 
@@ -661,7 +661,7 @@ ka_about_dialog_url_hook (GtkAboutDialog *about,
 				  G_CALLBACK (gtk_widget_destroy),
 				  NULL);
 		gtk_widget_show (message_dialog);
-		g_error_free (error);
+		g_clear_error (&error);
 	  }
 }
 
diff --git a/src/ka-dialog.c b/src/ka-dialog.c
index e72266b..eafdbaf 100644
--- a/src/ka-dialog.c
+++ b/src/ka-dialog.c
@@ -762,8 +762,7 @@ monitor_ccache(KaApplet *applet)
 	}
 out:
 	g_object_unref (ccache);
-	if (err)
-		g_error_free (err);
+	g_clear_error (&err);
 	return ret;
 }
 
@@ -1138,7 +1137,7 @@ main (int argc, char *argv[])
 		g_print ("%s\n%s\n",
 			 error->message,
 			 help_msg);
-		g_error_free (error);
+		g_clear_error (&error);
 		return 1;
 	}
 	g_option_context_free (context);
diff --git a/src/ka-gconf-tools.c b/src/ka-gconf-tools.c
index 60fd567..39cc50d 100644
--- a/src/ka-gconf-tools.c
+++ b/src/ka-gconf-tools.c
@@ -41,7 +41,7 @@ ka_gconf_get_string (GConfClient* client,
 			success = TRUE;
 		} else if (error) {
 				g_print ("%s", error->message);
-				g_error_free (error);
+				g_clear_error (&error);
 		}
 		gconf_value_free (gc_value);
 	}
@@ -65,7 +65,7 @@ ka_gconf_get_string_list (GConfClient* client,
 	                                   GCONF_VALUE_STRING, &error))) {
 		if (error) {
 			g_print ("%s", error->message);
-			g_error_free (error);
+			g_clear_error (&error);
 		} else
 			success = TRUE;
 	}
@@ -93,7 +93,7 @@ ka_gconf_get_int (GConfClient* client,
 			success = TRUE;
 		} else if (error) {
 				g_print ("%s", error->message);
-				g_error_free (error);
+				g_clear_error (&error);
 		}
 		gconf_value_free (gc_value);
 	}
@@ -120,7 +120,7 @@ ka_gconf_get_bool (GConfClient* client,
 			success = TRUE;
 		} else if (error) {
 				g_print ("%s", error->message);
-				g_error_free (error);
+				g_clear_error (&error);
 		}
 		gconf_value_free (gc_value);
 	}
@@ -141,7 +141,7 @@ ka_gconf_set_bool (GConfClient* client,
 	if(!gconf_client_set_bool (client, key, value, &error)) {
 		if (error) {
 			g_print ("%s", error->message);
-			g_error_free (error);
+			g_clear_error (&error);
 		}
 		return FALSE;
 	}
diff --git a/src/ka-gconf.c b/src/ka-gconf.c
index 10ef703..282e0b5 100644
--- a/src/ka-gconf.c
+++ b/src/ka-gconf.c
@@ -205,7 +205,7 @@ out:
 	if(error) {
 		client = NULL;
 		g_print ("%s", error->message);
-		g_error_free (error);
+		g_clear_error (&error);
 	}
 	return client;
 }
diff --git a/src/ka-tools.c b/src/ka-tools.c
index 177e64e..260d101 100644
--- a/src/ka-tools.c
+++ b/src/ka-tools.c
@@ -51,7 +51,7 @@ ka_show_help (GdkScreen* screen, const char* chapter, GtkWindow* window)
                   NULL);
 
       gtk_widget_show (message_dialog);
-      g_error_free (error);
+      g_clear_error (&error);
   }
   g_free (url);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]