Skip to content

Commit

Permalink
const to node * n
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed May 20, 2014
1 parent 0d2ae75 commit 0064eb2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions include/r3.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ int r3_tree_render_file(node * tree, char * format, char * filename);

int r3_tree_render_dot(node * tree);

edge * r3_node_find_edge_str(node * n, char * str, int str_len);
edge * r3_node_find_edge_str(const node * n, char * str, int str_len);


void r3_tree_compile(node *n);

void r3_tree_compile_patterns(node * n);

node * r3_tree_matchl(node * n, char * path, int path_len, match_entry * entry);
node * r3_tree_matchl(const node * n, char * path, int path_len, match_entry * entry);

#define r3_tree_match(n,p,e) r3_tree_matchl(n,p, strlen(p), e)

Expand Down Expand Up @@ -165,7 +165,7 @@ void r3_node_append_route(node * n, route * route);

void r3_route_free(route * route);

route * r3_tree_match_route(node *n, match_entry * entry);
route * r3_tree_match_route(const node *n, match_entry * entry);

#define METHOD_GET 2
#define METHOD_POST 2<<1
Expand Down
6 changes: 3 additions & 3 deletions src/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void match_entry_free(match_entry * entry) {
* @param int path_len the length of the URL path.
* @param match_entry* entry match_entry is used for saving the captured dynamic strings from pcre result.
*/
node * r3_tree_matchl(node * n, char * path, int path_len, match_entry * entry) {
node * r3_tree_matchl(const node * n, char * path, int path_len, match_entry * entry) {
info("try matching: %s\n", path);

edge *e;
Expand Down Expand Up @@ -328,7 +328,7 @@ node * r3_tree_matchl(node * n, char * path, int path_len, match_entry * entry)
return NULL;
}

route * r3_tree_match_route(node *tree, match_entry * entry) {
route * r3_tree_match_route(const node *tree, match_entry * entry) {
node *n;
n = r3_tree_match_entry(tree, entry);
if (n->routes && n->route_len > 0) {
Expand All @@ -342,7 +342,7 @@ route * r3_tree_match_route(node *tree, match_entry * entry) {
return NULL;
}

inline edge * r3_node_find_edge_str(node * n, char * str, int str_len) {
inline edge * r3_node_find_edge_str(const node * n, char * str, int str_len) {
int i = 0;
int matched_idx = 0;
char firstbyte = *str;
Expand Down
4 changes: 4 additions & 0 deletions tests/bench_str.csv
Original file line number Diff line number Diff line change
Expand Up @@ -428,3 +428,7 @@
1400606406,13923000.83
1400606409,13742645.62
1400606411,13878225.03
1400606451,13922301.44
1400606491,14030387.83
1400606523,13157029.51
1400606567,13999364.95

0 comments on commit 0064eb2

Please sign in to comment.