[pango/misc-speedups: 6/8] Speed up ignorable check




commit 8836379795363855ae552dd031f11e1a8f3137c4
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Mar 29 00:11:51 2021 -0400

    Speed up ignorable check
    
    No need to walk to the end if we are done.

 pango/pango-impl-utils.h | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/pango/pango-impl-utils.h b/pango/pango-impl-utils.h
index d2420321..bbeca994 100644
--- a/pango/pango-impl-utils.h
+++ b/pango/pango-impl-utils.h
@@ -163,6 +163,9 @@ pango_get_ignorable (gunichar ch)
 
   for (i = 0; i < G_N_ELEMENTS (ignorables); i++)
     {
+      if (ch < ignorables[i].ch)
+        return NULL;
+
       if (ch == ignorables[i].ch)
         return ignorables[i].nick;
     }


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