diff options
| -rw-r--r-- | libc/misc/dirent/readdir64.c | 1 | ||||
| -rw-r--r-- | libc/misc/dirent/readdir64_r.c | 1 | ||||
| -rw-r--r-- | libc/misc/dirent/scandir.c | 23 | ||||
| -rw-r--r-- | libc/misc/dirent/scandir64.c | 22 | ||||
| -rw-r--r-- | libc/misc/glob/glob.c | 13 | ||||
| -rw-r--r-- | libc/misc/gnu/obstack.c | 422 | ||||
| -rw-r--r-- | libc/misc/internals/tempname.c | 2 | ||||
| -rw-r--r-- | libc/misc/locale/locale.c | 38 | ||||
| -rw-r--r-- | libc/misc/mntent/mntent.c | 3 | ||||
| -rw-r--r-- | libc/misc/regex/regex_old.c | 456 | ||||
| -rw-r--r-- | libc/misc/search/_lsearch.c | 2 | ||||
| -rw-r--r-- | libc/misc/statfs/fstatfs64.c | 5 | ||||
| -rw-r--r-- | libc/misc/statfs/fstatvfs.c | 3 | ||||
| -rw-r--r-- | libc/misc/statfs/fstatvfs64.c | 8 | ||||
| -rw-r--r-- | libc/misc/statfs/statfs64.c | 6 | ||||
| -rw-r--r-- | libc/misc/statfs/statvfs.c | 2 | ||||
| -rw-r--r-- | libc/misc/statfs/statvfs64.c | 2 | ||||
| -rw-r--r-- | libc/misc/sysvipc/__syscall_ipc.c | 2 | ||||
| -rw-r--r-- | libc/misc/sysvipc/sem.c | 12 | ||||
| -rw-r--r-- | libc/misc/sysvipc/shm.c | 6 | ||||
| -rw-r--r-- | libc/misc/time/time.c | 3 | ||||
| -rw-r--r-- | libc/misc/wchar/wchar.c | 6 | ||||
| -rw-r--r-- | libc/misc/wordexp/wordexp.c | 2 |
23 files changed, 425 insertions, 615 deletions
diff --git a/libc/misc/dirent/readdir64.c b/libc/misc/dirent/readdir64.c index 36dc35379..e8a29da96 100644 --- a/libc/misc/dirent/readdir64.c +++ b/libc/misc/dirent/readdir64.c @@ -6,7 +6,6 @@ #include <_lfs_64.h> -#include <dirent.h> #include <errno.h> #include <stdlib.h> #include <string.h> diff --git a/libc/misc/dirent/readdir64_r.c b/libc/misc/dirent/readdir64_r.c index 193d9196d..2958b1d1a 100644 --- a/libc/misc/dirent/readdir64_r.c +++ b/libc/misc/dirent/readdir64_r.c @@ -6,7 +6,6 @@ #include <_lfs_64.h> -#include <dirent.h> #include <errno.h> #include <stdlib.h> #include <string.h> diff --git a/libc/misc/dirent/scandir.c b/libc/misc/dirent/scandir.c index aba63f20b..9b0f7385a 100644 --- a/libc/misc/dirent/scandir.c +++ b/libc/misc/dirent/scandir.c @@ -13,10 +13,10 @@ #include "dirstream.h" /* Experimentally off - libc_hidden_proto(memcpy) */ -libc_hidden_proto(readdir) libc_hidden_proto(opendir) libc_hidden_proto(closedir) libc_hidden_proto(qsort) +libc_hidden_proto(readdir) int scandir(const char *dir, struct dirent ***namelist, int (*selector) (const struct dirent *), @@ -35,8 +35,19 @@ int scandir(const char *dir, struct dirent ***namelist, __set_errno (0); pos = 0; - while ((current = readdir (dp)) != NULL) - if (selector == NULL || (*selector) (current)) + while ((current = readdir (dp)) != NULL) { + int use_it = selector == NULL; + + if (! use_it) + { + use_it = (*selector) (current); + /* The selector function might have changed errno. + * It was zero before and it need to be again to make + * the latter tests work. */ + if (! use_it) + __set_errno (0); + } + if (use_it) { struct dirent *vnew; size_t dsize; @@ -51,19 +62,21 @@ int scandir(const char *dir, struct dirent ***namelist, names_size = 10; else names_size *= 2; - new = (struct dirent **) realloc (names, names_size * sizeof (struct dirent *)); + new = (struct dirent **) realloc (names, + names_size * sizeof (struct dirent *)); if (new == NULL) break; names = new; } - dsize = ¤t->d_name[_D_ALLOC_NAMLEN (current)] - (char *) current; + dsize = ¤t->d_name[_D_ALLOC_NAMLEN(current)] - (char*)current; vnew = (struct dirent *) malloc (dsize); if (vnew == NULL) break; names[pos++] = (struct dirent *) memcpy (vnew, current, dsize); } + } if (unlikely(errno != 0)) { diff --git a/libc/misc/dirent/scandir64.c b/libc/misc/dirent/scandir64.c index 083d2de18..de294c63a 100644 --- a/libc/misc/dirent/scandir64.c +++ b/libc/misc/dirent/scandir64.c @@ -53,8 +53,19 @@ int scandir64(const char *dir, struct dirent64 ***namelist, __set_errno (0); pos = 0; - while ((current = readdir64 (dp)) != NULL) - if (selector == NULL || (*selector) (current)) + while ((current = readdir64 (dp)) != NULL) { + int use_it = selector == NULL; + + if (! use_it) + { + use_it = (*selector) (current); + /* The selector function might have changed errno. + * It was zero before and it need to be again to make + * the latter tests work. */ + if (! use_it) + __set_errno (0); + } + if (use_it) { struct dirent64 *vnew; size_t dsize; @@ -69,20 +80,21 @@ int scandir64(const char *dir, struct dirent64 ***namelist, names_size = 10; else names_size *= 2; - new = (struct dirent64 **) realloc (names, names_size * sizeof (struct dirent64 *)); + new = (struct dirent64 **) realloc (names, + names_size * sizeof (struct dirent64 *)); if (new == NULL) break; names = new; } - dsize = ¤t->d_name[_D_ALLOC_NAMLEN (current)] - (char *) current; + dsize = ¤t->d_name[_D_ALLOC_NAMLEN(current)] - (char*)current; vnew = (struct dirent64 *) malloc (dsize); if (vnew == NULL) break; names[pos++] = (struct dirent64 *) memcpy (vnew, current, dsize); } - + } if (unlikely(errno != 0)) { save = errno; diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index 8d3e3c450..6ccbda4d7 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -504,11 +504,11 @@ libc_hidden_proto(globfree) If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. Otherwise, `glob' returns zero. */ int -glob (pattern, flags, errfunc, pglob) - const char *pattern; - int flags; - int (*errfunc) (const char *, int); - glob_t *pglob; +glob ( + const char *pattern, + int flags, + int (*errfunc) (const char *, int), + glob_t *pglob) { const char *filename; const char *dirname; @@ -1074,8 +1074,7 @@ libc_hidden_def(glob) /* Free storage allocated in PGLOB by a previous `glob' call. */ void -globfree (pglob) - register glob_t *pglob; +globfree (register glob_t *pglob) { if (pglob->gl_pathv != NULL) { diff --git a/libc/misc/gnu/obstack.c b/libc/misc/gnu/obstack.c index 246d164cd..239146383 100644 --- a/libc/misc/gnu/obstack.c +++ b/libc/misc/gnu/obstack.c @@ -1,7 +1,7 @@ /* obstack.c - subroutines used implicitly by object stack macros - Copyright (C) 1988-1994,96,97,98,99,2000,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. Its master source is NOT part of - the C library, however. The master source lives in /gd/gnu/lib. + Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, + 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -15,19 +15,30 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ -/* Make uClibc lie about being glibc. */ -#define __FORCE_GLIBC 1 - -#include <locale.h> #ifdef HAVE_CONFIG_H # include <config.h> #endif -#include <obstack.h> +#ifdef _LIBC +# include <obstack.h> +#ifndef __UCLIBC__ +# include <shlib-compat.h> +#else +# define HAVE_INTTYPES_H 1 +# define HAVE_STDINT_H 1 +# define SHLIB_COMPAT(x,y,z) 0 +# undef libc_hidden_def +# define libc_hidden_def(x) +# undef strong_alias +# define strong_alias(x,y) +#endif +#else +# include "obstack.h" +#endif /* NOTE BEFORE MODIFYING THIS FILE: This version number must be incremented whenever callers compiled using an old obstack.h can no @@ -51,28 +62,38 @@ # endif #endif -#if (defined _LIBC && defined USE_IN_LIBIO) || defined __UCLIBC_HAS_WCHAR__ -# include <wchar.h> -#endif +#include <stddef.h> #ifndef ELIDE_CODE -# if defined __STDC__ && __STDC__ -# define POINTER void * -# else -# define POINTER char * +# if HAVE_INTTYPES_H +# include <inttypes.h> +# endif +# if HAVE_STDINT_H || defined _LIBC +# include <stdint.h> # endif /* Determine default alignment. */ -struct fooalign {char x; double d;}; -# define DEFAULT_ALIGNMENT \ - ((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0)) +union fooround +{ + uintmax_t i; + long double d; + void *p; +}; +struct fooalign +{ + char c; + union fooround u; +}; /* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. But in fact it might be less smart and round addresses to as much as DEFAULT_ROUNDING. So we prepare for it to do that. */ -union fooround {long x; double d;}; -# define DEFAULT_ROUNDING (sizeof (union fooround)) +enum + { + DEFAULT_ALIGNMENT = offsetof (struct fooalign, u), + DEFAULT_ROUNDING = sizeof (union fooround) + }; /* When we copy a long block of data, this is the unit to do it with. On some machines, copying successive ints does not work; @@ -89,36 +110,29 @@ union fooround {long x; double d;}; abort gracefully or use longjump - but shouldn't return. This variable by default points to the internal function `print_and_abort'. */ -# if defined __STDC__ && __STDC__ static void print_and_abort (void); -void (*obstack_alloc_failed_handler) (void) = print_and_abort; -# else -static void print_and_abort (); -void (*obstack_alloc_failed_handler) () = print_and_abort; -# endif - +static void (*__obstack_alloc_failed_handler) (void) = print_and_abort; +weak_alias(__obstack_alloc_failed_handler,obstack_alloc_failed_handler) /* Exit value used when `print_and_abort' is used. */ -# if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H -# include <stdlib.h> -# endif -# ifndef EXIT_FAILURE -# define EXIT_FAILURE 1 +# include <stdlib.h> +# ifdef _LIBC +static int __obstack_exit_failure = EXIT_FAILURE; +weak_alias(__obstack_exit_failure,obstack_exit_failure) +# else +# include "exitfail.h" +# define __obstack_exit_failure exit_failure # endif -libc_hidden_proto(fprintf) -libc_hidden_proto(abort) -libc_hidden_proto(exit) -#ifdef __UCLIBC_HAS_WCHAR__ -libc_hidden_proto(fwprintf) -#endif - -int obstack_exit_failure = EXIT_FAILURE; - -/* The non-GNU-C macros copy the obstack into this global variable - to avoid multiple evaluation. */ - -struct obstack *_obstack; +# ifdef _LIBC +# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) +/* A looong time ago (before 1994, anyway; we're not sure) this global variable + was used by non-GNU-C macros to avoid multiple evaluation. The GNU C + library still exports it because somebody might use it. */ +struct obstack *_obstack_compat; +compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0); +# endif +# endif /* Define a macro that either calls functions with the traditional malloc/free calling interface, or calls functions with the mmalloc/mfree interface @@ -126,33 +140,18 @@ struct obstack *_obstack; For free, do not use ?:, since some compilers, like the MIPS compilers, do not allow (expr) ? void : void. */ -# if defined __STDC__ && __STDC__ -# define CALL_CHUNKFUN(h, size) \ +# define CALL_CHUNKFUN(h, size) \ (((h) -> use_extra_arg) \ ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size))) -# define CALL_FREEFUN(h, old_chunk) \ +# define CALL_FREEFUN(h, old_chunk) \ do { \ if ((h) -> use_extra_arg) \ (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ else \ (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \ } while (0) -# else -# define CALL_CHUNKFUN(h, size) \ - (((h) -> use_extra_arg) \ - ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ - : (*(struct _obstack_chunk *(*) ()) (h)->chunkfun) ((size))) - -# define CALL_FREEFUN(h, old_chunk) \ - do { \ - if ((h) -> use_extra_arg) \ - (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ - else \ - (*(void (*) ()) (h)->freefun) ((old_chunk)); \ - } while (0) -# endif /* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). @@ -164,23 +163,15 @@ struct obstack *_obstack; allocation fails. */ int -_obstack_begin ( - struct obstack *h, - int size, - int alignment, -# if defined __STDC__ && __STDC__ - POINTER (*chunkfun) (long), - void (*freefun) (void *) -# else - POINTER (*chunkfun) (), - void (*freefun) () -# endif - ) +_obstack_begin (struct obstack *h, + int size, int alignment, + void *(*chunkfun) (long), + void (*freefun) (void *)) { register struct _obstack_chunk *chunk; /* points to new chunk */ if (alignment == 0) - alignment = (int) DEFAULT_ALIGNMENT; + alignment = DEFAULT_ALIGNMENT; if (size == 0) /* Default size is what GNU malloc can fit in a 4096-byte block. */ { @@ -198,21 +189,17 @@ _obstack_begin ( size = 4096 - extra; } -# if defined __STDC__ && __STDC__ h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun; h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; -# else - h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun; - h->freefun = freefun; -# endif h->chunk_size = size; h->alignment_mask = alignment - 1; h->use_extra_arg = 0; chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); if (!chunk) - (*obstack_alloc_failed_handler) (); - h->next_free = h->object_base = chunk->contents; + (*__obstack_alloc_failed_handler) (); + h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, + alignment - 1); h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; @@ -223,23 +210,15 @@ _obstack_begin ( } int -_obstack_begin_1 ( - struct obstack *h, - int size, - int alignment, -# if defined __STDC__ && __STDC__ - POINTER (*chunkfun) (POINTER, long), - void (*freefun) (POINTER, POINTER), -# else - POINTER (*chunkfun) (), - void (*freefun) (), -# endif - POINTER arg) +_obstack_begin_1 (struct obstack *h, int size, int alignment, + void *(*chunkfun) (void *, long), + void (*freefun) (void *, void *), + void *arg) { register struct _obstack_chunk *chunk; /* points to new chunk */ if (alignment == 0) - alignment = (int) DEFAULT_ALIGNMENT; + alignment = DEFAULT_ALIGNMENT; if (size == 0) /* Default size is what GNU malloc can fit in a 4096-byte block. */ { @@ -257,13 +236,8 @@ _obstack_begin_1 ( size = 4096 - extra; } -# if defined __STDC__ && __STDC__ h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun; h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; -# else - h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun; - h->freefun = freefun; -# endif h->chunk_size = size; h->alignment_mask = alignment - 1; h->extra_arg = arg; @@ -271,8 +245,9 @@ _obstack_begin_1 ( chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); if (!chunk) - (*obstack_alloc_failed_handler) (); - h->next_free = h->object_base = chunk->contents; + (*__obstack_alloc_failed_handler) (); + h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, + alignment - 1); h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; @@ -289,9 +264,7 @@ _obstack_begin_1 ( to the beginning of the new one. */ void -_obstack_newchunk ( - struct obstack *h, - int length) +_obstack_newchunk (struct obstack *h, int length) { register struct _obstack_chunk *old_chunk = h->chunk; register struct _obstack_chunk *new_chunk; @@ -309,15 +282,14 @@ _obstack_newchunk ( /* Allocate and initialize the new chunk. */ new_chunk = CALL_CHUNKFUN (h, new_size); if (!new_chunk) - (*obstack_alloc_failed_handler) (); + (*__obstack_alloc_failed_handler) (); h->chunk = new_chunk; new_chunk->prev = old_chunk; new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; /* Compute an aligned object_base in the new chunk */ object_base = - __INT_TO_PTR ((__PTR_TO_INT (new_chunk->contents) + h->alignment_mask) - & ~ (h->alignment_mask)); + __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask); /* Move the existing object to the new chunk. Word at a time is fast and is safe if the object @@ -342,7 +314,10 @@ _obstack_newchunk ( /* If the object just copied was the only data in OLD_CHUNK, free that chunk and remove it from the chain. But not if that chunk might contain an empty object. */ - if (h->object_base == old_chunk->contents && ! h->maybe_empty_object) + if (! h->maybe_empty_object + && (h->object_base + == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, + h->alignment_mask))) { new_chunk->prev = old_chunk->prev; CALL_FREEFUN (h, old_chunk); @@ -353,21 +328,20 @@ _obstack_newchunk ( /* The new chunk certainly contains no empty object yet. */ h->maybe_empty_object = 0; } +# ifdef _LIBC +libc_hidden_def (_obstack_newchunk) +# endif /* Return nonzero if object OBJ has been allocated from obstack H. This is here for debugging. If you use it in a program, you are probably losing. */ -# if defined __STDC__ && __STDC__ /* Suppress -Wmissing-prototypes warning. We don't want to declare this in obstack.h because it is just for debugging. */ -int _obstack_allocated_p (struct obstack *h, POINTER obj); -# endif +int _obstack_allocated_p (struct obstack *h, void *obj); int -_obstack_allocated_p ( - struct obstack *h, - POINTER obj) +_obstack_allocated_p (struct obstack *h, void *obj) { register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ register struct _obstack_chunk *plp; /* point to previous chunk if any */ @@ -376,7 +350,7 @@ _obstack_allocated_p ( /* We use >= rather than > since the object cannot be exactly at the beginning of the chunk but might be an empty object exactly at the end of an adjacent chunk. */ - while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) + while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) { plp = lp->prev; lp = plp; @@ -389,13 +363,8 @@ _obstack_allocated_p ( # undef obstack_free -/* This function has two names with identical definitions. - This is the first one, called from non-ANSI code. */ - void -_obstack_free ( - struct obstack *h, - POINTER obj) +obstack_free (struct obstack *h, void *obj) { register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ register struct _obstack_chunk *plp; /* point to previous chunk if any */ @@ -404,7 +373,7 @@ _obstack_free ( /* We use >= because there cannot be an object at the beginning of a chunk. But there can be an empty object at that address at the end of another chunk. */ - while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) + while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) { plp = lp->prev; CALL_FREEFUN (h, lp); @@ -424,43 +393,14 @@ _obstack_free ( abort (); } -/* This function is used from ANSI code. */ - -void -obstack_free ( - struct obstack *h, - POINTER obj) -{ - register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk *plp; /* point to previous chunk if any */ - - lp = h->chunk; - /* We use >= because there cannot be an object at the beginning of a chunk. - But there can be an empty object at that address - at the end of another chunk. */ - while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) - { - plp = lp->prev; - CALL_FREEFUN (h, lp); - lp = plp; - /* If we switch chunks, we can't tell whether the new current - chunk contains an empty object, so assume that it may. */ - h->maybe_empty_object = 1; - } - if (lp) - { - h->object_base = h->next_free = (char *) (obj); - h->chunk_limit = lp->limit; - h->chunk = lp; - } - else if (obj != 0) - /* obj is not in any of the chunks! */ - abort (); -} +# ifdef _LIBC +/* Older versions of libc used a function _obstack_free intended to be + called by non-GCC compilers. */ +strong_alias (obstack_free, _obstack_free) +# endif int -_obstack_memory_used ( - struct obstack *h) +_obstack_memory_used (struct obstack *h) { register struct _obstack_chunk* lp; register int nbytes = 0; @@ -473,20 +413,27 @@ _obstack_memory_used ( } /* Define the error handler. */ +# ifdef _LIBC +# include <libintl.h> +# else +# include "gettext.h" +# endif +/* NLS: Disable gettext in obstack for now: */ +# undef _ +# define _(Str) (Str) # ifndef _ -/* # if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC */ -# ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -# include <libintl.h> -# ifndef _ -# define _(Str) __dcgettext (NULL, Str, LC_MESSAGES) -# endif -# else -# define _(Str) (Str) -# endif +# define _(msgid) gettext (msgid) # endif -# if defined _LIBC && defined USE_IN_LIBIO + +# if defined _LIBC && !defined __UCLIBC__ # include <libio/iolibio.h> -# define fputs(s, f) _IO_fputs (s, f) +# endif + +# ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +# define __attribute__(Spec) /* empty */ +# endif # endif static void @@ -498,135 +445,12 @@ print_and_abort (void) happen because the "memory exhausted" message appears in other places like this and the translation should be reused instead of creating a very similar string which requires a separate translation. */ -# if defined _LIBC && defined USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - fwprintf (stderr, L"%s\n", _("memory exhausted")); - else +# if defined _LIBC && !defined __UCLIBC__ + (void) __fxprintf (NULL, "%s\n", _("memory exhausted")); +# else + fprintf (stderr, "%s\n", _("memory exhausted")); # endif - fprintf (stderr, "%s\n", _("memory exhausted")); - exit (obstack_exit_failure); -} - -# if 0 -/* These are now turned off because the applications do not use it - and it uses bcopy via obstack_grow, which causes trouble on sysV. */ - -/* Now define the functional versions of the obstack macros. - Define them to simply use the corresponding macros to do the job. */ - -# if defined __STDC__ && __STDC__ -/* These function definitions do not work with non-ANSI preprocessors; - they won't pass through the macro names in parentheses. */ - -/* The function names appear in parentheses in order to prevent - the macro-definitions of the names from being expanded there. */ - -POINTER (obstack_base) (obstack) - struct obstack *obstack; -{ - return obstack_base (obstack); -} - -POINTER (obstack_next_free) (obstack) - struct obstack *obstack; -{ - return obstack_next_free (obstack); -} - -int (obstack_object_size) (obstack) - struct obstack *obstack; -{ - return obstack_object_size (obstack); -} - -int (obstack_room) (obstack) - struct obstack *obstack; -{ - return obstack_room (obstack); -} - -int (obstack_make_room) (obstack, length) - struct obstack *obstack; - int length; -{ - return obstack_make_room (obstack, length); + exit (__obstack_exit_failure); } -void (obstack_grow) (obstack, data, length) - struct obstack *obstack; - const POINTER data; - int length; -{ - obstack_grow (obstack, data, length); -} - -void (obstack_grow0) (obstack, data, length) - struct obstack *obstack; - const POINTER data; - int length; -{ - obstack_grow0 (obstack, data, length); -} - -void (obstack_1grow) (obstack, character) - struct obstack *obstack; - int character; -{ - obstack_1grow (obstack, character); -} - -void (obstack_blank) (obstack, length) - struct obstack *obstack; - int length; -{ - obstack_blank (obstack, length); -} - -void (obstack_1grow_fast) (obstack, character) - struct obstack *obstack; - int character; -{ - obstack_1grow_fast (obstack, character); -} - -void (obstack_blank_fast) (obstack, length) - struct obstack *obstack; - int length; -{ - obstack_blank_fast (obstack, length); -} - -POINTER (obstack_finish) (obstack) - struct obstack *obstack; -{ - return obstack_finish (obstack); -} - -POINTER (obstack_alloc) (obstack, length) - struct obstack *obstack; - int length; -{ - return obstack_alloc (obstack, length); -} - -POINTER (obstack_copy) (obstack, address, length) - struct obstack *obstack; - const POINTER address; - int length; -{ - return obstack_copy (obstack, address, length); -} - -POINTER (obstack_copy0) (obstack, address, length) - struct obstack *obstack; - const POINTER address; - int length; -{ - return obstack_copy0 (obstack, address, length); -} - -# endif /* __STDC__ */ - -# endif /* 0 */ - #endif /* !ELIDE_CODE */ diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 0883259bd..c963eae1f 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -75,7 +75,7 @@ static int direxists (const char *dir) int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx /*, int try_tmpdir*/) { - //const char *d; + /*const char *d; */ size_t dlen, plen; if (!pfx || !pfx[0]) diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index 858a02c33..6df88a7f4 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -108,7 +108,7 @@ libc_hidden_proto(__C_ctype_toupper) #ifdef __UCLIBC_HAS_XLOCALE__ #include <xlocale.h> #include <locale.h> -#else /* __UCLIBC_HAS_XLOCALE__ */ +#else /* __UCLIBC_HAS_XLOCALE__ */ /* We need this internally... */ #define __UCLIBC_HAS_XLOCALE__ 1 #include <xlocale.h> @@ -120,14 +120,14 @@ libc_hidden_proto(__C_ctype_toupper) #define LOCALE_NAMES (__locale_mmap->locale_names5) #define LOCALES (__locale_mmap->locales) -#define LOCALE_AT_MODIFIERS (__locale_mmap->locale_at_modifiers) +#define LOCALE_AT_MODIFIERS (__locale_mmap->locale_at_modifiers) #define CATEGORY_NAMES (__locale_mmap->lc_names) #ifdef __UCLIBC_MJN3_ONLY__ #warning REMINDER: redo the MAX_LOCALE_STR stuff... #endif -#define MAX_LOCALE_STR 256 /* TODO: Only sufficient for current case. */ -#define MAX_LOCALE_CATEGORY_STR 32 /* TODO: Only sufficient for current case. */ +#define MAX_LOCALE_STR 256 /* TODO: Only sufficient for current case. */ +#define MAX_LOCALE_CATEGORY_STR 32 /* TODO: Only sufficient for current case. */ /* Note: Best if MAX_LOCALE_CATEGORY_STR is a power of 2. */ extern int _locale_set_l(const unsigned char *p, __locale_t base) attribute_hidden; @@ -169,7 +169,7 @@ char *setlocale(int category, register const char *locale) : NULL; } -#else /* ---------------------------------------------- __LOCALE_C_ONLY */ +#else /* ---------------------------------------------- __LOCALE_C_ONLY */ #ifdef __UCLIBC_HAS_THREADS__ link_warning(setlocale,"REMINDER: The 'setlocale' function is _not_ threadsafe except for simple queries.") @@ -267,7 +267,7 @@ static void update_hr_locale(const unsigned char *spec) } s += 2; } while (++i < category); - *--n = 0; /* Remove trailing ';' and nul-terminate. */ + *--n = 0; /* Remove trailing ';' and nul-terminate. */ ++category; } while (!done); @@ -332,7 +332,7 @@ struct lconv *localeconv(void) return &the_lconv; } -#else /* __LOCALE_C_ONLY */ +#else /* __LOCALE_C_ONLY */ static struct lconv the_lconv; @@ -609,7 +609,7 @@ int attribute_hidden _locale_set_l(const unsigned char *p, __locale_t base) if ((p[2*LC_COLLATE] != s[2*LC_COLLATE]) || (p[2*LC_COLLATE + 1] != s[2*LC_COLLATE + 1]) ) { - row = (((int)(*p & 0x7f)) << 7) + (p[1] & 0x7f); + row = (((int)(*p & 0x7f)) << 7) + (p[1] & 0x7f); assert(row < __LOCALE_DATA_NUM_LOCALES); if (!init_cur_collate(__locale_mmap->locales[ __LOCALE_DATA_WIDTH_LOCALES * row + 3 + LC_COLLATE ], @@ -623,7 +623,7 @@ int attribute_hidden _locale_set_l(const unsigned char *p, __locale_t base) do { if ((*p != *s) || (p[1] != s[1])) { - row = (((int)(*p & 0x7f)) << 7) + (p[1] & 0x7f); + row = (((int)(*p & 0x7f)) << 7) + (p[1] & 0x7f); assert(row < __LOCALE_DATA_NUM_LOCALES); *s = *p; @@ -789,7 +789,7 @@ int attribute_hidden _locale_set_l(const unsigned char *p, __locale_t base) + __UCLIBC_CTYPE_TO_TBL_OFFSET; base->__ctype_toupper = base->__ctype_toupper_data + __UCLIBC_CTYPE_TO_TBL_OFFSET; -#else /* __UCLIBC_HAS_XLOCALE__ */ +#else /* __UCLIBC_HAS_XLOCALE__ */ __ctype_b = base->__ctype_b_data + __UCLIBC_CTYPE_B_TBL_OFFSET; __ctype_tolower = base->__ctype_tolower_data @@ -889,7 +889,7 @@ void attribute_hidden _locale_init_l(__locale_t base) #ifdef __CTYPE_HAS_8_BIT_LOCALES base->tbl8ctype = (const unsigned char *) &__locale_mmap->tbl8ctype; - base->tbl8uplow + base->tbl8uplow = (const unsigned char *) &__locale_mmap->tbl8uplow; #ifdef __UCLIBC_HAS_WCHAR__ base->tbl8c2wc @@ -917,7 +917,7 @@ void attribute_hidden _locale_init_l(__locale_t base) base->__ctype_b = __C_ctype_b; base->__ctype_tolower = __C_ctype_tolower; base->__ctype_toupper = __C_ctype_toupper; -#else /* __UCLIBC_HAS_XLOCALE__ */ +#else /* __UCLIBC_HAS_XLOCALE__ */ __ctype_b = __C_ctype_b; __ctype_tolower = __C_ctype_tolower; __ctype_toupper = __C_ctype_toupper; @@ -967,7 +967,7 @@ void _locale_init(void) static const unsigned char nl_data[C_LC_ALL + 1 + 90 + 320] = { /* static const char cat_start[LC_ALL + 1] = { */ - '\x00', '\x0b', '\x0e', '\x24', '\x56', '\x56', '\x5a', + '\x00', '\x0b', '\x0e', '\x24', '\x56', '\x56', '\x5a', /* }; */ /* static const char item_offset[90] = { */ '\x00', '\x02', '\x04', '\x06', '\x08', '\x0a', '\x0c', '\x0e', @@ -1042,7 +1042,7 @@ char *nl_langinfo(nl_item item) } libc_hidden_def(nl_langinfo) -#else /* __LOCALE_C_ONLY */ +#else /* __LOCALE_C_ONLY */ #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) @@ -1056,13 +1056,13 @@ char *nl_langinfo(nl_item item) } libc_hidden_def(nl_langinfo) -#else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ +#else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ libc_hidden_proto(__XL_NPP(nl_langinfo)) static const char empty[] = ""; -char *__XL_NPP(nl_langinfo)(nl_item item __LOCALE_PARAM ) +char *__XL_NPP(nl_langinfo)(nl_item item __LOCALE_PARAM ) { unsigned int c = _NL_ITEM_CATEGORY(item); unsigned int i = _NL_ITEM_INDEX(item); @@ -1253,7 +1253,7 @@ __locale_t newlocale(int category_mask, const char *locale, __locale_t base) if (!locale || (((unsigned int)(category_mask)) > LC_ALL_MASK)) { INVALID: __set_errno(EINVAL); - return NULL; /* No locale or illegal/unsupported category. */ + return NULL; /* No locale or illegal/unsupported category. */ } #ifdef __UCLIBC_MJN3_ONLY__ @@ -1264,7 +1264,7 @@ __locale_t newlocale(int category_mask, const char *locale, __locale_t base) if (!*locale) { /* locale == "", so check environment. */ #ifndef __UCLIBC_HAS_THREADS__ - static /* If no threads, then envstr can be static. */ + static /* If no threads, then envstr can be static. */ #endif /* __UCLIBC_HAS_THREADS__ */ const char *envstr[4] = { "LC_ALL", NULL, "LANG", posix }; @@ -1416,7 +1416,7 @@ libc_hidden_def(uselocale) __locale_t weak_const_function __curlocale(void) { - return __curlocale_var; /* This is overriden by the thread version. */ + return __curlocale_var; /* This is overriden by the thread version. */ } __locale_t weak_function __curlocale_set(__locale_t newloc) diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c index f4220784a..4d23aef00 100644 --- a/libc/misc/mntent/mntent.c +++ b/libc/misc/mntent/mntent.c @@ -30,8 +30,9 @@ libc_hidden_proto(fprintf) struct mntent *getmntent_r (FILE *filep, struct mntent *mnt, char *buff, int bufsize) { + static const char sep[] = " \t\n"; + char *cp, *ptrptr; - const char *sep = " \t\n"; if (!filep || !mnt || !buff) return NULL; diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index f56c56bf9..a8a8cc79a 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -58,14 +58,6 @@ libc_hidden_proto(abort) # include <config.h> #endif -#ifndef PARAMS -# if defined __GNUC__ || (defined __STDC__ && __STDC__) -# define PARAMS(args) args -# else -# define PARAMS(args) () -# endif /* GCC. */ -#endif /* Not PARAMS. */ - #ifndef INSIDE_RECURSION # if defined STDC_HEADERS && !defined emacs @@ -309,10 +301,10 @@ extern char *re_syntax_table; static char re_syntax_table[CHAR_SET_SIZE]; -static void init_syntax_once PARAMS ((void)); +static void init_syntax_once (void); static void -init_syntax_once () +init_syntax_once (void) { register int c; static int done = 0; @@ -443,30 +435,30 @@ typedef char boolean; # define false 0 # define true 1 -static reg_errcode_t byte_regex_compile _RE_ARGS ((const char *pattern, size_t size, +static reg_errcode_t byte_regex_compile (const char *pattern, size_t size, reg_syntax_t syntax, - struct re_pattern_buffer *bufp)); + struct re_pattern_buffer *bufp); -static int byte_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp, +static int byte_re_match_2_internal (struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int pos, struct re_registers *regs, - int stop)); -static int byte_re_search_2 PARAMS ((struct re_pattern_buffer *bufp, + int stop); +static int byte_re_search_2 (struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int startpos, int range, - struct re_registers *regs, int stop)); -static int byte_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp)); + struct re_registers *regs, int stop); +static int byte_re_compile_fastmap (struct re_pattern_buffer *bufp); #ifdef MBS_SUPPORT -static reg_errcode_t wcs_regex_compile _RE_ARGS ((const char *pattern, size_t size, +static reg_errcode_t wcs_regex_compile (const char *pattern, size_t size, reg_syntax_t syntax, - struct re_pattern_buffer *bufp)); + struct re_pattern_buffer *bufp); -static int wcs_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp, +static int wcs_re_match_2_internal (struct re_pattern_buffer *bufp, const char *cstring1, int csize1, const char *cstring2, int csize2, int pos, @@ -474,13 +466,13 @@ static int wcs_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp, int stop, wchar_t *string1, int size1, wchar_t *string2, int size2, - int *mbs_offset1, int *mbs_offset2)); -static int wcs_re_search_2 PARAMS ((struct re_pattern_buffer *bufp, + int *mbs_offset1, int *mbs_offset2); +static int wcs_re_search_2 (struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int startpos, int range, - struct re_registers *regs, int stop)); -static int wcs_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp)); + struct re_registers *regs, int stop); +static int wcs_re_compile_fastmap (struct re_pattern_buffer *bufp); #endif /* These are the command codes that appear in compiled regular @@ -726,11 +718,7 @@ typedef enum # endif # ifdef DEBUG -static void PREFIX(extract_number) _RE_ARGS ((int *dest, UCHAR_T *source)); -static void -PREFIX(extract_number) (dest, source) - int *dest; - UCHAR_T *source; +static void PREFIX(extract_number) (int *dest, UCHAR_T *source) { # ifdef WCHAR *dest = *source; @@ -758,12 +746,8 @@ PREFIX(extract_number) (dest, source) } while (0) # ifdef DEBUG -static void PREFIX(extract_number_and_incr) _RE_ARGS ((int *destination, - UCHAR_T **source)); -static void -PREFIX(extract_number_and_incr) (destination, source) - int *destination; - UCHAR_T **source; +static void PREFIX(extract_number_and_incr) (int *destination, + UCHAR_T **source) { PREFIX(extract_number) (destination, *source); *source += OFFSET_ADDRESS_SIZE; @@ -814,8 +798,7 @@ static smallint debug; # ifndef DEFINED_ONCE void -print_fastmap (fastmap) - char *fastmap; +print_fastmap (char *fastmap) { unsigned was_a_range = 0; unsigned i = 0; @@ -847,9 +830,7 @@ print_fastmap (fastmap) the START pointer into it and ending just before the pointer END. */ void -PREFIX(print_partial_compiled_pattern) (start, end) - UCHAR_T *start; - UCHAR_T *end; +PREFIX(print_partial_compiled_pattern) (UCHAR_T *start, UCHAR_T *end) { int mcnt, mcnt2; UCHAR_T *p1; @@ -1182,8 +1163,7 @@ PREFIX(print_partial_compiled_pattern) (start, end) void -PREFIX(print_compiled_pattern) (bufp) - struct re_pattern_buffer *bufp; +PREFIX(print_compiled_pattern) (struct re_pattern_buffer *bufp) { UCHAR_T *buffer = (UCHAR_T*) bufp->buffer; @@ -1215,12 +1195,12 @@ PREFIX(print_compiled_pattern) (bufp) void -PREFIX(print_double_string) (where, string1, size1, string2, size2) - const CHAR_T *where; - const CHAR_T *string1; - const CHAR_T *string2; - int size1; - int size2; +PREFIX(print_double_string) ( + const CHAR_T *where, + const CHAR_T *string1, + int size1, + const CHAR_T *string2, + int size2) { int this_char; @@ -1253,8 +1233,7 @@ PREFIX(print_double_string) (where, string1, size1, string2, size2) # ifndef DEFINED_ONCE void -printchar (c) - int c; +printchar (int c) { putc (c, stderr); } @@ -1287,14 +1266,11 @@ printchar (c) We assume offset_buffer and is_binary is already allocated enough space. */ -static size_t convert_mbs_to_wcs (CHAR_T *dest, const unsigned char* src, - size_t len, int *offset_buffer, - char *is_binary); static size_t -convert_mbs_to_wcs (dest, src, len, offset_buffer, is_binary) - CHAR_T *dest; - const unsigned char* src; - size_t len; /* the length of multibyte string. */ +convert_mbs_to_wcs ( + CHAR_T *dest, + const unsigned char* src, + size_t len, /* the length of multibyte string. */ /* It hold correspondances between src(char string) and dest(wchar_t string) for optimization. @@ -1305,8 +1281,8 @@ convert_mbs_to_wcs (dest, src, len, offset_buffer, is_binary) offset_buffer = {0, 0+3("xxx"), 0+3+1("y"), 0+3+1+2("zz")} = {0, 3, 4, 6} */ - int *offset_buffer; - char *is_binary; + int *offset_buffer, + char *is_binary) { wchar_t *pdest = dest; const unsigned char *psrc = src; @@ -1377,8 +1353,7 @@ reg_syntax_t re_syntax_options; defined in regex.h. We return the old syntax. */ reg_syntax_t -re_set_syntax (syntax) - reg_syntax_t syntax; +re_set_syntax (reg_syntax_t syntax) { reg_syntax_t ret = re_syntax_options; @@ -1951,35 +1926,35 @@ static CHAR_T PREFIX(reg_unset_dummy); # define REG_UNSET(e) ((e) == REG_UNSET_VALUE) /* Subroutine declarations and macros for regex_compile. */ -static void PREFIX(store_op1) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc, int arg)); -static void PREFIX(store_op2) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc, - int arg1, int arg2)); -static void PREFIX(insert_op1) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc, - int arg, UCHAR_T *end)); -static void PREFIX(insert_op2) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc, - int arg1, int arg2, UCHAR_T *end)); -static boolean PREFIX(at_begline_loc_p) _RE_ARGS ((const CHAR_T *pattern, +static void PREFIX(store_op1) (re_opcode_t op, UCHAR_T *loc, int arg); +static void PREFIX(store_op2) (re_opcode_t op, UCHAR_T *loc, + int arg1, int arg2); +static void PREFIX(insert_op1) (re_opcode_t op, UCHAR_T *loc, + int arg, UCHAR_T *end); +static void PREFIX(insert_op2) (re_opcode_t op, UCHAR_T *loc, + int arg1, int arg2, UCHAR_T *end); +static boolean PREFIX(at_begline_loc_p) (const CHAR_T *pattern, const CHAR_T *p, - reg_syntax_t syntax)); -static boolean PREFIX(at_endline_loc_p) _RE_ARGS ((const CHAR_T *p, + reg_syntax_t syntax); +static boolean PREFIX(at_endline_loc_p) (const CHAR_T *p, const CHAR_T *pend, - reg_syntax_t syntax)); + reg_syntax_t syntax); # ifdef WCHAR -static reg_errcode_t wcs_compile_range _RE_ARGS ((CHAR_T range_start, +static reg_errcode_t wcs_compile_range (CHAR_T range_start, const CHAR_T **p_ptr, const CHAR_T *pend, char *translate, reg_syntax_t syntax, UCHAR_T *b, - CHAR_T *char_set)); -static void insert_space _RE_ARGS ((int num, CHAR_T *loc, CHAR_T *end)); + CHAR_T *char_set); +static void insert_space (int num, CHAR_T *loc, CHAR_T *end); # else /* BYTE */ -static reg_errcode_t byte_compile_range _RE_ARGS ((unsigned int range_start, +static reg_errcode_t byte_compile_range (unsigned int range_start, const char **p_ptr, const char *pend, char *translate, reg_syntax_t syntax, - unsigned char *b)); + unsigned char *b); # endif /* WCHAR */ /* Fetch the next character in the uncompiled pattern---translating it @@ -2337,8 +2312,7 @@ static PREFIX(register_info_type) *PREFIX(reg_info_dummy); but don't make them smaller. */ static void -PREFIX(regex_grow_registers) (num_regs) - int num_regs; +PREFIX(regex_grow_registers) (int num_regs) { if (num_regs > regs_allocated_size) { @@ -2359,9 +2333,9 @@ PREFIX(regex_grow_registers) (num_regs) # endif /* not MATCH_MAY_ALLOCATE */ # ifndef DEFINED_ONCE -static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type +static boolean group_in_compile_stack (compile_stack_type compile_stack, - regnum_t regnum)); + regnum_t regnum); # endif /* not DEFINED_ONCE */ /* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX. @@ -2392,11 +2366,11 @@ static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type # endif /* WCHAR */ static reg_errcode_t -PREFIX(regex_compile) (ARG_PREFIX(pattern), ARG_PREFIX(size), syntax, bufp) - const char *ARG_PREFIX(pattern); - size_t ARG_PREFIX(size); - reg_syntax_t syntax; - struct re_pattern_buffer *bufp; +PREFIX(regex_compile) ( + const char *ARG_PREFIX(pattern), + size_t ARG_PREFIX(size), + reg_syntax_t syntax, + struct re_pattern_buffer *bufp) { /* We fetch characters from PATTERN here. Even though PATTERN is `char *' (i.e., signed), we declare these variables as unsigned, so @@ -4345,10 +4319,10 @@ PREFIX(regex_compile) (ARG_PREFIX(pattern), ARG_PREFIX(size), syntax, bufp) /* ifdef WCHAR, integer parameter is 1 wchar_t. */ static void -PREFIX(store_op1) (op, loc, arg) - re_opcode_t op; - UCHAR_T *loc; - int arg; +PREFIX(store_op1) ( + re_opcode_t op, + UCHAR_T *loc, + int arg) { *loc = (UCHAR_T) op; STORE_NUMBER (loc + 1, arg); @@ -4359,10 +4333,10 @@ PREFIX(store_op1) (op, loc, arg) /* ifdef WCHAR, integer parameter is 1 wchar_t. */ static void -PREFIX(store_op2) (op, loc, arg1, arg2) - re_opcode_t op; - UCHAR_T *loc; - int arg1, arg2; +PREFIX(store_op2) ( + re_opcode_t op, + UCHAR_T *loc, + int arg1, int arg2) { *loc = (UCHAR_T) op; STORE_NUMBER (loc + 1, arg1); @@ -4375,11 +4349,11 @@ PREFIX(store_op2) (op, loc, arg1, arg2) /* ifdef WCHAR, integer parameter is 1 wchar_t. */ static void -PREFIX(insert_op1) (op, loc, arg, end) - re_opcode_t op; - UCHAR_T *loc; - int arg; - UCHAR_T *end; +PREFIX(insert_op1) ( + re_opcode_t op, + UCHAR_T *loc, + int arg, + UCHAR_T *end) { register UCHAR_T *pfrom = end; register UCHAR_T *pto = end + 1 + OFFSET_ADDRESS_SIZE; @@ -4395,11 +4369,11 @@ PREFIX(insert_op1) (op, loc, arg, end) /* ifdef WCHAR, integer parameter is 1 wchar_t. */ static void -PREFIX(insert_op2) (op, loc, arg1, arg2, end) - re_opcode_t op; - UCHAR_T *loc; - int arg1, arg2; - UCHAR_T *end; +PREFIX(insert_op2) ( + re_opcode_t op, + UCHAR_T *loc, + int arg1, int arg2, + UCHAR_T *end) { register UCHAR_T *pfrom = end; register UCHAR_T *pto = end + 1 + 2 * OFFSET_ADDRESS_SIZE; @@ -4416,9 +4390,9 @@ PREFIX(insert_op2) (op, loc, arg1, arg2, end) least one character before the ^. */ static boolean -PREFIX(at_begline_loc_p) (pattern, p, syntax) - const CHAR_T *pattern, *p; - reg_syntax_t syntax; +PREFIX(at_begline_loc_p) ( + const CHAR_T *pattern, const CHAR_T *p, + reg_syntax_t syntax) { const CHAR_T *prev = p - 2; boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\'; @@ -4435,9 +4409,9 @@ PREFIX(at_begline_loc_p) (pattern, p, syntax) at least one character after the $, i.e., `P < PEND'. */ static boolean -PREFIX(at_endline_loc_p) (p, pend, syntax) - const CHAR_T *p, *pend; - reg_syntax_t syntax; +PREFIX(at_endline_loc_p) ( + const CHAR_T *p, const CHAR_T *pend, + reg_syntax_t syntax) { const CHAR_T *next = p; boolean next_backslash = *next == '\\'; @@ -4458,9 +4432,9 @@ PREFIX(at_endline_loc_p) (p, pend, syntax) false if it's not. */ static boolean -group_in_compile_stack (compile_stack, regnum) - compile_stack_type compile_stack; - regnum_t regnum; +group_in_compile_stack ( + compile_stack_type compile_stack, + regnum_t regnum) { int this_element; @@ -4480,10 +4454,10 @@ group_in_compile_stack (compile_stack, regnum) /* This insert space, which size is "num", into the pattern at "loc". "end" must point the end of the allocated buffer. */ static void -insert_space (num, loc, end) - int num; - CHAR_T *loc; - CHAR_T *end; +insert_space ( + int num, + CHAR_T *loc, + CHAR_T *end) { register CHAR_T *pto = end; register CHAR_T *pfrom = end - num; @@ -4495,13 +4469,12 @@ insert_space (num, loc, end) #ifdef WCHAR static reg_errcode_t -wcs_compile_range (range_start_char, p_ptr, pend, translate, syntax, b, - char_set) - CHAR_T range_start_char; - const CHAR_T **p_ptr, *pend; - CHAR_T *char_set, *b; - RE_TRANSLATE_TYPE translate; - reg_syntax_t syntax; +wcs_compile_range ( + CHAR_T range_start_char, + const CHAR_T **p_ptr, const CHAR_T *pend, + RE_TRANSLATE_TYPE translate, + reg_syntax_t syntax, + CHAR_T *b, CHAR_T *char_set) { const CHAR_T *p = *p_ptr; CHAR_T range_start, range_end; @@ -4582,12 +4555,12 @@ wcs_compile_range (range_start_char, p_ptr, pend, translate, syntax, b, `regex_compile' itself. */ static reg_errcode_t -byte_compile_range (range_start_char, p_ptr, pend, translate, syntax, b) - unsigned int range_start_char; - const char **p_ptr, *pend; - RE_TRANSLATE_TYPE translate; - reg_syntax_t syntax; - unsigned char *b; +byte_compile_range ( + unsigned int range_start_char, + const char **p_ptr, const char *pend, + RE_TRANSLATE_TYPE translate, + reg_syntax_t syntax, + unsigned char *b) { unsigned this_char; const char *p = *p_ptr; @@ -4665,11 +4638,7 @@ byte_compile_range (range_start_char, p_ptr, pend, translate, syntax, b) #ifdef WCHAR /* local function for re_compile_fastmap. truncate wchar_t character to char. */ -static unsigned char truncate_wchar (CHAR_T c); - -static unsigned char -truncate_wchar (c) - CHAR_T c; +static unsigned char truncate_wchar (CHAR_T c) { unsigned char buf[MB_CUR_MAX]; mbstate_t state; @@ -4685,8 +4654,7 @@ truncate_wchar (c) #endif /* WCHAR */ static int -PREFIX(re_compile_fastmap) (bufp) - struct re_pattern_buffer *bufp; +PREFIX(re_compile_fastmap) (struct re_pattern_buffer *bufp) { int j, k; #ifdef MATCH_MAY_ALLOCATE @@ -5005,8 +4973,7 @@ PREFIX(re_compile_fastmap) (bufp) #else /* not INSIDE_RECURSION */ int -re_compile_fastmap (bufp) - struct re_pattern_buffer *bufp; +re_compile_fastmap (struct re_pattern_buffer *bufp) { # ifdef MBS_SUPPORT if (MB_CUR_MAX != 1) @@ -5034,11 +5001,11 @@ strong_alias(__re_compile_fastmap, re_compile_fastmap) freeing the old data. */ void -re_set_registers (bufp, regs, num_regs, starts, ends) - struct re_pattern_buffer *bufp; - struct re_registers *regs; - unsigned num_regs; - regoff_t *starts, *ends; +re_set_registers ( + struct re_pattern_buffer *bufp, + struct re_registers *regs, + unsigned num_regs, + regoff_t *starts, regoff_t *ends) { if (num_regs) { @@ -5064,11 +5031,11 @@ strong_alias(__re_set_registers, re_set_registers) doesn't let you say where to stop matching. */ int -re_search (bufp, string, size, startpos, range, regs) - struct re_pattern_buffer *bufp; - const char *string; - int size, startpos, range; - struct re_registers *regs; +re_search ( + struct re_pattern_buffer *bufp, + const char *string, + int size, int startpos, int range, + struct re_registers *regs) { return re_search_2 (bufp, NULL, 0, string, size, startpos, range, regs, size); @@ -5100,14 +5067,14 @@ strong_alias(__re_search, re_search) stack overflow). */ int -re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int size1, size2; - int startpos; - int range; - struct re_registers *regs; - int stop; +re_search_2 ( + struct re_pattern_buffer *bufp, + const char *string1, int size1, + const char *string2, int size2, + int startpos, + int range, + struct re_registers *regs, + int stop) { # ifdef MBS_SUPPORT if (MB_CUR_MAX != 1) @@ -5163,15 +5130,14 @@ strong_alias(__re_search_2, re_search_2) static int -PREFIX(re_search_2) (bufp, string1, size1, string2, size2, startpos, range, - regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int size1, size2; - int startpos; - int range; - struct re_registers *regs; - int stop; +PREFIX(re_search_2) ( + struct re_pattern_buffer *bufp, + const char *string1, int size1, + const char *string2, int size2, + int startpos, + int range, + struct re_registers *regs, + int stop) { int val; register char *fastmap = bufp->fastmap; @@ -5554,11 +5520,11 @@ PREFIX(re_search_2) (bufp, string1, size1, string2, size2, startpos, range, /* re_match is like re_match_2 except it takes only a single string. */ int -re_match (bufp, string, size, pos, regs) - struct re_pattern_buffer *bufp; - const char *string; - int size, pos; - struct re_registers *regs; +re_match ( + struct re_pattern_buffer *bufp, + const char *string, + int size, int pos, + struct re_registers *regs) { int result; # ifdef MBS_SUPPORT @@ -5585,17 +5551,17 @@ strong_alias(__re_match, re_match) #endif /* not INSIDE_RECURSION */ #ifdef INSIDE_RECURSION -static boolean PREFIX(group_match_null_string_p) _RE_ARGS ((UCHAR_T **p, +static boolean PREFIX(group_match_null_string_p) (UCHAR_T **p, UCHAR_T *end, - PREFIX(register_info_type) *reg_info)); -static boolean PREFIX(alt_match_null_string_p) _RE_ARGS ((UCHAR_T *p, + PREFIX(register_info_type) *reg_info); +static boolean PREFIX(alt_match_null_string_p) (UCHAR_T *p, UCHAR_T *end, - PREFIX(register_info_type) *reg_info)); -static boolean PREFIX(common_op_match_null_string_p) _RE_ARGS ((UCHAR_T **p, + PREFIX(register_info_type) *reg_info); +static boolean PREFIX(common_op_match_null_string_p) (UCHAR_T **p, UCHAR_T *end, - PREFIX(register_info_type) *reg_info)); -static int PREFIX(bcmp_translate) _RE_ARGS ((const CHAR_T *s1, const CHAR_T *s2, - int len, char *translate)); + PREFIX(register_info_type) *reg_info); +static int PREFIX(bcmp_translate) (const CHAR_T *s1, const CHAR_T *s2, + int len, char *translate); #else /* not INSIDE_RECURSION */ /* re_match_2 matches the compiled pattern in BUFP against the @@ -5612,13 +5578,13 @@ static int PREFIX(bcmp_translate) _RE_ARGS ((const CHAR_T *s1, const CHAR_T *s2, matched substring. */ int -re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int size1, size2; - int pos; - struct re_registers *regs; - int stop; +re_match_2 ( + struct re_pattern_buffer *bufp, + const char *string1, int size1, + const char *string2, int size2, + int pos, + struct re_registers *regs, + int stop) { int result; # ifdef MBS_SUPPORT @@ -5647,7 +5613,7 @@ strong_alias(__re_match_2, re_match_2) #ifdef INSIDE_RECURSION #ifdef WCHAR -static int count_mbs_length PARAMS ((int *, int)); +static int count_mbs_length (int *, int); /* This check the substring (from 0, to length) of the multibyte string, to which offset_buffer correspond. And count how many wchar_t_characters @@ -5655,9 +5621,9 @@ static int count_mbs_length PARAMS ((int *, int)); See convert_mbs_to_wcs. */ static int -count_mbs_length(offset_buffer, length) - int *offset_buffer; - int length; +count_mbs_length( + int *offset_buffer, + int length) { int upper, lower; @@ -5698,33 +5664,30 @@ count_mbs_length(offset_buffer, length) afterwards. */ #ifdef WCHAR static int -wcs_re_match_2_internal (bufp, cstring1, csize1, cstring2, csize2, pos, - regs, stop, string1, size1, string2, size2, - mbs_offset1, mbs_offset2) - struct re_pattern_buffer *bufp; - const char *cstring1, *cstring2; - int csize1, csize2; - int pos; - struct re_registers *regs; - int stop; +wcs_re_match_2_internal ( + struct re_pattern_buffer *bufp, + const char *cstring1, int csize1, + const char *cstring2, int csize2, + int pos, + struct re_registers *regs, + int stop, /* string1 == string2 == NULL means string1/2, size1/2 and mbs_offset1/2 need seting up in this function. */ /* We need wchar_t* buffers correspond to cstring1, cstring2. */ - wchar_t *string1, *string2; /* We need the size of wchar_t buffers correspond to csize1, csize2. */ - int size1, size2; + wchar_t *string1, int size1, + wchar_t *string2, int size2, /* offset buffer for optimization. See convert_mbs_to_wc. */ - int *mbs_offset1, *mbs_offset2; + int *mbs_offset1, int *mbs_offset2) #else /* BYTE */ static int -byte_re_match_2_internal (bufp, string1, size1,string2, size2, pos, - regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int size1, size2; - int pos; - struct re_registers *regs; - int stop; +byte_re_match_2_internal ( + struct re_pattern_buffer *bufp, + const char *string1, int size1, + const char *string2, int size2, + int pos, + struct re_registers *regs, + int stop) #endif /* BYTE */ { /* General temporaries. */ @@ -7674,9 +7637,9 @@ byte_re_match_2_internal (bufp, string1, size1,string2, size2, pos, We don't handle duplicates properly (yet). */ static boolean -PREFIX(group_match_null_string_p) (p, end, reg_info) - UCHAR_T **p, *end; - PREFIX(register_info_type) *reg_info; +PREFIX(group_match_null_string_p) ( + UCHAR_T **p, UCHAR_T *end, + PREFIX(register_info_type) *reg_info) { int mcnt; /* Point to after the args to the start_memory. */ @@ -7786,9 +7749,9 @@ PREFIX(group_match_null_string_p) (p, end, reg_info) byte past the last. The alternative can contain groups. */ static boolean -PREFIX(alt_match_null_string_p) (p, end, reg_info) - UCHAR_T *p, *end; - PREFIX(register_info_type) *reg_info; +PREFIX(alt_match_null_string_p) ( + UCHAR_T *p, UCHAR_T *end, + PREFIX(register_info_type) *reg_info) { int mcnt; UCHAR_T *p1 = p; @@ -7823,9 +7786,9 @@ PREFIX(alt_match_null_string_p) (p, end, reg_info) Sets P to one after the op and its arguments, if any. */ static boolean -PREFIX(common_op_match_null_string_p) (p, end, reg_info) - UCHAR_T **p, *end; - PREFIX(register_info_type) *reg_info; +PREFIX(common_op_match_null_string_p) ( + UCHAR_T **p, UCHAR_T *end, + PREFIX(register_info_type) *reg_info) { int mcnt; boolean ret; @@ -7911,10 +7874,10 @@ PREFIX(common_op_match_null_string_p) (p, end, reg_info) bytes; nonzero otherwise. */ static int -PREFIX(bcmp_translate) (s1, s2, len, translate) - const CHAR_T *s1, *s2; - register int len; - RE_TRANSLATE_TYPE translate; +PREFIX(bcmp_translate) ( + const CHAR_T *s1, const CHAR_T *s2, + register int len, + RE_TRANSLATE_TYPE translate) { register const UCHAR_T *p1 = (const UCHAR_T *) s1; register const UCHAR_T *p2 = (const UCHAR_T *) s2; @@ -7947,10 +7910,10 @@ PREFIX(bcmp_translate) (s1, s2, len, translate) We call regex_compile to do the actual compilation. */ const char * -re_compile_pattern (pattern, length, bufp) - const char *pattern; - size_t length; - struct re_pattern_buffer *bufp; +re_compile_pattern ( + const char *pattern, + size_t length, + struct re_pattern_buffer *bufp) { reg_errcode_t ret; @@ -7996,8 +7959,7 @@ char * regcomp/regexec below without link errors. */ weak_function #endif -re_comp (s) - const char *s; +re_comp (const char *s) { reg_errcode_t ret; @@ -8047,8 +8009,7 @@ int #if defined _LIBC || defined __UCLIBC__ weak_function #endif -re_exec (s) - const char *s; +re_exec (const char *s) { const int len = strlen (s); return @@ -8097,10 +8058,10 @@ re_exec (s) the return codes and their meanings.) */ int -regcomp (preg, pattern, cflags) - regex_t *preg; - const char *pattern; - int cflags; +regcomp ( + regex_t *preg, + const char *pattern, + int cflags) { reg_errcode_t ret; reg_syntax_t syntax @@ -8193,12 +8154,12 @@ strong_alias(__regcomp, regcomp) We return 0 if we find a match and REG_NOMATCH if not. */ int -regexec (preg, string, nmatch, pmatch, eflags) - const regex_t *preg; - const char *string; - size_t nmatch; - regmatch_t pmatch[]; - int eflags; +regexec ( + const regex_t *preg, + const char *string, + size_t nmatch, + regmatch_t pmatch[], + int eflags) { int ret; struct re_registers regs; @@ -8260,11 +8221,11 @@ strong_alias(__regexec, regexec) from either regcomp or regexec. We don't use PREG here. */ size_t -regerror (errcode, preg, errbuf, errbuf_size) - int errcode; - const regex_t *preg; - char *errbuf; - size_t errbuf_size; +regerror ( + int errcode, + const regex_t *preg, + char *errbuf, + size_t errbuf_size) { const char *msg; size_t msg_size; @@ -8307,8 +8268,7 @@ strong_alias(__regerror, regerror) /* Free dynamically allocated space used by PREG. */ void -regfree (preg) - regex_t *preg; +regfree (regex_t *preg) { free (preg->buffer); preg->buffer = NULL; diff --git a/libc/misc/search/_lsearch.c b/libc/misc/search/_lsearch.c index e91ea9441..e446489ed 100644 --- a/libc/misc/search/_lsearch.c +++ b/libc/misc/search/_lsearch.c @@ -22,7 +22,7 @@ void *lfind(const void *key, const void *base, size_t *nmemb, register int n = *nmemb; while (n--) { - if ((*compar) (base, key) == 0) + if ((*compar) (key, base) == 0) return ((void*)base); base += size; } diff --git a/libc/misc/statfs/fstatfs64.c b/libc/misc/statfs/fstatfs64.c index a7f94b125..dfd027941 100644 --- a/libc/misc/statfs/fstatfs64.c +++ b/libc/misc/statfs/fstatfs64.c @@ -26,7 +26,8 @@ #include <stddef.h> /* Experimentally off - libc_hidden_proto(memcpy) */ -libc_hidden_proto(fstatfs) +extern __typeof(fstatfs) __libc_fstatfs; +libc_hidden_proto(__libc_fstatfs) /* Return information about the filesystem on which FD resides. */ libc_hidden_proto(fstatfs64) @@ -34,7 +35,7 @@ int fstatfs64 (int fd, struct statfs64 *buf) { struct statfs buf32; - if (fstatfs (fd, &buf32) < 0) + if (__libc_fstatfs (fd, &buf32) < 0) return -1; buf->f_type = buf32.f_type; diff --git a/libc/misc/statfs/fstatvfs.c b/libc/misc/statfs/fstatvfs.c index e21235e01..7956e014b 100644 --- a/libc/misc/statfs/fstatvfs.c +++ b/libc/misc/statfs/fstatvfs.c @@ -33,6 +33,7 @@ libc_hidden_proto(setmntent) libc_hidden_proto(getmntent_r) libc_hidden_proto(endmntent) +libc_hidden_proto(stat) #ifndef __USE_FILE_OFFSET64 extern int fstatfs (int __fildes, struct statfs *__buf) @@ -50,6 +51,7 @@ extern __typeof(fstatfs) __libc_fstatfs; libc_hidden_proto(__libc_fstatfs) libc_hidden_proto(fstat) libc_hidden_proto(stat) +libc_hidden_proto(fstatvfs) int fstatvfs (int fd, struct statvfs *buf) { @@ -66,3 +68,4 @@ int fstatvfs (int fd, struct statvfs *buf) /* We signal success if the statfs call succeeded. */ return 0; } +libc_hidden_def(fstatvfs) diff --git a/libc/misc/statfs/fstatvfs64.c b/libc/misc/statfs/fstatvfs64.c index 2d44e4217..638a211a7 100644 --- a/libc/misc/statfs/fstatvfs64.c +++ b/libc/misc/statfs/fstatvfs64.c @@ -38,11 +38,13 @@ libc_hidden_proto(endmntent) #undef stat #define stat stat64 -#if defined __UCLIBC_LINUX_SPECIFIC__ +#if !defined __UCLIBC_LINUX_SPECIFIC__ +libc_hidden_proto(fstatvfs) +#else libc_hidden_proto(fstatfs64) -libc_hidden_proto(fstat64) #endif -libc_hidden_proto(stat64) +libc_hidden_proto(fstat64) +libc_hidden_proto(stat) int fstatvfs64 (int fd, struct statvfs64 *buf) { diff --git a/libc/misc/statfs/statfs64.c b/libc/misc/statfs/statfs64.c index 18ce33be8..6b3558b5e 100644 --- a/libc/misc/statfs/statfs64.c +++ b/libc/misc/statfs/statfs64.c @@ -23,9 +23,9 @@ #include <stddef.h> #include <sys/statfs.h> - /* Experimentally off - libc_hidden_proto(memcpy) */ -libc_hidden_proto(statfs) +extern __typeof(statfs) __libc_statfs; +libc_hidden_proto(__libc_statfs) /* Return information about the filesystem on which FILE resides. */ libc_hidden_proto(statfs64) @@ -33,7 +33,7 @@ int statfs64 (const char *file, struct statfs64 *buf) { struct statfs buf32; - if (statfs (file, &buf32) < 0) + if (__libc_statfs (file, &buf32) < 0) return -1; buf->f_type = buf32.f_type; diff --git a/libc/misc/statfs/statvfs.c b/libc/misc/statfs/statvfs.c index 0feb8731d..5085a2a9e 100644 --- a/libc/misc/statfs/statvfs.c +++ b/libc/misc/statfs/statvfs.c @@ -38,6 +38,7 @@ extern __typeof(statfs) __libc_statfs; libc_hidden_proto(__libc_statfs) libc_hidden_proto(stat) +libc_hidden_proto(statvfs) int statvfs (const char *file, struct statvfs *buf) { struct statfs fsbuf; @@ -53,3 +54,4 @@ int statvfs (const char *file, struct statvfs *buf) /* We signal success if the statfs call succeeded. */ return 0; } +libc_hidden_def(statvfs) diff --git a/libc/misc/statfs/statvfs64.c b/libc/misc/statfs/statvfs64.c index 66f648ac1..008ba78c9 100644 --- a/libc/misc/statfs/statvfs64.c +++ b/libc/misc/statfs/statvfs64.c @@ -37,7 +37,7 @@ libc_hidden_proto(endmntent) #undef stat #define stat stat64 -#if !defined __UCLIBC_LINUX_SPECIFIC__ +#if defined __UCLIBC_LINUX_SPECIFIC__ libc_hidden_proto(statfs64) #else libc_hidden_proto(statvfs) diff --git a/libc/misc/sysvipc/__syscall_ipc.c b/libc/misc/sysvipc/__syscall_ipc.c index 99dfbf49f..304a42c29 100644 --- a/libc/misc/sysvipc/__syscall_ipc.c +++ b/libc/misc/sysvipc/__syscall_ipc.c @@ -13,5 +13,5 @@ #define __NR___syscall_ipc __NR_ipc #include "ipc.h" _syscall6(int, __syscall_ipc, unsigned int, call, long, first, long, second, long, - third, void *, ptr, void *, fifth); + third, void *, ptr, void *, fifth) #endif diff --git a/libc/misc/sysvipc/sem.c b/libc/misc/sysvipc/sem.c index 1caec5a8c..96d6a6ee5 100644 --- a/libc/misc/sysvipc/sem.c +++ b/libc/misc/sysvipc/sem.c @@ -20,6 +20,8 @@ #include <errno.h> #include <sys/sem.h> #include <stddef.h> +#include <stdlib.h> /* for NULL */ + #include "ipc.h" @@ -27,7 +29,6 @@ /* Return identifier for array of NSEMS semaphores associated with KEY. */ #include <stdarg.h> -#include <stdlib.h> /* arg for semctl system calls. */ union semun { int val; /* value for SETVAL */ @@ -61,11 +62,8 @@ int semctl(int semid, int semnum, int cmd, ...) #endif #ifdef L_semget -/* for definition of NULL */ -#include <stdlib.h> - #ifdef __NR_semget -_syscall3(int, semget, key_t, key, int, nsems, int, semflg); +_syscall3(int, semget, key_t, key, int, nsems, int, semflg) #else /* Return identifier for array of NSEMS semaphores associated @@ -80,7 +78,7 @@ int semget (key_t key, int nsems, int semflg) #ifdef L_semop #ifdef __NR_semop -_syscall3(int, semop, int, semid, struct sembuf *, sops, size_t, nsops); +_syscall3(int, semop, int, semid, struct sembuf *, sops, size_t, nsops) #else /* Perform user-defined atomical operation of array of semaphores. */ @@ -94,7 +92,7 @@ int semop (int semid, struct sembuf *sops, size_t nsops) #ifdef L_semtimedop #ifdef __NR_semtimedop -_syscall4(int, semtimedop, int, semid, struct sembuf *, sops, size_t, nsops, const struct timespec *, timeout); +_syscall4(int, semtimedop, int, semid, struct sembuf *, sops, size_t, nsops, const struct timespec *, timeout) #else diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c index b1af943b8..9d71161cb 100644 --- a/libc/misc/sysvipc/shm.c +++ b/libc/misc/sysvipc/shm.c @@ -34,7 +34,7 @@ # define __NR_shmat __NR_osf_shmat #endif #ifdef __NR_shmat -_syscall3(void *, shmat, int, shmid, const void *,shmaddr, int, shmflg); +_syscall3(void *, shmat, int, shmid, const void *,shmaddr, int, shmflg) #else /* psm: don't remove this, else mips will fail */ #include <unistd.h> @@ -73,7 +73,7 @@ int shmctl(int shmid, int cmd, struct shmid_ds *buf) /* Detach shared memory segment starting at address specified by SHMADDR from the caller's data segment. */ #ifdef __NR_shmdt -_syscall1(int, shmdt, const void *, shmaddr); +_syscall1(int, shmdt, const void *, shmaddr) #else int shmdt (const void *shmaddr) { @@ -86,7 +86,7 @@ int shmdt (const void *shmaddr) /* Return an identifier for an shared memory segment of at least size SIZE which is associated with KEY. */ #ifdef __NR_shmget -_syscall3(int, shmget, key_t, key, size_t, size, int, shmflg); +_syscall3(int, shmget, key_t, key, size_t, size, int, shmflg) #else int shmget (key_t key, size_t size, int shmflg) { diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 2d980a068..97fbad560 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -531,7 +531,7 @@ double difftime(time_t time1, time_t time0) #if (LONG_MAX >> DBL_MANT_DIG) == 0 /* time_t fits in the mantissa of a double. */ - return ((double) time1) - time0; + return (double)time1 - (double)time0; #elif ((LONG_MAX >> DBL_MANT_DIG) >> DBL_MANT_DIG) == 0 @@ -2088,7 +2088,6 @@ libc_hidden_def(tzset) #endif #include <utime.h> -#include <sys/time.h> int utimes(const char *filename, register const struct timeval *tvp) { diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 9e979c1fb..6214243e3 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -488,7 +488,8 @@ size_t attribute_hidden _wchar_utf8sntowcs(wchar_t *__restrict pwc, size_t wn, #ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: Fix range for 16 bit wchar_t case. #endif - if ( ((unsigned char)(s[-1] - 0xc0)) < (0xfe - 0xc0) ) { + if (( ((unsigned char)(s[-1] - 0xc0)) < (0xfe - 0xc0) ) && + (((unsigned char)s[-1] != 0xc0 ) && ((unsigned char)s[-1] != 0xc1 ))) { goto START; } BAD: @@ -1570,10 +1571,7 @@ size_t weak_function iconv(iconv_t cd, char **__restrict inbuf, /**********************************************************************/ #ifdef L_iconv_main -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#include <wchar.h> #include <iconv.h> #include <stdarg.h> #include <libgen.h> diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index 145c24c79..d8b2db16f 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -784,7 +784,7 @@ parse_arith(char **word, size_t * word_length, size_t * max_length, } /* Function called by child process in exec_comm() */ -static void +static void attribute_noreturn exec_comm_child(char *comm, int *fildes, int showerr, int noexec) { const char *args[4] = { _PATH_BSHELL, "-c", comm, NULL }; |
