match_entry_createl

This commit is contained in:
c9s 2014-05-17 23:54:18 +08:00
parent 639dd1e0e6
commit 9bab1bd076
4 changed files with 17 additions and 12 deletions

View file

@ -125,7 +125,9 @@ void r3_edge_free(edge * edge);
match_entry * match_entry_create(char * path, int path_len);
match_entry * match_entry_createl(char * path, int path_len);
#define match_entry_create(path) match_entry_createl(path,strlen(path))
void match_entry_free(match_entry * entry);

View file

@ -212,7 +212,7 @@ route_info * route_info_createl(char * path, int path_len) {
return info;
}
match_entry * match_entry_create(char * path, int path_len) {
match_entry * match_entry_createl(char * path, int path_len) {
match_entry * entry = malloc(sizeof(match_entry));
if(!entry)
return NULL;

View file

@ -57,3 +57,5 @@
1400283485,10742869.09
1400283755,11545078.70
1400284307,11493777.72
1400336360,10249674.13
1400342049,10376709.43

1 1400242718 5649455.80
57 1400283485 10742869.09
58 1400283755 11545078.70
59 1400284307 11493777.72
60 1400336360 10249674.13
61 1400342049 10376709.43

View file

@ -88,27 +88,27 @@ START_TEST (test_compile)
match_entry * entry;
entry = match_entry_create( "foo" , strlen("/foo") );
entry = match_entry_createl( "foo" , strlen("/foo") );
m = r3_tree_match( n , "/foo", strlen("/foo"), entry);
fail_if( NULL == m );
entry = match_entry_create( "/zoo" , strlen("/zoo") );
entry = match_entry_createl( "/zoo" , strlen("/zoo") );
m = r3_tree_match( n , "/zoo", strlen("/zoo"), entry);
fail_if( NULL == m );
entry = match_entry_create( "/bar" , strlen("/bar") );
entry = match_entry_createl( "/bar" , strlen("/bar") );
m = r3_tree_match( n , "/bar", strlen("/bar"), entry);
fail_if( NULL == m );
entry = match_entry_create( "/xxx" , strlen("/xxx") );
entry = match_entry_createl( "/xxx" , strlen("/xxx") );
m = r3_tree_match( n , "/xxx", strlen("/xxx"), entry);
fail_if( NULL == m );
entry = match_entry_create( "/foo/xxx" , strlen("/foo/xxx") );
entry = match_entry_createl( "/foo/xxx" , strlen("/foo/xxx") );
m = r3_tree_match( n , "/foo/xxx", strlen("/foo/xxx"), entry);
fail_if( NULL == m );
entry = match_entry_create( "/some_id" , strlen("/some_id") );
entry = match_entry_createl( "/some_id" , strlen("/some_id") );
m = r3_tree_match( n , "/some_id", strlen("/some_id"), entry);
fail_if( NULL == m );
ck_assert_int_gt( m->endpoint , 0 ); // should not be an endpoint
@ -260,13 +260,14 @@ END_TEST
START_TEST(test_insert_route)
{
match_entry * entry = match_entry_create();
match_entry * entry = match_entry_createl("/blog/post", strlen("/blog/post") );
match_entry * entry2 = match_entry_create("/blog/post");
node * tree = r3_tree_create(2);
route_info *info = route_info_create("/blog/post", strlen("/blog/post") );
// route_info *info = route_info_create("/blog/post", strlen("/blog/post") );
// r3_tree_insert_route(n, "/foo/bar/baz", NULL);
@ -275,7 +276,7 @@ END_TEST
START_TEST(benchmark_str)
{
match_entry * entry = match_entry_create();
match_entry * entry = match_entry_createl("/blog/post", strlen("/blog/post") );
node * n = r3_tree_create(1);