Add more const

This commit is contained in:
c9s 2014-06-03 22:15:59 +08:00
parent da87115761
commit 2aa3509845
3 changed files with 8 additions and 6 deletions

View file

@ -28,6 +28,7 @@ static int strndiff(char * d1, char * d2, unsigned int n) {
return d1 - o;
}
/*
static int strdiff(char * d1, char * d2) {
char * o = d1;
while( *d1 == *d2 ) {
@ -36,6 +37,7 @@ static int strdiff(char * d1, char * d2) {
}
return d1 - o;
}
*/
/**
@ -530,7 +532,7 @@ edge * r3_node_find_common_prefix(node *n, const char *path, int path_len, int *
} else if ( p < slug->begin ) {
break;
} else if ( p >= slug->end && p < (path + path_len) ) {
offset = slug->end + 1;
offset = (char*) slug->end + 1;
prefix = p - path;
continue;
} else {

View file

@ -91,7 +91,7 @@ int r3_slug_parse(r3_slug_t *s, const char *needle, int needle_len, char *offset
int cnt = 0;
int state = 0;
char * p = offset;
const char * p = offset;
while( (p-needle) < needle_len) {
// escape one character

View file

@ -11,19 +11,19 @@ typedef struct {
/**
* source path
*/
char * path;
const char * path;
int path_len;
/**
* slug start pointer
*/
char * begin;
const char * begin;
/**
* slug end pointer
*/
char * end;
const char * end;
/**
* slug length
@ -31,7 +31,7 @@ typedef struct {
int len;
// slug pattern pointer if we have one
char * pattern;
const char * pattern;
// the length of custom pattern, if the pattern is found.
int pattern_len;