more const

This commit is contained in:
c9s 2014-06-01 02:54:48 +08:00
parent 8f8dbd520b
commit bc27293f36
3 changed files with 5 additions and 5 deletions

View file

@ -14,13 +14,13 @@ int slug_count(const char * p, int len);
char * slug_compile(char * str, int len); char * slug_compile(char * str, int len);
bool contains_slug(char * str); bool contains_slug(const char * str);
char * slug_find_pattern(char *s1, int *len); char * slug_find_pattern(char *s1, int *len);
char * slug_find_placeholder(char *s1, int *len); char * slug_find_placeholder(char *s1, int *len);
char * inside_slug(char * needle, int needle_len, char *offset); char * inside_slug(const char * needle, int needle_len, char *offset);
char * ltrim_slash(char* str); char * ltrim_slash(char* str);

View file

@ -480,7 +480,7 @@ node * r3_tree_insert_pathl_(node *tree, char *path, int path_len, route * route
/* length of common prefix */ /* length of common prefix */
int prefix_len = 0; int prefix_len = 0;
for( int i = 0 ; i < n->edge_len ; i++ ) { for( int i = 0 ; i < n->edge_len ; i++ ) {
prefix_len = strndiff( path, n->edges[i]->pattern, n->edges[i]->pattern_len); prefix_len = strndiff( (char*) path, n->edges[i]->pattern, n->edges[i]->pattern_len);
// printf("prefix_len: %d %s vs %s\n", prefix_len, path, n->edges[i]->pattern ); // printf("prefix_len: %d %s vs %s\n", prefix_len, path, n->edges[i]->pattern );

View file

@ -59,11 +59,11 @@ int slug_count(const char * p, int len) {
return s; return s;
} }
bool contains_slug(char * str) { bool contains_slug(const char * str) {
return strchr(str, '{') != NULL ? TRUE : FALSE; return strchr(str, '{') != NULL ? TRUE : FALSE;
} }
char * inside_slug(char * needle, int needle_len, char *offset) { char * inside_slug(const char * needle, int needle_len, char *offset) {
char * s1 = offset; char * s1 = offset;
char * s2 = offset; char * s2 = offset;