xserver: Branch 'master'

James Cloos cloos at kemper.freedesktop.org
Wed Jul 23 10:18:41 PDT 2008


 os/oscolor.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit ab6557fcd4bb4fd580bb1727dc8764f7dfb2cb30
Author: James Cloos <cloos at jhcloos.com>
Date:   Wed Jul 23 13:17:33 2008 -0400

    Optimize commit 331cc3f0799a54910a99484264f76569beeee55a
    
    Reorder to minimize comparisons

diff --git a/os/oscolor.c b/os/oscolor.c
index 69eadc2..7f6b938 100644
--- a/os/oscolor.c
+++ b/os/oscolor.c
@@ -1590,19 +1590,17 @@ OsLookupColor(int		screen,
 	mid = (low + high) / 2;
 	c = &BuiltinColors[mid];
 	r = strncasecmp (&BuiltinColorNames[c->name], name, len);
-	if (r == 0 && strlen (&BuiltinColorNames[c->name]) > len)
-	    r++;
-	if (r == 0)
+	if (r == 0 && len == strlen (&BuiltinColorNames[c->name]))
 	{
 	    *pred = c->red * 0x101;
 	    *pgreen = c->green * 0x101;
 	    *pblue = c->blue * 0x101;
 	    return TRUE;
 	}
-	if (r > 0)
-	    high = mid - 1;
-	else
+	if (r < 0)
 	    low = mid + 1;
+	else
+	    high = mid - 1;
     }
     return FALSE;
 }


More information about the xorg-commit mailing list