[glib] glocalfileinfo: Use g_strcmp0() for some comparisons which might be NULL



commit 0a10f7375f7e6ff80fea8eec83d8faf36da1b4bc
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Oct 5 13:31:10 2017 +0100

    glocalfileinfo: Use g_strcmp0() for some comparisons which might be NULL
    
    The return value from g_get_user_special_dir() might be NULL. Safest to
    use g_strcmp0() uniformly everywhere.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=661442

 gio/glocalfileinfo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index 1c97eef..a46a842 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -1618,12 +1618,12 @@ get_icon_name (const char *path,
   const char *name = NULL;
   gboolean with_fallbacks = TRUE;
 
-  if (strcmp (path, g_get_home_dir ()) == 0)
+  if (g_strcmp0 (path, g_get_home_dir ()) == 0)
     {
       name = use_symbolic ? "user-home-symbolic" : "user-home";
       with_fallbacks = FALSE;
     }
-  else if (strcmp (path, g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) == 0)
+  else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) == 0)
     {
       name = use_symbolic ? "user-desktop-symbolic" : "user-desktop";
       with_fallbacks = FALSE;


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