diff options
Diffstat (limited to 'posix')
-rw-r--r-- | posix/fnmatch.c | 23 | ||||
-rw-r--r-- | posix/regex.c | 7 | ||||
-rw-r--r-- | posix/unistd.h | 4 |
3 files changed, 23 insertions, 11 deletions
diff --git a/posix/fnmatch.c b/posix/fnmatch.c index de45941..553a968 100644 --- a/posix/fnmatch.c +++ b/posix/fnmatch.c @@ -15,13 +15,13 @@ License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifdef HAVE_CONFIG_H -#include <config.h> +#if HAVE_CONFIG_H +# include <config.h> #endif /* Enable GNU extensions in fnmatch.h. */ #ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 +# define _GNU_SOURCE 1 #endif #include <errno.h> @@ -40,9 +40,18 @@ Cambridge, MA 02139, USA. */ #if defined (_LIBC) || !defined (__GNU_LIBRARY__) -#ifndef errno +# if defined (STDC_HEADERS) || !defined (isascii) +# define ISASCII(c) 1 +# else +# define ISASCII(c) isascii(c) +# endif + +# define ISUPPER(c) (ISASCII (c) && isupper (c)) + + +# ifndef errno extern int errno; -#endif +# endif /* Match STRING against the filename pattern PATTERN, returning zero if it matches, nonzero if not. */ @@ -56,7 +65,7 @@ fnmatch (pattern, string, flags) register char c; /* Note that this evalutes C many times. */ -#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c)) +# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c)) while ((c = *p++) != '\0') { @@ -225,6 +234,8 @@ fnmatch (pattern, string, flags) return 0; return FNM_NOMATCH; + +# undef FOLD } #endif /* _LIBC or not __GNU_LIBRARY__. */ diff --git a/posix/regex.c b/posix/regex.c index c277234..4b640e6 100644 --- a/posix/regex.c +++ b/posix/regex.c @@ -1144,7 +1144,7 @@ typedef struct char *destination; \ /* Must be int, so when we don't save any registers, the arithmetic \ of 0 + -1 isn't done as unsigned. */ \ - int this_reg; \ + unsigned this_reg; \ \ DEBUG_STATEMENT (failure_id++); \ DEBUG_STATEMENT (nfailure_points_pushed++); \ @@ -1257,7 +1257,7 @@ typedef struct #define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\ { \ DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \ - int this_reg; \ + unsigned this_reg; \ const unsigned char *string_temp; \ \ assert (!FAIL_STACK_EMPTY ()); \ @@ -5436,7 +5436,8 @@ regerror (errcode, preg, errbuf, errbuf_size) size_t msg_size; if (errcode < 0 - || errcode >= (sizeof (re_error_msgid) / sizeof (re_error_msgid[0]))) + || errcode >= (int) (sizeof (re_error_msgid) + / sizeof (re_error_msgid[0]))) /* Only error codes returned by the rest of the code should be passed to this routine. If we are given anything else, or if other regex code generates an invalid error code, then the program has a bug. diff --git a/posix/unistd.h b/posix/unistd.h index 14b11b1..e9754e1 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -513,8 +513,8 @@ extern char *ttyname __P ((int __fd)); #ifdef __USE_REENTRANT /* Store at most BUFLEN characters of the pathname of the terminal FD is open on in BUF. Return 0 on success, -1 otherwise. */ -extern int __ttyname_r __P ((int __fd, char *__buf, int __buflen)); -extern int ttyname_r __P ((int __fd, char *__buf, int __buflen)); +extern int __ttyname_r __P ((int __fd, char *__buf, size_t __buflen)); +extern int ttyname_r __P ((int __fd, char *__buf, size_t __buflen)); #endif /* Return 1 if FD is a valid descriptor associated |