Adding -Wcast-qual revealed some more interesting casts.

This commit is contained in:
Joachim Nilsson 2010-07-24 02:39:45 +02:00
parent 522e534448
commit 5a8ad742d9
4 changed files with 11 additions and 11 deletions

2
configure vendored
View File

@ -11274,7 +11274,7 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$saved_cflags"
AM_CFLAGS="-std=gnu99 $inline_cflags -W -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
AM_CFLAGS="-std=gnu99 $inline_cflags -W -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow -Wcast-qual"
### The following magic for determining the location of termcap library is from GNU Texinfo

View File

@ -111,7 +111,7 @@ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),
nopointersign_cflags="-Wno-pointer-sign", nopointersign_cflags="")
CFLAGS="$saved_cflags"
AM_CFLAGS="-std=gnu99 $inline_cflags -W -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
AM_CFLAGS="-std=gnu99 $inline_cflags -W -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow -Wcast-qual"
AC_SUBST(AM_CFLAGS)
### The following magic for determining the location of termcap library is from GNU Texinfo

View File

@ -23,11 +23,11 @@
#define MAX_TOTAL_MATCHES (256 << sizeof(char *))
/* Wrap strcmp() for qsort() */
/* Wrap strcmp() for qsort() -- weird construct to pass -Wcast-qual */
static int compare(const void *p1, const void *p2)
{
char **v1 = (char **)p1;
char **v2 = (char **)p2;
char *const *v1 = (char *const *)p1;
char *const *v2 = (char *const *)p2;
return strcmp(*v1, *v2);
}

View File

@ -452,7 +452,7 @@ static el_status_t insert_string(const char *p)
char *new;
char *q;
len = strlen((char *)p);
len = strlen(p);
if (rl_end + len >= Length) {
new = malloc(sizeof(char) * (Length + len + MEM_INC));
if (!new)
@ -566,13 +566,13 @@ static const char *search_hist(const char *search, const char *(*move)(void))
int len;
int pos;
int (*match)(const char *s1, const char *s2, size_t n);
char *pat;
const char *pat;
/* Save or get remembered search pattern. */
if (search && *search) {
if (old_search)
free(old_search);
old_search = (char *)strdup((char *)search);
old_search = strdup(search);
}
else {
if (old_search == NULL || *old_search == '\0')
@ -583,16 +583,16 @@ static const char *search_hist(const char *search, const char *(*move)(void))
/* Set up pattern-finder. */
if (*search == '^') {
match = strncmp;
pat = (char *)(search + 1);
pat = search + 1;
}
else {
match = substrcmp;
pat = (char *)search;
pat = search;
}
len = strlen(pat);
for (pos = H.Pos; (*move)() != NULL; )
if ((*match)((char *)H.Lines[H.Pos], pat, len) == 0)
if (match(H.Lines[H.Pos], pat, len) == 0)
return H.Lines[H.Pos];
H.Pos = pos;