From: bapt Date: Sat, 7 Nov 2015 20:29:23 +0000 (+0000) Subject: Use const where needed instead of using pragmas to work around the warnings X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4e4bd7df36b05081c750c3d6b7a46733aab59f66;p=people%2Fliuw%2Ffreebsd.git Use const where needed instead of using pragmas to work around the warnings --- diff --git a/usr.bin/localedef/charmap.c b/usr.bin/localedef/charmap.c index 91a25bcad3f..0c648739037 100644 --- a/usr.bin/localedef/charmap.c +++ b/usr.bin/localedef/charmap.c @@ -68,11 +68,8 @@ RB_GENERATE_STATIC(cmap_wc, charmap, rb_wc, cmap_compare_wc); * Array of POSIX specific portable characters. */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" - static const struct { - char *name; + const char *name; int ch; } portable_chars[] = { { "NUL", '\0' }, @@ -189,8 +186,6 @@ static const struct { { NULL, 0 } }; -#pragma GCC diagnostic pop - static int cmap_compare_sym(const void *n1, const void *n2) { @@ -220,7 +215,7 @@ init_charmap(void) } static void -add_charmap_impl(char *sym, wchar_t wc, int nodups) +add_charmap_impl(const char *sym, wchar_t wc, int nodups) { charmap_t srch; charmap_t *n = NULL; @@ -260,7 +255,7 @@ add_charmap_impl(char *sym, wchar_t wc, int nodups) } void -add_charmap(char *sym, int c) +add_charmap(const char *sym, int c) { add_charmap_impl(sym, c, 1); } @@ -322,7 +317,7 @@ add_charmap_range(char *s, char *e, int wc) } void -add_charmap_char(char *name, int val) +add_charmap_char(const char *name, int val) { add_charmap_impl(name, val, 0); } diff --git a/usr.bin/localedef/localedef.h b/usr.bin/localedef/localedef.h index 91e47ad6221..7805d376fc4 100644 --- a/usr.bin/localedef/localedef.h +++ b/usr.bin/localedef/localedef.h @@ -76,11 +76,11 @@ wchar_t *get_wcs(void); /* charmap.c - CHARMAP handling */ void init_charmap(void); -void add_charmap(char *, int); +void add_charmap(const char *, int); void add_charmap_undefined(char *); void add_charmap_posix(void); void add_charmap_range(char *, char *, int); -void add_charmap_char(char *name, int val); +void add_charmap_char(const char *name, int val); int lookup_charmap(const char *, wchar_t *); int check_charmap_undefined(char *); int check_charmap(wchar_t);