gtkicontheme: Avoid a get_icon_flags call
authorTimm Bäder <mail@baedert.org>
Tue, 21 May 2019 09:07:23 +0000 (11:07 +0200)
committerTimm Bäder <mail@baedert.org>
Mon, 9 Sep 2019 15:36:26 +0000 (17:36 +0200)
We're only using the value of the first call at all if
symbolic_suffix & ICON_SUFFIX_PNG is FALSE.

gtk/gtkicontheme.c

index 1cb73635e0ae15d7f1cbdae0a11bfba166326ddb..7aac0b8b3e6be9195be178dfc36ce3eb056ab5c9 100644 (file)
@@ -2798,10 +2798,6 @@ theme_dir_get_icon_suffix (IconThemeDir *dir,
 
   if (dir->cache)
     {
-      suffix = (IconSuffix)gtk_icon_cache_get_icon_flags (dir->cache,
-                                                           icon_name,
-                                                           dir->subdir_index);
-
       if (icon_name_is_symbolic (icon_name))
         {
           /* Look for foo-symbolic.symbolic.png, as the cache only stores the ".png" suffix */
@@ -2813,7 +2809,15 @@ theme_dir_get_icon_suffix (IconThemeDir *dir,
 
           if (symbolic_suffix & ICON_SUFFIX_PNG)
             suffix = ICON_SUFFIX_SYMBOLIC_PNG;
+          else
+            suffix = (IconSuffix)gtk_icon_cache_get_icon_flags (dir->cache,
+                                                                icon_name,
+                                                                dir->subdir_index);
         }
+      else
+        suffix = (IconSuffix)gtk_icon_cache_get_icon_flags (dir->cache,
+                                                            icon_name,
+                                                            dir->subdir_index);
 
       if (has_icon_file)
         *has_icon_file = suffix & HAS_ICON_FILE;