diff --git a/src/node.c b/src/node.c index a48dd67..79cd952 100644 --- a/src/node.c +++ b/src/node.c @@ -226,13 +226,13 @@ node * r3_tree_match(node * n, char * path, int path_len, match_entry * entry) { // info("try matching: %s\n", path); edge *e; + int rc; + int i; // if the pcre_pattern is found, and the pointer is not NULL, then it's // pcre pattern node, we use pcre_exec to match the nodes if (n->pcre_pattern) { info("pcre matching %s on %s\n", n->combined_pattern, path); - int rc; - int i; rc = pcre_exec( n->pcre_pattern, /* the compiled pattern */ @@ -286,14 +286,12 @@ node * r3_tree_match(node * n, char * path, int path_len, match_entry * entry) { return NULL; } - e = r3_node_find_edge_str(n, path, path_len); - if (e) { + if ( (e = r3_node_find_edge_str(n, path, path_len)) != NULL ) { int restlen = path_len - e->pattern_len; - if(restlen) { + if(restlen > 0) { return r3_tree_match(e->child, path + e->pattern_len, restlen, entry); - } else { - return e->child; } + return e->child; } return NULL; } diff --git a/tests/bench_str.csv b/tests/bench_str.csv index 9f447a8..a2821fe 100644 --- a/tests/bench_str.csv +++ b/tests/bench_str.csv @@ -33,3 +33,13 @@ 1400244914,6346830.19 1400244932,6610181.08 1400245102,6404550.11 +1400245168,6085174.66 +1400245176,6400679.76 +1400245216,6416409.15 +1400245227,6485899.37 +1400245230,5862573.02 +1400245233,6526163.60 +1400245281,6205337.09 +1400245289,6217947.43 +1400245304,5527542.93 +1400245311,6423151.81