From aa990038b120588303adfe133366fe481675c5ab Mon Sep 17 00:00:00 2001 From: rodrigc Date: Sun, 20 Sep 2015 20:50:18 +0000 Subject: [PATCH] Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. --- lib/libc/locale/isctype.c | 69 +++++++++++++------------------------ lib/libc/locale/iswctype.c | 63 +++++++++++---------------------- lib/libc/locale/setlocale.c | 12 +++---- lib/libc/locale/tolower.c | 7 ++-- lib/libc/locale/toupper.c | 7 ++-- 5 files changed, 52 insertions(+), 106 deletions(-) diff --git a/lib/libc/locale/isctype.c b/lib/libc/locale/isctype.c index be1b091237fc..25505343d41a 100644 --- a/lib/libc/locale/isctype.c +++ b/lib/libc/locale/isctype.c @@ -45,184 +45,161 @@ __FBSDID("$FreeBSD$"); #undef digittoint int -digittoint(c) - int c; +digittoint(int c) { return (__sbmaskrune(c, 0xFF)); } #undef isalnum int -isalnum(c) - int c; +isalnum(int c) { return (__sbistype(c, _CTYPE_A|_CTYPE_D)); } #undef isalpha int -isalpha(c) - int c; +isalpha(int c) { return (__sbistype(c, _CTYPE_A)); } #undef isascii int -isascii(c) - int c; +isascii(int c) { return ((c & ~0x7F) == 0); } #undef isblank int -isblank(c) - int c; +isblank(int c) { return (__sbistype(c, _CTYPE_B)); } #undef iscntrl int -iscntrl(c) - int c; +iscntrl(int c) { return (__sbistype(c, _CTYPE_C)); } #undef isdigit int -isdigit(c) - int c; +isdigit(int c) { return (__isctype(c, _CTYPE_D)); } #undef isgraph int -isgraph(c) - int c; +isgraph(int c) { return (__sbistype(c, _CTYPE_G)); } #undef ishexnumber int -ishexnumber(c) - int c; +ishexnumber(int c) { return (__sbistype(c, _CTYPE_X)); } #undef isideogram int -isideogram(c) - int c; +isideogram(int c) { return (__sbistype(c, _CTYPE_I)); } #undef islower int -islower(c) - int c; +islower(int c) { return (__sbistype(c, _CTYPE_L)); } #undef isnumber int -isnumber(c) - int c; +isnumber(int c) { return (__sbistype(c, _CTYPE_D)); } #undef isphonogram int -isphonogram(c) - int c; +isphonogram(int c) { return (__sbistype(c, _CTYPE_Q)); } #undef isprint int -isprint(c) - int c; +isprint(int c) { return (__sbistype(c, _CTYPE_R)); } #undef ispunct int -ispunct(c) - int c; +ispunct(int c) { return (__sbistype(c, _CTYPE_P)); } #undef isrune int -isrune(c) - int c; +isrune(int c) { return (__sbistype(c, 0xFFFFFF00L)); } #undef isspace int -isspace(c) - int c; +isspace(int c) { return (__sbistype(c, _CTYPE_S)); } #undef isspecial int -isspecial(c) - int c; +isspecial(int c) { return (__sbistype(c, _CTYPE_T)); } #undef isupper int -isupper(c) - int c; +isupper(int c) { return (__sbistype(c, _CTYPE_U)); } #undef isxdigit int -isxdigit(c) - int c; +isxdigit(int c) { return (__isctype(c, _CTYPE_X)); } #undef toascii int -toascii(c) - int c; +toascii(int c) { return (c & 0x7F); } #undef tolower int -tolower(c) - int c; +tolower(int c) { return (__sbtolower(c)); } #undef toupper int -toupper(c) - int c; +toupper(int c) { return (__sbtoupper(c)); } diff --git a/lib/libc/locale/iswctype.c b/lib/libc/locale/iswctype.c index eaa1bf3d2780..59d432c90ce0 100644 --- a/lib/libc/locale/iswctype.c +++ b/lib/libc/locale/iswctype.c @@ -42,168 +42,147 @@ __FBSDID("$FreeBSD$"); #undef iswalnum int -iswalnum(wc) - wint_t wc; +iswalnum(wint_t wc) { return (__istype(wc, _CTYPE_A|_CTYPE_D)); } #undef iswalpha int -iswalpha(wc) - wint_t wc; +iswalpha(wint_t wc) { return (__istype(wc, _CTYPE_A)); } #undef iswascii int -iswascii(wc) - wint_t wc; +iswascii(wint_t wc) { return ((wc & ~0x7F) == 0); } #undef iswblank int -iswblank(wc) - wint_t wc; +iswblank(wint_t wc) { return (__istype(wc, _CTYPE_B)); } #undef iswcntrl int -iswcntrl(wc) - wint_t wc; +iswcntrl(wint_t wc) { return (__istype(wc, _CTYPE_C)); } #undef iswdigit int -iswdigit(wc) - wint_t wc; +iswdigit(wint_t wc) { return (__isctype(wc, _CTYPE_D)); } #undef iswgraph int -iswgraph(wc) - wint_t wc; +iswgraph(wint_t wc) { return (__istype(wc, _CTYPE_G)); } #undef iswhexnumber int -iswhexnumber(wc) - wint_t wc; +iswhexnumber(wint_t wc) { return (__istype(wc, _CTYPE_X)); } #undef iswideogram int -iswideogram(wc) - wint_t wc; +iswideogram(wint_t wc) { return (__istype(wc, _CTYPE_I)); } #undef iswlower int -iswlower(wc) - wint_t wc; +iswlower(wint_t wc) { return (__istype(wc, _CTYPE_L)); } #undef iswnumber int -iswnumber(wc) - wint_t wc; +iswnumber(wint_t wc) { return (__istype(wc, _CTYPE_D)); } #undef iswphonogram int -iswphonogram(wc) - wint_t wc; +iswphonogram(wint_t wc) { return (__istype(wc, _CTYPE_Q)); } #undef iswprint int -iswprint(wc) - wint_t wc; +iswprint(wint_t wc) { return (__istype(wc, _CTYPE_R)); } #undef iswpunct int -iswpunct(wc) - wint_t wc; +iswpunct(wint_t wc) { return (__istype(wc, _CTYPE_P)); } #undef iswrune int -iswrune(wc) - wint_t wc; +iswrune(wint_t wc) { return (__istype(wc, 0xFFFFFF00L)); } #undef iswspace int -iswspace(wc) - wint_t wc; +iswspace(wint_t wc) { return (__istype(wc, _CTYPE_S)); } #undef iswspecial int -iswspecial(wc) - wint_t wc; +iswspecial(wint_t wc) { return (__istype(wc, _CTYPE_T)); } #undef iswupper int -iswupper(wc) - wint_t wc; +iswupper(wint_t wc) { return (__istype(wc, _CTYPE_U)); } #undef iswxdigit int -iswxdigit(wc) - wint_t wc; +iswxdigit(wint_t wc) { return (__isctype(wc, _CTYPE_X)); } #undef towlower wint_t -towlower(wc) - wint_t wc; +towlower(wint_t wc) { return (__tolower(wc)); } #undef towupper wint_t -towupper(wc) - wint_t wc; +towupper(wint_t wc) { return (__toupper(wc)); } diff --git a/lib/libc/locale/setlocale.c b/lib/libc/locale/setlocale.c index 0322af266117..13ff25bfd88e 100644 --- a/lib/libc/locale/setlocale.c +++ b/lib/libc/locale/setlocale.c @@ -98,9 +98,7 @@ static char *loadlocale(int); const char *__get_locale_env(int); char * -setlocale(category, locale) - int category; - const char *locale; +setlocale(int category, const char *locale) { int i, j, len, saverr; const char *env, *r; @@ -209,7 +207,7 @@ setlocale(category, locale) } static char * -currentlocale() +currentlocale(void) { int i; @@ -228,8 +226,7 @@ currentlocale() } static char * -loadlocale(category) - int category; +loadlocale(int category) { char *new = new_categories[category]; char *old = current_categories[category]; @@ -286,8 +283,7 @@ loadlocale(category) } const char * -__get_locale_env(category) - int category; +__get_locale_env(int category) { const char *env; diff --git a/lib/libc/locale/tolower.c b/lib/libc/locale/tolower.c index f2eb48313c63..c74791da370c 100644 --- a/lib/libc/locale/tolower.c +++ b/lib/libc/locale/tolower.c @@ -45,9 +45,7 @@ __FBSDID("$FreeBSD$"); #include "mblocal.h" __ct_rune_t -___tolower_l(c, l) - __ct_rune_t c; - locale_t l; +___tolower_l(__ct_rune_t c, locale_t l) { size_t lim; FIX_LOCALE(l); @@ -72,8 +70,7 @@ ___tolower_l(c, l) return(c); } __ct_rune_t -___tolower(c) - __ct_rune_t c; +___tolower(__ct_rune_t c) { return ___tolower_l(c, __get_locale()); } diff --git a/lib/libc/locale/toupper.c b/lib/libc/locale/toupper.c index 704ac3a2c1b0..2c5ec86de434 100644 --- a/lib/libc/locale/toupper.c +++ b/lib/libc/locale/toupper.c @@ -45,9 +45,7 @@ __FBSDID("$FreeBSD$"); #include "mblocal.h" __ct_rune_t -___toupper_l(c, l) - __ct_rune_t c; - locale_t l; +___toupper_l(__ct_rune_t c, locale_t l) { size_t lim; FIX_LOCALE(l); @@ -74,8 +72,7 @@ ___toupper_l(c, l) return(c); } __ct_rune_t -___toupper(c) - __ct_rune_t c; +___toupper(__ct_rune_t c) { return ___toupper_l(c, __get_locale()); }