[gtk/wip/matthiasc/icon-theme: 1/12] icon theme: Avoid a string copy



commit 233d096261f0ed133ff9918b8e63982d7f14a1da
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Oct 17 07:56:27 2019 -0500

    icon theme: Avoid a string copy
    
    This is in an error path, so mostly cosmetic.

 gtk/gtkicontheme.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index ee7f7c49bb..cbb462c029 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -3454,19 +3454,18 @@ icon_info_ensure_scale_and_texture (GtkIconInfo *icon_info)
 
       if (warn_about_load_failure)
         {
-          gchar *path;
+          const char *path;
 
-          if (icon_info->is_resource)
-            path = g_strdup (icon_info->filename);
+          if (icon_info->filename)
+            path = icon_info->filename;
           else if (G_IS_FILE (icon_info->loadable))
-            path = g_file_get_path (G_FILE (icon_info->loadable));
+            path = g_file_peek_path (G_FILE (icon_info->loadable));
           else
-            path = g_strdup ("icon theme");
+            path = "icon theme";
 
           g_warning ("Could not load a pixbuf from %s.\n"
                      "This may indicate that pixbuf loaders or the mime database could not be found.",
                      path);
-          g_free (path);
 
           warn_about_load_failure = FALSE;
         }


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