Fix "cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]"

for C11 compatibility (gcc 5.4)
This commit is contained in:
Marek Otahal 2016-10-24 15:55:13 +02:00
parent 295d20442a
commit e3bf4d5c39

6
slre.c
View File

@ -171,7 +171,7 @@ static int match_set(const char *re, int re_len, const char *s,
*s >= re[len] && *s <= re[len + 2];
len += 3;
} else {
result = match_op((unsigned char *) re + len, (unsigned char *) s, info);
result = match_op((const unsigned char *) re + len, (const unsigned char *) s, info);
len += op_len(re + len);
}
}
@ -290,7 +290,7 @@ static int bar(const char *re, int re_len, const char *s, int s_len,
FAIL_IF(j != s_len, SLRE_NO_MATCH);
} else {
FAIL_IF(j >= s_len, SLRE_NO_MATCH);
n = match_op((unsigned char *) (re + i), (unsigned char *) (s + j), info);
n = match_op((const unsigned char *) (re + i), (const unsigned char *) (s + j), info);
FAIL_IF(n <= 0, n);
j += n;
}
@ -392,7 +392,7 @@ static int foo(const char *re, int re_len, const char *s, int s_len,
FAIL_IF(re[i + 1] == 'x' && !(isxdigit(re[i + 2]) &&
isxdigit(re[i + 3])), SLRE_INVALID_METACHARACTER);
} else {
FAIL_IF(!is_metacharacter((unsigned char *) re + i + 1),
FAIL_IF(!is_metacharacter((const unsigned char *) re + i + 1),
SLRE_INVALID_METACHARACTER);
}
} else if (re[i] == '(') {