[gimp] remove unnecessary if()



commit a10269014521590defaf2c8deb64fb3565967b00
Author: Simon Budig <simon budig de>
Date:   Sat Aug 16 00:26:58 2014 +0200

    remove unnecessary if()
    
    Spotted by Andrey Karpov using static code analysis:
       http://www.viva64.com/en/b/0273/

 app/text/gimpfont.c |   47 +++++++++++++++++++++++------------------------
 1 files changed, 23 insertions(+), 24 deletions(-)
---
diff --git a/app/text/gimpfont.c b/app/text/gimpfont.c
index 1f167a0..3f61123 100644
--- a/app/text/gimpfont.c
+++ b/app/text/gimpfont.c
@@ -682,38 +682,37 @@ gimp_font_get_sample_string (PangoContext         *context,
       hb_ot_layout_table_get_script_tags (hb_face, tag, 0, &count, slist);
       slist[count] = 0;
 
-      if (slist)
+      for (i = 0;
+           n_ot_alts < G_N_ELEMENTS (ot_alts) && i < G_N_ELEMENTS (scripts);
+           i++)
         {
-          for (i = 0;
-               n_ot_alts < G_N_ELEMENTS (ot_alts) && i < G_N_ELEMENTS (scripts);
-               i++)
-            {
-              gint j, k;
+          gint j, k;
 
-              for (k = 0; k < n_ot_alts; k++)
-                if (ot_alts[k] == i)
-                  break;
+          for (k = 0; k < n_ot_alts; k++)
+            if (ot_alts[k] == i)
+              break;
 
-              if (k == n_ot_alts)
-                for (j = 0;
-                     n_ot_alts < G_N_ELEMENTS (ot_alts) && slist[j];
-                     j++)
-                  {
+          if (k == n_ot_alts)
+            {
+              for (j = 0;
+                   n_ot_alts < G_N_ELEMENTS (ot_alts) && slist[j];
+                   j++)
+                {
 #define TAG(s) FT_MAKE_TAG (s[0], s[1], s[2], s[3])
 
-                    if (slist[j] == TAG (scripts[i].script) &&
-                        gimp_font_covers_string (PANGO_FC_FONT (font),
-                                                 scripts[i].sample))
-                      {
-                        ot_alts[n_ot_alts++] = i;
-                        DEBUGPRINT (("%.4s ", scripts[i].script));
-                      }
+                  if (slist[j] == TAG (scripts[i].script) &&
+                      gimp_font_covers_string (PANGO_FC_FONT (font),
+                                               scripts[i].sample))
+                    {
+                      ot_alts[n_ot_alts++] = i;
+                      DEBUGPRINT (("%.4s ", scripts[i].script));
+                    }
 #undef TAG
-                  }
+                }
             }
-
-          g_free (slist);
         }
+
+      g_free (slist);
     }
 
   hb_face_destroy (hb_face);


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