Merge pull request #481 from alejandro-colomar/STDC_HEADERS
Assume C89 is available
This commit is contained in:
commit
98f943f2a5
@ -38,7 +38,6 @@ dnl Checks for libraries.
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_HEADER_STDBOOL
|
||||
|
||||
|
@ -22,8 +22,6 @@ typedef unsigned char _Bool;
|
||||
# define __bool_true_false_are_defined 1
|
||||
#endif
|
||||
|
||||
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
||||
|
||||
/* Take care of NLS matters. */
|
||||
#ifdef S_SPLINT_S
|
||||
extern char *setlocale(int categories, const char *locale);
|
||||
@ -61,16 +59,8 @@ extern char * textdomain (const char * domainname);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#else /* not STDC_HEADERS */
|
||||
# ifndef HAVE_STRCHR
|
||||
# define strchr index
|
||||
# define strrchr rindex
|
||||
# endif
|
||||
char *strchr (), *strrchr (), *strtok ();
|
||||
#endif /* not STDC_HEADERS */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_ERRNO_H
|
||||
# include <errno.h>
|
||||
|
@ -31,32 +31,9 @@
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
|
||||
# define IN_CTYPE_DOMAIN(c) 1
|
||||
#else
|
||||
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||
#endif
|
||||
|
||||
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
|
||||
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
|
||||
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
|
||||
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
||||
|
||||
/* ISDIGIT differs from ISDIGIT_LOCALE, 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.
|
||||
- It's typically faster.
|
||||
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
|
||||
only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE 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) (c) - '0' <= 9)
|
||||
|
||||
#include "getdate.h"
|
||||
|
||||
#if defined (STDC_HEADERS)
|
||||
# include <string.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
/* Some old versions of bison generate parsers that use bcopy.
|
||||
That loses on systems that don't provide the function, so we have
|
||||
@ -651,7 +628,7 @@ static int LookupWord (char *buff)
|
||||
|
||||
/* Make it lowercase. */
|
||||
for (p = buff; '\0' != *p; p++)
|
||||
if (ISUPPER (*p))
|
||||
if (isupper (*p))
|
||||
*p = tolower (*p);
|
||||
|
||||
if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
|
||||
@ -732,7 +709,7 @@ static int LookupWord (char *buff)
|
||||
}
|
||||
|
||||
/* Military timezones. */
|
||||
if (buff[1] == '\0' && ISALPHA (*buff))
|
||||
if (buff[1] == '\0' && isalpha (*buff))
|
||||
{
|
||||
for (tp = MilitaryTable; tp->name; tp++)
|
||||
if (strcmp (buff, tp->name) == 0)
|
||||
@ -771,30 +748,30 @@ yylex (void)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
while (ISSPACE (*yyInput))
|
||||
while (isspace (*yyInput))
|
||||
yyInput++;
|
||||
|
||||
if (ISDIGIT (c = *yyInput) || c == '-' || c == '+')
|
||||
if (isdigit (c = *yyInput) || c == '-' || c == '+')
|
||||
{
|
||||
if (c == '-' || c == '+')
|
||||
{
|
||||
sign = c == '-' ? -1 : 1;
|
||||
if (!ISDIGIT (*++yyInput))
|
||||
if (!isdigit (*++yyInput))
|
||||
/* skip the '-' sign */
|
||||
continue;
|
||||
}
|
||||
else
|
||||
sign = 0;
|
||||
for (yylval.Number = 0; ISDIGIT (c = *yyInput++);)
|
||||
for (yylval.Number = 0; isdigit (c = *yyInput++);)
|
||||
yylval.Number = 10 * yylval.Number + c - '0';
|
||||
yyInput--;
|
||||
if (sign < 0)
|
||||
yylval.Number = -yylval.Number;
|
||||
return (0 != sign) ? tSNUMBER : tUNUMBER;
|
||||
}
|
||||
if (ISALPHA (c))
|
||||
if (isalpha (c))
|
||||
{
|
||||
for (p = buff; (c = *yyInput++, ISALPHA (c)) || c == '.';)
|
||||
for (p = buff; (c = *yyInput++, isalpha (c)) || c == '.';)
|
||||
if (p < &buff[sizeof buff - 1])
|
||||
*p++ = c;
|
||||
*p = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user