# HG changeset patch # User Kristian H?gsberg # Date 1189695099 14400 # Node ID 8ffc32c648e2971725e37afb5826b79bd0be0b0a # Parent 0837680073509cc26222111416494be13ce98243 Use equality of string pool indices for string equality tests. diff -r 083768007350 -r 8ffc32c648e2 Makefile --- a/Makefile Thu Sep 13 10:44:03 2007 -0400 +++ b/Makefile Thu Sep 13 10:51:39 2007 -0400 @@ -1,4 +1,4 @@ -CFLAGS = -Wall -g +CFLAGS = -Wall -g -O2 LDLIBS = -lexpat -g razor : razor.o sha1.o diff -r 083768007350 -r 8ffc32c648e2 razor.c --- a/razor.c Thu Sep 13 10:44:03 2007 -0400 +++ b/razor.c Thu Sep 13 10:51:39 2007 -0400 @@ -660,7 +660,10 @@ struct razor_set *set = data; char *pool = set->string_pool.data; - return strcmp(&pool[pkg1->name], &pool[pkg2->name]); + if (pkg1->name == pkg2->name) + return 0; + else + return strcmp(&pool[pkg1->name], &pool[pkg2->name]); } static int @@ -669,13 +672,11 @@ const struct import_property *prop1 = p1, *prop2 = p2; struct razor_set *set = data; char *pool = set->string_pool.data; - int result; - result = strcmp(&pool[prop1->name], &pool[prop2->name]); - if (result == 0) + if (prop1->name == prop2->name) return strcmp(&pool[prop1->version], &pool[prop2->version]); else - return result; + return strcmp(&pool[prop1->name], &pool[prop2->name]); } static unsigned long *