1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

dom_node_cmp(): Minor optimization

This commit is contained in:
Jonas Fonseca 2005-09-27 14:39:40 +02:00 committed by Jonas Fonseca
parent d8bc3f7b15
commit 50f4b46616

View File

@ -134,12 +134,11 @@ dom_node_cmp(struct dom_node_search *search, struct dom_node *node)
{
int length = int_min(key->length, node->length);
int string_diff = strncasecmp(key->string, node->string, length);
int length_diff = key->length - node->length;
/* If the lengths or strings don't match strncasecmp() does the
* job else return which ever is bigger. */
return string_diff ? string_diff : length_diff;
return string_diff ? string_diff : key->length - node->length;
}
}