icon theme: Avoid a string copy
authorMatthias Clasen <mclasen@redhat.com>
Thu, 17 Oct 2019 12:56:27 +0000 (07:56 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 18 Oct 2019 13:53:23 +0000 (08:53 -0500)
This is in an error path, so mostly cosmetic.

gtk/gtkicontheme.c

index ee7f7c49bb779b9078329be4fe460dc7b3565ea3..cbb462c0298b5bc63d276b384884a67fdcc5a49a 100644 (file)
@@ -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;
         }