[gimp] app: Use g_clear_object() in main.c



commit bba495999da50ec3612effd9372ce9da47aeb8f7
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Fri Dec 17 09:49:05 2021 +0100

    app: Use g_clear_object() in main.c
    
    Also no need to do a null-check if you're doing g_free(), it can handle
    that already.

 app/main.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/app/main.c b/app/main.c
index ff8d684f72..65d719c786 100644
--- a/app/main.c
+++ b/app/main.c
@@ -483,11 +483,8 @@ gimp_early_configuration (void)
 
   g_object_unref (earlyrc);
 
-  if (system_gimprc_file)
-    g_object_unref (system_gimprc_file);
-
-  if (user_gimprc_file)
-    g_object_unref (user_gimprc_file);
+  g_clear_object (&system_gimprc_file);
+  g_clear_object (&user_gimprc_file);
 }
 
 static gboolean
@@ -785,14 +782,10 @@ main (int    argc,
            pdb_compat_mode,
            backtrace_file);
 
-  if (backtrace_file)
-    g_free (backtrace_file);
-
-  if (system_gimprc_file)
-    g_object_unref (system_gimprc_file);
+  g_free (backtrace_file);
 
-  if (user_gimprc_file)
-    g_object_unref (user_gimprc_file);
+  g_clear_object (&system_gimprc_file);
+  g_clear_object (&user_gimprc_file);
 
   g_strfreev (argv);
 


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