Add more const
This commit is contained in:
parent
da87115761
commit
2aa3509845
3 changed files with 8 additions and 6 deletions
|
@ -28,6 +28,7 @@ static int strndiff(char * d1, char * d2, unsigned int n) {
|
||||||
return d1 - o;
|
return d1 - o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
static int strdiff(char * d1, char * d2) {
|
static int strdiff(char * d1, char * d2) {
|
||||||
char * o = d1;
|
char * o = d1;
|
||||||
while( *d1 == *d2 ) {
|
while( *d1 == *d2 ) {
|
||||||
|
@ -36,6 +37,7 @@ static int strdiff(char * d1, char * d2) {
|
||||||
}
|
}
|
||||||
return d1 - o;
|
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 ) {
|
} else if ( p < slug->begin ) {
|
||||||
break;
|
break;
|
||||||
} else if ( p >= slug->end && p < (path + path_len) ) {
|
} else if ( p >= slug->end && p < (path + path_len) ) {
|
||||||
offset = slug->end + 1;
|
offset = (char*) slug->end + 1;
|
||||||
prefix = p - path;
|
prefix = p - path;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -91,7 +91,7 @@ int r3_slug_parse(r3_slug_t *s, const char *needle, int needle_len, char *offset
|
||||||
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
char * p = offset;
|
const char * p = offset;
|
||||||
|
|
||||||
while( (p-needle) < needle_len) {
|
while( (p-needle) < needle_len) {
|
||||||
// escape one character
|
// escape one character
|
||||||
|
|
|
@ -11,19 +11,19 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* source path
|
* source path
|
||||||
*/
|
*/
|
||||||
char * path;
|
const char * path;
|
||||||
|
|
||||||
int path_len;
|
int path_len;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* slug start pointer
|
* slug start pointer
|
||||||
*/
|
*/
|
||||||
char * begin;
|
const char * begin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* slug end pointer
|
* slug end pointer
|
||||||
*/
|
*/
|
||||||
char * end;
|
const char * end;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* slug length
|
* slug length
|
||||||
|
@ -31,7 +31,7 @@ typedef struct {
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
// slug pattern pointer if we have one
|
// slug pattern pointer if we have one
|
||||||
char * pattern;
|
const char * pattern;
|
||||||
|
|
||||||
// the length of custom pattern, if the pattern is found.
|
// the length of custom pattern, if the pattern is found.
|
||||||
int pattern_len;
|
int pattern_len;
|
||||||
|
|
Loading…
Reference in a new issue