use while instead of for loop to simplify execution

This commit is contained in:
c9s 2014-06-04 19:52:33 +08:00
parent c5ed7e202c
commit 190986fb31

View file

@ -411,9 +411,9 @@ route * r3_tree_match_route(const node *tree, match_entry * entry) {
}
inline edge * r3_node_find_edge_str(const node * n, const char * str, int str_len) {
unsigned short i = 0;
char firstbyte = *str;
for (; i < n->edge_len ; i++ ) {
unsigned int i = n->edge_len;
while (i--) {
if ( firstbyte == *(n->edges[i]->pattern) ) {
info("matching '%s' with '%s'\n", str, node_edge_pattern(n,i) );
if ( strncmp( node_edge_pattern(n,i), str, node_edge_pattern_len(n,i) ) == 0 ) {