vte r2167 - in trunk: . src



Author: cpwilson
Date: Fri Nov 21 00:42:39 2008
New Revision: 2167
URL: http://svn.gnome.org/viewvc/vte?rev=2167&view=rev

Log:
2008-11-21  Chris Wilson  <chris chris-wilson co uk>

	* src/iso2022.c (_vte_iso2022_is_ambiguous): Break out of interval
	search as early as possible. Exploit the strict ordering of the 
	ambiguous/unambiguous ranges to break out of the for loop as soon
	as the character is less than a range start. (As the arrays only
	contain 2/3 elements, it is not worth adding the overhead of calling
	bsearch()).



Modified:
   trunk/ChangeLog
   trunk/src/iso2022.c

Modified: trunk/src/iso2022.c
==============================================================================
--- trunk/src/iso2022.c	(original)
+++ trunk/src/iso2022.c	Fri Nov 21 00:42:39 2008
@@ -307,14 +307,18 @@
 {
 	gsize i;
 	for (i = 0; i < G_N_ELEMENTS(_vte_iso2022_unambiguous_ranges); i++) {
-		if ((c >= _vte_iso2022_unambiguous_ranges[i].start) &&
-		    (c <= _vte_iso2022_unambiguous_ranges[i].end)) {
+		if (c < _vte_iso2022_unambiguous_ranges[i].start) {
+			break;
+		}
+		if (c <= _vte_iso2022_unambiguous_ranges[i].end) {
 			return FALSE;
 		}
 	}
 	for (i = 0; i < G_N_ELEMENTS(_vte_iso2022_ambiguous_ranges); i++) {
-		if ((c >= _vte_iso2022_ambiguous_ranges[i].start) &&
-		    (c <= _vte_iso2022_ambiguous_ranges[i].end)) {
+		if (c < _vte_iso2022_ambiguous_ranges[i].start) {
+			break;
+		}
+		if (c <= _vte_iso2022_ambiguous_ranges[i].end) {
 			return TRUE;
 		}
 	}



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