const to node * n

This commit is contained in:
c9s 2014-05-21 01:22:49 +08:00
parent 0d2ae75bc2
commit 0064eb27a1
3 changed files with 10 additions and 6 deletions

View file

@ -124,14 +124,14 @@ int r3_tree_render_file(node * tree, char * format, char * filename);
int r3_tree_render_dot(node * tree); 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(node *n);
void r3_tree_compile_patterns(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) #define r3_tree_match(n,p,e) r3_tree_matchl(n,p, strlen(p), e)
@ -165,7 +165,7 @@ void r3_node_append_route(node * n, route * route);
void r3_route_free(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_GET 2
#define METHOD_POST 2<<1 #define METHOD_POST 2<<1

View file

@ -252,7 +252,7 @@ void match_entry_free(match_entry * entry) {
* @param int path_len the length of the URL path. * @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. * @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); info("try matching: %s\n", path);
edge *e; edge *e;
@ -328,7 +328,7 @@ node * r3_tree_matchl(node * n, char * path, int path_len, match_entry * entry)
return NULL; 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; node *n;
n = r3_tree_match_entry(tree, entry); n = r3_tree_match_entry(tree, entry);
if (n->routes && n->route_len > 0) { if (n->routes && n->route_len > 0) {
@ -342,7 +342,7 @@ route * r3_tree_match_route(node *tree, match_entry * entry) {
return NULL; 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 i = 0;
int matched_idx = 0; int matched_idx = 0;
char firstbyte = *str; char firstbyte = *str;

View file

@ -428,3 +428,7 @@
1400606406,13923000.83 1400606406,13923000.83
1400606409,13742645.62 1400606409,13742645.62
1400606411,13878225.03 1400606411,13878225.03
1400606451,13922301.44
1400606491,14030387.83
1400606523,13157029.51
1400606567,13999364.95

1 1400242718 5649455.80
428 1400606406 13923000.83
429 1400606409 13742645.62
430 1400606411 13878225.03
431 1400606451 13922301.44
432 1400606491 14030387.83
433 1400606523 13157029.51
434 1400606567 13999364.95