Use equality of string pool indices for string equality tests.
authorKristian H?gsberg <krh@redhat.com>
Thu Sep 13 10:51:39 2007 -0400 (2007-09-13)
changeset 238ffc32c648e2
parent 22 083768007350
child 24 5963746558e7
Use equality of string pool indices for string equality tests.
Makefile
razor.c
     1.1 --- a/Makefile	Thu Sep 13 10:44:03 2007 -0400
     1.2 +++ b/Makefile	Thu Sep 13 10:51:39 2007 -0400
     1.3 @@ -1,4 +1,4 @@
     1.4 -CFLAGS = -Wall -g
     1.5 +CFLAGS = -Wall -g -O2
     1.6  LDLIBS = -lexpat -g
     1.7  
     1.8  razor : razor.o sha1.o
     2.1 --- a/razor.c	Thu Sep 13 10:44:03 2007 -0400
     2.2 +++ b/razor.c	Thu Sep 13 10:51:39 2007 -0400
     2.3 @@ -660,7 +660,10 @@
     2.4  	struct razor_set *set = data;
     2.5  	char *pool = set->string_pool.data;
     2.6  
     2.7 -	return strcmp(&pool[pkg1->name], &pool[pkg2->name]);
     2.8 +	if (pkg1->name == pkg2->name)
     2.9 +		return 0;
    2.10 +	else
    2.11 +		return strcmp(&pool[pkg1->name], &pool[pkg2->name]);
    2.12  }
    2.13  
    2.14  static int
    2.15 @@ -669,13 +672,11 @@
    2.16  	const struct import_property *prop1 = p1, *prop2 = p2;
    2.17  	struct razor_set *set = data;
    2.18  	char *pool = set->string_pool.data;
    2.19 -	int result;
    2.20  
    2.21 -	result = strcmp(&pool[prop1->name], &pool[prop2->name]);
    2.22 -	if (result == 0)
    2.23 +	if (prop1->name == prop2->name)
    2.24  		return strcmp(&pool[prop1->version], &pool[prop2->version]);
    2.25  	else
    2.26 -		return result;
    2.27 +		return strcmp(&pool[prop1->name], &pool[prop2->name]);
    2.28  }
    2.29  
    2.30  static unsigned long *