[gtk/im-context-work: 1/4] imcontext: Code cleanup




commit bf8b974f6806ffde86542e1a8342d2633d56271b
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Feb 1 12:08:38 2021 -0500

    imcontext: Code cleanup
    
    Use g_clear_pointer instead of opencoding it in
    multiple places.

 gtk/gtkimcontextsimple.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 76afa8c1ee..093145c307 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -174,8 +174,7 @@ gtk_im_context_simple_init_compose_table (void)
       g_free (path);
       return;
     }
-  g_free (path);
-  path = NULL;
+  g_clear_pointer (&path, g_free);
 
   home = g_get_home_dir ();
   if (home == NULL)
@@ -190,8 +189,7 @@ gtk_im_context_simple_init_compose_table (void)
       g_free (path);
       return;
     }
-  g_free (path);
-  path = NULL;
+  g_clear_pointer (&path, g_free);
 
   locale = g_getenv ("LC_CTYPE");
   if (locale == NULL)
@@ -224,8 +222,7 @@ gtk_im_context_simple_init_compose_table (void)
 
       if (g_file_test (path, G_FILE_TEST_EXISTS))
         break;
-      g_free (path);
-      path = NULL;
+      g_clear_pointer (&path, g_free);
     }
 
   g_free (x11_compose_file_dir);
@@ -237,8 +234,7 @@ gtk_im_context_simple_init_compose_table (void)
       global_tables = gtk_compose_table_list_add_file (global_tables, path);
       G_UNLOCK (global_tables);
     }
-  g_free (path);
-  path = NULL;
+  g_clear_pointer (&path, g_free);
 }
 
 static void


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