From a8f0811e1e174cd6d3b5f0fef314269d000f9c4c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 6 Jul 2006 21:51:28 +0000 Subject: [PATCH] * lib/.cppi-disable: Add wcwidth. * lib/fnmatch.c (ISBLANK): Remove. All uses changed to isblank. (isblank) [! (defined isblank || HAVE_DECL_ISBLANK)]: New macro. (ISGRAPH): Remove. All uses changed to isgraph. (FOLD) [!defined _LIBC]: Remove special case. * lib/getdate.y (lookup_word): Remove no-longer-needed call to islower. * lib/regext_internal.h (isblank): Depend on HAVE_DECL_ISBLANK, not HAVE_ISBLANK. * lib/strftime.c (TOLOWER, TOUPPER) [!defined _LIBC]: Remove special case. * m4/fnmatch.m4 (_AC_LIBOBJ_FNMATCH): Don't check for getenv decl; no longer needed. Check for isblank decl. * m4/mkstemp.m4 (gl_PREREQ_TEMPNAME): Don't check for getenv decl. * m4/regex.m4 (gl_PREREQ_REGEX): Dheck for isblank decl instead of existence. --- lib/.cppi-disable | 1 + lib/ChangeLog | 12 ++++++++++++ lib/backupfile.c | 6 +++--- lib/fnmatch.c | 17 +++-------------- lib/fnmatch_loop.c | 4 ++-- lib/getdate.y | 7 +++---- lib/posixtm.c | 6 +++--- lib/regex_internal.h | 2 +- lib/sig2str.c | 6 +++--- lib/strftime.c | 15 +++++---------- lib/strverscmp.c | 6 +++--- lib/userspec.c | 6 +++--- m4/ChangeLog | 8 ++++++++ m4/fnmatch.m4 | 2 +- m4/mkstemp.m4 | 5 ++--- m4/regex.m4 | 3 ++- 16 files changed, 55 insertions(+), 51 deletions(-) diff --git a/lib/.cppi-disable b/lib/.cppi-disable index 57a07aa85..7106f0cbc 100644 --- a/lib/.cppi-disable +++ b/lib/.cppi-disable @@ -42,3 +42,4 @@ time_r.h utimecmp.h vasnprintf.h vasprintf.h +wcwidth.h diff --git a/lib/ChangeLog b/lib/ChangeLog index a29f43620..d74990376 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,15 @@ +2006-07-06 Paul Eggert + + * .cppi-disable: Add wcwidth. + * fnmatch.c (ISBLANK): Remove. All uses changed to isblank. + (isblank) [! (defined isblank || HAVE_DECL_ISBLANK)]: New macro. + (ISGRAPH): Remove. All uses changed to isgraph. + (FOLD) [!defined _LIBC]: Remove special case. + * getdate.y (lookup_word): Remove no-longer-needed call to islower. + * regext_internal.h (isblank): Depend on HAVE_DECL_ISBLANK, not + HAVE_ISBLANK. + * strftime.c (TOLOWER, TOUPPER) [!defined _LIBC]: Remove special case. + 2006-07-06 Ralf Wildenhues * strtod.c (strtod): cast the argument of tolower to unsigned char. diff --git a/lib/backupfile.c b/lib/backupfile.c index a990addec..3dfaf45dc 100644 --- a/lib/backupfile.c +++ b/lib/backupfile.c @@ -95,11 +95,11 @@ #endif /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + ISDIGIT unless it's important to use the locale's definition of `digit' even when the host does not conform to POSIX. */ #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) diff --git a/lib/fnmatch.c b/lib/fnmatch.c index 4fc19b4fe..bd4135885 100644 --- a/lib/fnmatch.c +++ b/lib/fnmatch.c @@ -86,15 +86,8 @@ extern int fnmatch (const char *pattern, const char *string, int flags); #if defined _LIBC || !defined __GNU_LIBRARY__ || !HAVE_FNMATCH_GNU -# ifdef isblank -# define ISBLANK(c) isblank (c) -# else -# define ISBLANK(c) ((c) == ' ' || (c) == '\t') -# endif -# ifdef isgraph -# define ISGRAPH(c) isgraph (c) -# else -# define ISGRAPH(c) (isprint (c) && !isspace (c)) +# if ! (defined isblank || HAVE_DECL_ISBLANK) +# define isblank(c) ((c) == ' ' || (c) == '\t') # endif # define STREQ(s1, s2) ((strcmp (s1, s2) == 0)) @@ -152,11 +145,7 @@ static int posixly_correct; # endif /* Note that this evaluates C many times. */ -# ifdef _LIBC -# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c)) -# else -# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c)) -# endif +# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c)) # define CHAR char # define UCHAR unsigned char # define INT int diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c index d86899b6d..308d311f9 100644 --- a/lib/fnmatch_loop.c +++ b/lib/fnmatch_loop.c @@ -290,10 +290,10 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, #else if ((STREQ (str, L_("alnum")) && isalnum ((UCHAR) *n)) || (STREQ (str, L_("alpha")) && isalpha ((UCHAR) *n)) - || (STREQ (str, L_("blank")) && ISBLANK ((UCHAR) *n)) + || (STREQ (str, L_("blank")) && isblank ((UCHAR) *n)) || (STREQ (str, L_("cntrl")) && iscntrl ((UCHAR) *n)) || (STREQ (str, L_("digit")) && isdigit ((UCHAR) *n)) - || (STREQ (str, L_("graph")) && ISGRAPH ((UCHAR) *n)) + || (STREQ (str, L_("graph")) && isgraph ((UCHAR) *n)) || (STREQ (str, L_("lower")) && islower ((UCHAR) *n)) || (STREQ (str, L_("print")) && isprint ((UCHAR) *n)) || (STREQ (str, L_("punct")) && ispunct ((UCHAR) *n)) diff --git a/lib/getdate.y b/lib/getdate.y index 534e2681e..d874d689e 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -70,8 +70,8 @@ /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to isdigit unless it's important to use the locale's definition @@ -887,8 +887,7 @@ lookup_word (parser_control const *pc, char *word) for (p = word; *p; p++) { unsigned char ch = *p; - if (islower (ch)) - *p = toupper (ch); + *p = toupper (ch); } for (tp = meridian_table; tp->name; tp++) diff --git a/lib/posixtm.c b/lib/posixtm.c index 5023c3442..43161d2e0 100644 --- a/lib/posixtm.c +++ b/lib/posixtm.c @@ -44,11 +44,11 @@ #endif /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + isdigit unless it's important to use the locale's definition of `digit' even when the host does not conform to POSIX. */ #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) diff --git a/lib/regex_internal.h b/lib/regex_internal.h index b2c44fe18..993c9923e 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -56,7 +56,7 @@ #endif /* In case that the system doesn't have isblank(). */ -#if !defined _LIBC && !defined HAVE_ISBLANK && !defined isblank +#if !defined _LIBC && !HAVE_DECL_ISBLANK && !defined isblank # define isblank(ch) ((ch) == ' ' || (ch) == '\t') #endif diff --git a/lib/sig2str.c b/lib/sig2str.c index 00089be78..bf4b7cbe8 100644 --- a/lib/sig2str.c +++ b/lib/sig2str.c @@ -247,11 +247,11 @@ static struct numname { int num; char const name[8]; } numname_table[] = #define NUMNAME_ENTRIES (sizeof numname_table / sizeof numname_table[0]) /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + isdigit unless it's important to use the locale's definition of `digit' even when the host does not conform to POSIX. */ #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) diff --git a/lib/strftime.c b/lib/strftime.c index cfeac4e56..4a4ac0662 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -278,17 +278,12 @@ extern char *tzname[]; # define TOLOWER(Ch, L) towlower (Ch) # endif #else -# ifdef _LIBC -# ifdef USE_IN_EXTENDED_LOCALE_MODEL -# define TOUPPER(Ch, L) __toupper_l (Ch, L) -# define TOLOWER(Ch, L) __tolower_l (Ch, L) -# else -# define TOUPPER(Ch, L) toupper (Ch) -# define TOLOWER(Ch, L) tolower (Ch) -# endif +# ifdef USE_IN_EXTENDED_LOCALE_MODEL +# define TOUPPER(Ch, L) __toupper_l (Ch, L) +# define TOLOWER(Ch, L) __tolower_l (Ch, L) # else -# define TOUPPER(Ch, L) (islower (Ch) ? toupper (Ch) : (Ch)) -# define TOLOWER(Ch, L) (isupper (Ch) ? tolower (Ch) : (Ch)) +# define TOUPPER(Ch, L) toupper (Ch) +# define TOLOWER(Ch, L) tolower (Ch) # endif #endif /* We don't use `isdigit' here since the locale dependent diff --git a/lib/strverscmp.c b/lib/strverscmp.c index 6276bca0f..5361a5cc5 100644 --- a/lib/strverscmp.c +++ b/lib/strverscmp.c @@ -37,11 +37,11 @@ /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + isdigit unless it's important to use the locale's definition of `digit' even when the host does not conform to POSIX. */ #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) diff --git a/lib/userspec.c b/lib/userspec.c index b09c8d8a1..fbdc2f9a1 100644 --- a/lib/userspec.c +++ b/lib/userspec.c @@ -76,11 +76,11 @@ #endif /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + isdigit unless it's important to use the locale's definition of `digit' even when the host does not conform to POSIX. */ #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) diff --git a/m4/ChangeLog b/m4/ChangeLog index a089b88e3..c26cfe70c 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,11 @@ +2006-07-06 Paul Eggert + + * fnmatch.m4 (_AC_LIBOBJ_FNMATCH): Don't check for getenv decl; + no longer needed. Check for isblank decl. + * mkstemp.m4 (gl_PREREQ_TEMPNAME): Don't check for getenv decl. + * regex.m4 (gl_PREREQ_REGEX): Dheck for isblank decl instead + of existence. + 2006-07-05 Paul Eggert * xstrtol.m4 (gl_PREREQ_XSTRTOL): Use AC_CHECK_DECLS_ONCE diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4 index d8b93827f..ce94c84a7 100644 --- a/m4/fnmatch.m4 +++ b/m4/fnmatch.m4 @@ -63,7 +63,7 @@ AS_IF([test $$2 = yes], [$3], [$4]) AC_DEFUN([_AC_LIBOBJ_FNMATCH], [AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_TYPE_MBSTATE_T])dnl -AC_CHECK_DECLS([getenv]) +AC_CHECK_DECLS([isblank], [], [], [#include ]) AC_CHECK_FUNCS([btowc mbsrtowcs mempcpy wmemchr wmemcpy wmempcpy]) AC_CHECK_HEADERS([wchar.h wctype.h]) AC_LIBOBJ([fnmatch]) diff --git a/m4/mkstemp.m4 b/m4/mkstemp.m4 index 091978884..57fa8a485 100644 --- a/m4/mkstemp.m4 +++ b/m4/mkstemp.m4 @@ -1,6 +1,6 @@ -#serial 12 +#serial 13 -# Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -67,6 +67,5 @@ AC_DEFUN([gl_PREREQ_TEMPNAME], [ AC_CHECK_HEADERS_ONCE(sys/time.h) AC_CHECK_FUNCS(__secure_getenv gettimeofday) - AC_CHECK_DECLS_ONCE(getenv) AC_REQUIRE([gl_AC_TYPE_UINTMAX_T]) ]) diff --git a/m4/regex.m4 b/m4/regex.m4 index c60085250..22d489d5b 100644 --- a/m4/regex.m4 +++ b/m4/regex.m4 @@ -166,5 +166,6 @@ AC_DEFUN([gl_PREREQ_REGEX], AC_REQUIRE([gl_C_RESTRICT]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CHECK_HEADERS_ONCE([locale.h wchar.h wctype.h]) - AC_CHECK_FUNCS_ONCE([isblank mbrtowc mempcpy wcrtomb wcscoll]) + AC_CHECK_FUNCS_ONCE([mbrtowc mempcpy wcrtomb wcscoll]) + AC_CHECK_DECLS([isblank], [], [], [#include ]) ]) -- 2.11.0