From bc27293f36185b927dcd01714a939f2f394210ef Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 1 Jun 2014 02:54:48 +0800 Subject: [PATCH] more const --- include/r3_str.h | 4 ++-- src/node.c | 2 +- src/str.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/r3_str.h b/include/r3_str.h index 2a4d5a5..371451c 100644 --- a/include/r3_str.h +++ b/include/r3_str.h @@ -14,13 +14,13 @@ int slug_count(const char * p, 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_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); diff --git a/src/node.c b/src/node.c index 297251b..e3cf031 100644 --- a/src/node.c +++ b/src/node.c @@ -480,7 +480,7 @@ node * r3_tree_insert_pathl_(node *tree, char *path, int path_len, route * route /* length of common prefix */ int prefix_len = 0; 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 ); diff --git a/src/str.c b/src/str.c index ffc3fe7..bcd6540 100644 --- a/src/str.c +++ b/src/str.c @@ -59,11 +59,11 @@ int slug_count(const char * p, int len) { return s; } -bool contains_slug(char * str) { +bool contains_slug(const char * str) { 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 * s2 = offset;