diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-12-24 22:03:57 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-12-24 22:03:57 +0000 |
commit | 7f4f5f8cad166f1fecd5b113b1ea96ed55368a34 (patch) | |
tree | c41dc83c5cd0c23ee4102389bf91c1e4ead076d3 /gnu/lib | |
parent | b11ac86a3fab5005d005684c5a1872b7ce954767 (diff) |
fix up conflicts
Diffstat (limited to 'gnu/lib')
-rw-r--r-- | gnu/lib/libiberty/include/ChangeLog | 37 | ||||
-rw-r--r-- | gnu/lib/libiberty/include/obstack.h | 40 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/ChangeLog | 12 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/calloc.c | 14 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/copysign.c | 18 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/functions.texi | 120 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/maint-tool | 8 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/memchr.c | 43 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/memcpy.c | 22 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/memmove.c | 16 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/memset.c | 19 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/physmem.c | 2 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/strcasecmp.c | 14 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/strdup.c | 32 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/strncasecmp.c | 14 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/strncmp.c | 13 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/strstr.c | 26 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/testsuite/test-demangle.c | 2 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/vfprintf.c | 3 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/vprintf.c | 21 | ||||
-rw-r--r-- | gnu/lib/libiberty/src/xatexit.c | 21 |
21 files changed, 379 insertions, 118 deletions
diff --git a/gnu/lib/libiberty/include/ChangeLog b/gnu/lib/libiberty/include/ChangeLog index 5fd99e8b8ae..319da2a09c2 100644 --- a/gnu/lib/libiberty/include/ChangeLog +++ b/gnu/lib/libiberty/include/ChangeLog @@ -1,3 +1,40 @@ +2004-09-30 Release Manager + + * GCC 3.3.5 Released. + +2004-05-31 Release Manager + + * GCC 3.3.4 Released. + +2004-03-02 Gabriel Dos Reis <gdr@integrable-solutions.net> + + PR bootstrap/14348 + Backport + 2003-10-22 Joseph S. Myers <jsm@polyomino.org.uk> + * obstack.h: Merge the following change from gnulib: + 2003-10-21 Paul Eggert <eggert@twinsun.com> + * obstack.h (obstack_1grow_fast): Properly parenthesize arg. + (obstack_ptr_grow_fast, obstack_int_grow_fast): + Don't use lvalue casts, as GCC plans to remove support for them + in GCC 3.5. Reported by Joseph S. Myers. This bug + was also present in the non-GCC version, indicating that this + code had always been buggy and had never been widely used. + (obstack_1grow, obstack_ptr_grow, obstack_int_grow, + obstack_blank): + Use the fast variant of each macro, rather than copying the + definiens of the fast variant; that way, we'll be more likely to + catch future bugs in the fast variants. + +2004-02-14 Release Manager + + * GCC 3.3.3 Released. + +2003-11-12 Daniel Jacobowitz <drow@mvista.com> + + Backport from mainline: + 2003-02-20 Daniel Jacobowitz <drow@mvista.com> + * libiberty.h (lrealpath): Add declaration. + 2003-10-16 Release Manager * GCC 3.3.2 Released. diff --git a/gnu/lib/libiberty/include/obstack.h b/gnu/lib/libiberty/include/obstack.h index d86d9f2c426..5496ff24071 100644 --- a/gnu/lib/libiberty/include/obstack.h +++ b/gnu/lib/libiberty/include/obstack.h @@ -343,7 +343,7 @@ extern int obstack_exit_failure; #endif -#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar) +#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar)) #define obstack_blank_fast(h,n) ((h)->next_free += (n)) @@ -411,7 +411,7 @@ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + 1 > __o->chunk_limit) \ _obstack_newchunk (__o, 1); \ - *(__o->next_free)++ = (datum); \ + obstack_1grow_fast (__o, datum); \ (void) 0; }) /* These assume that the obstack alignment is good enough for pointers or ints, @@ -423,19 +423,28 @@ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ _obstack_newchunk (__o, sizeof (void *)); \ - *((void **)__o->next_free)++ = ((void *)datum); \ - (void) 0; }) + obstack_ptr_grow_fast (__o, datum); }) # define obstack_int_grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + sizeof (int) > __o->chunk_limit) \ _obstack_newchunk (__o, sizeof (int)); \ - *((int *)__o->next_free)++ = ((int)datum); \ + obstack_int_grow_fast (__o, datum); }) + +# define obstack_ptr_grow_fast(OBSTACK,aptr) \ +__extension__ \ +({ struct obstack *__o1 = (OBSTACK); \ + *(const void **) __o1->next_free = (aptr); \ + __o1->next_free += sizeof (const void *); \ (void) 0; }) -# define obstack_ptr_grow_fast(h,aptr) (*((void **) (h)->next_free)++ = (void *)aptr) -# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint) +# define obstack_int_grow_fast(OBSTACK,aint) \ +__extension__ \ +({ struct obstack *__o1 = (OBSTACK); \ + *(int *) __o1->next_free = (aint); \ + __o1->next_free += sizeof (int); \ + (void) 0; }) # define obstack_blank(OBSTACK,length) \ __extension__ \ @@ -443,7 +452,7 @@ __extension__ \ int __len = (length); \ if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ - __o->next_free += __len; \ + obstack_blank_fast (__o, __len); \ (void) 0; }) # define obstack_alloc(OBSTACK,length) \ @@ -530,26 +539,29 @@ __extension__ \ # define obstack_1grow(h,datum) \ ( (((h)->next_free + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), 1), 0) : 0), \ - (*((h)->next_free)++ = (datum))) + obstack_1grow_fast (h, datum)) # define obstack_ptr_grow(h,datum) \ ( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ - (*((char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *) datum))) + obstack_ptr_grow_fast (h, datum)) # define obstack_int_grow(h,datum) \ ( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ - (*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = ((int) datum))) + obstack_int_grow_fast (h, datum)) + +# define obstack_ptr_grow_fast(h,aptr) \ + (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr)) -# define obstack_ptr_grow_fast(h,aptr) (*((char **) (h)->next_free)++ = (char *) aptr) -# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint) +# define obstack_int_grow_fast(h,aint) \ + (((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr)) # define obstack_blank(h,length) \ ( (h)->temp = (length), \ (((h)->chunk_limit - (h)->next_free < (h)->temp) \ ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ - ((h)->next_free += (h)->temp)) + obstack_blank_fast (h, (h)->temp)) # define obstack_alloc(h,length) \ (obstack_blank ((h), (length)), obstack_finish ((h))) diff --git a/gnu/lib/libiberty/src/ChangeLog b/gnu/lib/libiberty/src/ChangeLog index 0539a5aa1ca..607bb148cc8 100644 --- a/gnu/lib/libiberty/src/ChangeLog +++ b/gnu/lib/libiberty/src/ChangeLog @@ -1,3 +1,15 @@ +2004-09-30 Release Manager + + * GCC 3.3.5 Released. + +2004-05-31 Release Manager + + * GCC 3.3.4 Released. + +2004-02-14 Release Manager + + * GCC 3.3.3 Released. + 2003-04-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * vsnprintf.c (vsnprintf): Don't pad string with extra nulls. diff --git a/gnu/lib/libiberty/src/calloc.c b/gnu/lib/libiberty/src/calloc.c index 334b18db86a..50736823077 100644 --- a/gnu/lib/libiberty/src/calloc.c +++ b/gnu/lib/libiberty/src/calloc.c @@ -1,9 +1,18 @@ /* calloc -- allocate memory which has been initialized to zero. This function is in the public domain. */ + +/* + +@deftypefn Supplemental void* calloc (size_t @var{nelem}, size_t @var{elsize}) + +Uses @code{malloc} to allocate storage for @var{nelem} objects of +@var{elsize} bytes each, then zeros the memory. + +@end deftypefn + +*/ #include "ansidecl.h" -#include "libiberty.h" - #ifdef ANSI_PROTOTYPES #include <stddef.h> #else @@ -12,6 +21,7 @@ /* For systems with larger pointers than ints, this must be declared. */ PTR malloc PARAMS ((size_t)); +void bzero PARAMS ((PTR, size_t)); PTR calloc (nelem, elsize) diff --git a/gnu/lib/libiberty/src/copysign.c b/gnu/lib/libiberty/src/copysign.c index 0b5f8c3d9df..d288be239eb 100644 --- a/gnu/lib/libiberty/src/copysign.c +++ b/gnu/lib/libiberty/src/copysign.c @@ -129,8 +129,11 @@ typedef union } __ieee_float_shape_type; #endif +#if defined(__IEEE_BIG_ENDIAN) || defined(__IEEE_LITTLE_ENDIAN) -double DEFUN(copysign, (x, y), double x AND double y) +double +copysign (x, y) + double x, y; { __ieee_double_shape_type a,b; b.value = y; @@ -138,3 +141,16 @@ double DEFUN(copysign, (x, y), double x AND double y) a.number.sign =b.number.sign; return a.value; } + +#else + +double +copysign (x, y) + double x, y; +{ + if ((x < 0 && y > 0) || (x > 0 && y < 0)) + return -x; + return x; +} + +#endif diff --git a/gnu/lib/libiberty/src/functions.texi b/gnu/lib/libiberty/src/functions.texi index 7d9c181d219..4261d864676 100644 --- a/gnu/lib/libiberty/src/functions.texi +++ b/gnu/lib/libiberty/src/functions.texi @@ -392,19 +392,38 @@ and a path ending in @code{/} returns the empty string after it. @end deftypefn +@c lrealpath.c:25 +@deftypefn Replacement {const char*} lrealpath (const char *@var{name}) + +Given a pointer to a string containing a pathname, returns a canonical +version of the filename. Symlinks will be resolved, and ``.'' and ``..'' +components will be simplified. The returned value will be allocated using +@code{malloc}, or @code{NULL} will be returned on a memory allocation error. + +@end deftypefn + @c make-relative-prefix.c:24 @deftypefn Extension {const char*} make_relative_prefix (const char *@var{progname}, const char *@var{bin_prefix}, const char *@var{prefix}) -Given three strings @var{progname}, @var{bin_prefix}, @var{prefix}, return a string -that gets to @var{prefix} starting with the directory portion of @var{progname} and -a relative pathname of the difference between @var{bin_prefix} and @var{prefix}. +Given three paths @var{progname}, @var{bin_prefix}, @var{prefix}, +return the path that is in the same position relative to +@var{progname}'s directory as @var{prefix} is relative to +@var{bin_prefix}. That is, a string starting with the directory +portion of @var{progname}, followed by a relative pathname of the +difference between @var{bin_prefix} and @var{prefix}. -For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta}, @var{prefix} -is @code{/alpha/beta/gamma/omega/}, and @var{progname} is @code{/red/green/blue/gcc}, -then this function will return @code{/red/green/blue/../../omega/}. +If @var{progname} does not contain any directory separators, +@code{make_relative_prefix} will search @env{PATH} to find a program +named @var{progname}. Also, if @var{progname} is a symbolic link, +the symbolic link will be resolved. -The return value is normally allocated via @code{malloc}. If no relative prefix -can be found, return @code{NULL}. +For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta}, +@var{prefix} is @code{/alpha/beta/gamma/omega/}, and @var{progname} is +@code{/red/green/blue/gcc}, then this function will return +@code{/red/green/blue/../../omega/}. + +The return value is normally allocated via @code{malloc}. If no +relative prefix can be found, return @code{NULL}. @end deftypefn @@ -457,6 +476,14 @@ Copies @var{count} bytes from memory area @var{from} to memory area @end deftypefn +@c mempcpy.c:23 +@deftypefn Supplemental void* mempcpy (void *@var{out}, const void *@var{in}, size_t @var{length}) + +Copies @var{length} bytes from memory region @var{in} to region +@var{out}. Returns a pointer to @var{out} + @var{length}. + +@end deftypefn + @c memset.c:6 @deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count}) @@ -483,7 +510,7 @@ reading and writing. @end deftypefn -@c pexecute.c:67 +@c pexecute.txh:1 @deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags) Executes a program. @@ -498,14 +525,15 @@ use if needed. This is currently only needed for MS-DOS ports that don't use @code{go32} (do any still exist?). Ports that don't need it can pass @code{NULL}. -(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH} should be searched -(??? It's not clear that GCC passes this flag correctly). (@code{@var{flags} & -PEXECUTE_FIRST}) is nonzero for the first process in chain. -(@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the last process -in chain. The first/last flags could be simplified to only mark the -last of a chain of processes but that requires the caller to always -mark the last one (and not give up early if some error occurs). -It's more robust to require the caller to mark both ends of the chain. +(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH} +should be searched (??? It's not clear that GCC passes this flag +correctly). (@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the +first process in chain. (@code{@var{flags} & PEXECUTE_FIRST}) is +nonzero for the last process in chain. The first/last flags could be +simplified to only mark the last of a chain of processes but that +requires the caller to always mark the last one (and not give up +early if some error occurs). It's more robust to require the caller +to mark both ends of the chain. The result is the pid on systems like Unix where we @code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we @@ -540,21 +568,23 @@ name is unset/removed. @end deftypefn -@c pexecute.c:104 +@c pexecute.txh:39 @deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags}) Waits for a program started by @code{pexecute} to finish. @var{pid} is the process id of the task to wait for. @var{status} is -the `status' argument to wait. @var{flags} is currently unused (allows -future enhancement without breaking upward compatibility). Pass 0 for now. +the `status' argument to wait. @var{flags} is currently unused +(allows future enhancement without breaking upward compatibility). +Pass 0 for now. The result is the pid of the child reaped, or -1 for failure (@code{errno} says why). -On systems that don't support waiting for a particular child, @var{pid} is -ignored. On systems like MS-DOS that don't really multitask @code{pwait} -is just a mechanism to provide a consistent interface for the caller. +On systems that don't support waiting for a particular child, +@var{pid} is ignored. On systems like MS-DOS that don't really +multitask @code{pwait} is just a mechanism to provide a consistent +interface for the caller. @end deftypefn @@ -643,6 +673,19 @@ be the value @code{1}). @end deftypefn +@c snprintf.c:28 +@deftypefn Supplemental int snprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, ...) + +This function is similar to sprintf, but it will print at most @var{n} +characters. On error the return value is -1, otherwise it returns the +number of characters that would have been printed had @var{n} been +sufficiently large, regardless of the actual value of @var{n}. Note +some pre-C99 system libraries do not implement this correctly so users +cannot generally rely on the return value if the system version of +this function is used. + +@end deftypefn + @c spaces.c:22 @deftypefn Extension char* spaces (int @var{count}) @@ -652,6 +695,24 @@ valid until at least the next call. @end deftypefn +@c stpcpy.c:23 +@deftypefn Supplemental char* stpcpy (char *@var{dst}, const char *@var{src}) + +Copies the string @var{src} into @var{dst}. Returns a pointer to +@var{dst} + strlen(@var{src}). + +@end deftypefn + +@c stpncpy.c:23 +@deftypefn Supplemental char* stpncpy (char *@var{dst}, const char *@var{src}, size_t @var{len}) + +Copies the string @var{src} into @var{dst}, copying exactly @var{len} +and padding with zeros if necessary. If @var{len} < strlen(@var{src}) +then return @var{dst} + @var{len}, otherwise returns @var{dst} + +strlen(@var{src}). + +@end deftypefn + @c strcasecmp.c:15 @deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2}) @@ -881,6 +942,19 @@ nonstandard but common function @code{_doprnt}. @end deftypefn +@c vsnprintf.c:28 +@deftypefn Supplemental int vsnprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, va_list @var{ap}) + +This function is similar to vsprintf, but it will print at most +@var{n} characters. On error the return value is -1, otherwise it +returns the number of characters that would have been printed had +@var{n} been sufficiently large, regardless of the actual value of +@var{n}. Note some pre-C99 system libraries do not implement this +correctly so users cannot generally rely on the return value if the +system version of this function is used. + +@end deftypefn + @c waitpid.c:3 @deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int) diff --git a/gnu/lib/libiberty/src/maint-tool b/gnu/lib/libiberty/src/maint-tool index ceeb48dbf39..6b9bf7f2cdb 100644 --- a/gnu/lib/libiberty/src/maint-tool +++ b/gnu/lib/libiberty/src/maint-tool @@ -223,6 +223,14 @@ sub deps { } $mine{'config.h'} = "config.h"; + opendir(INC, $srcdir); + while ($f = readdir INC) { + next unless $f =~ /\.h$/; + $mine{$f} = "\$(srcdir)/$f"; + $deps{$f} = join(' ', &deps_for("$srcdir/$f")); + } + $mine{'config.h'} = "config.h"; + open(IN, "$srcdir/Makefile.in"); open(OUT, ">$srcdir/Makefile.tmp"); while (<IN>) { diff --git a/gnu/lib/libiberty/src/memchr.c b/gnu/lib/libiberty/src/memchr.c index cce30039437..3948125963d 100644 --- a/gnu/lib/libiberty/src/memchr.c +++ b/gnu/lib/libiberty/src/memchr.c @@ -1,42 +1,21 @@ /* -FUNCTION - <<memchr>>---find character in memory -INDEX - memchr +@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n}) -ANSI_SYNOPSIS - #include <string.h> - void *memchr(const void *<[src]>, int <[c]>, size_t <[length]>); +This function searches memory starting at @code{*@var{s}} for the +character @var{c}. The search only ends with the first occurrence of +@var{c}, or after @var{length} characters; in particular, a null +character does not terminate the search. If the character @var{c} is +found within @var{length} characters of @code{*@var{s}}, a pointer +to the character is returned. If @var{c} is not found, then @code{NULL} is +returned. -TRAD_SYNOPSIS - #include <string.h> - void *memchr(<[src]>, <[c]>, <[length]>) - void *<[src]>; - void *<[c]>; - size_t <[length]>; - -DESCRIPTION - This function searches memory starting at <<*<[src]>>> for the - character <[c]>. The search only ends with the first - occurrence of <[c]>, or after <[length]> characters; in - particular, <<NULL>> does not terminate the search. - -RETURNS - If the character <[c]> is found within <[length]> characters - of <<*<[src]>>>, a pointer to the character is returned. If - <[c]> is not found, then <<NULL>> is returned. - -PORTABILITY -<<memchr>> requires no supporting OS subroutines. - -QUICKREF - memchr ansi pure +@end deftypefn */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long @@ -50,7 +29,7 @@ memchr (src_void, c, length) { const unsigned char *src = (const unsigned char *)src_void; - while (--length >= 0) + while (length-- > 0) { if (*src == c) return (PTR)src; diff --git a/gnu/lib/libiberty/src/memcpy.c b/gnu/lib/libiberty/src/memcpy.c index 707a9f57385..5eece7a0a00 100644 --- a/gnu/lib/libiberty/src/memcpy.c +++ b/gnu/lib/libiberty/src/memcpy.c @@ -2,26 +2,30 @@ This function is in the public domain. */ /* -NAME - memcpy -- copy memory regions of arbitary length -SYNOPSIS - void* memcpy (void *out, const void *in, size_t n); +@deftypefn Supplemental void* memcpy (void *@var{out}, const void *@var{in}, size_t @var{length}) + +Copies @var{length} bytes from memory region @var{in} to region +@var{out}. Returns a pointer to @var{out}. + +@end deftypefn -DESCRIPTION - Copy LENGTH bytes from memory region pointed to by IN to memory - region pointed to by OUT. */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long #endif +void bcopy PARAMS((const void*, void*, size_t)); + PTR -DEFUN(memcpy, (out, in, length), PTR out AND const PTR in AND size_t length) +memcpy (out, in, length) + PTR out; + const PTR in; + size_t length; { bcopy(in, out, length); return out; diff --git a/gnu/lib/libiberty/src/memmove.c b/gnu/lib/libiberty/src/memmove.c index 176c326ef2b..00ac053401b 100644 --- a/gnu/lib/libiberty/src/memmove.c +++ b/gnu/lib/libiberty/src/memmove.c @@ -1,12 +1,26 @@ /* Wrapper to implement ANSI C's memmove using BSD's bcopy. */ /* This function is in the public domain. --Per Bothner. */ + +/* + +@deftypefn Supplemental void* memmove (void *@var{from}, const void *@var{to}, size_t @var{count}) + +Copies @var{count} bytes from memory area @var{from} to memory area +@var{to}, returning a pointer to @var{to}. + +@end deftypefn + +*/ + #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long #endif +void bcopy PARAMS ((const void*, void*, size_t)); + PTR memmove (s1, s2, n) PTR s1; diff --git a/gnu/lib/libiberty/src/memset.c b/gnu/lib/libiberty/src/memset.c index 5f54831e83c..5119f858ad0 100644 --- a/gnu/lib/libiberty/src/memset.c +++ b/gnu/lib/libiberty/src/memset.c @@ -1,16 +1,29 @@ /* memset This implementation is in the public domain. */ +/* + +@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count}) + +Sets the first @var{count} bytes of @var{s} to the constant byte +@var{c}, returning a pointer to @var{s}. + +@end deftypefn + +*/ + #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long #endif PTR -DEFUN(memset, (dest, val, len), - PTR dest AND register int val AND register size_t len) +memset (dest, val, len) + PTR dest; + register int val; + register size_t len; { register unsigned char *ptr = (unsigned char*)dest; while (len-- > 0) diff --git a/gnu/lib/libiberty/src/physmem.c b/gnu/lib/libiberty/src/physmem.c index f64e07c74d4..9185c1224e8 100644 --- a/gnu/lib/libiberty/src/physmem.c +++ b/gnu/lib/libiberty/src/physmem.c @@ -145,7 +145,7 @@ physmem_total () #endif #if HAVE__SYSTEM_CONFIGURATION - /* This works on AIX 4.3.3+. */ + /* This works on AIX. */ return _system_configuration.physmem; #endif diff --git a/gnu/lib/libiberty/src/strcasecmp.c b/gnu/lib/libiberty/src/strcasecmp.c index 3aa930b696f..d2608dc0b87 100644 --- a/gnu/lib/libiberty/src/strcasecmp.c +++ b/gnu/lib/libiberty/src/strcasecmp.c @@ -10,12 +10,22 @@ * is provided ``as is'' without express or implied warranty. */ +/* + +@deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2}) + +A case-insensitive @code{strcmp}. + +@end deftypefn + +*/ + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; #endif /* LIBC_SCCS and not lint */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long @@ -27,7 +37,7 @@ static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; * based upon ascii character sequences. */ typedef unsigned char uc; -static unsigned char charmap[] = { +static const unsigned char charmap[] = { (uc)'\000',(uc)'\001',(uc)'\002',(uc)'\003',(uc)'\004',(uc)'\005',(uc)'\006',(uc)'\007', (uc)'\010',(uc)'\011',(uc)'\012',(uc)'\013',(uc)'\014',(uc)'\015',(uc)'\016',(uc)'\017', (uc)'\020',(uc)'\021',(uc)'\022',(uc)'\023',(uc)'\024',(uc)'\025',(uc)'\026',(uc)'\027', diff --git a/gnu/lib/libiberty/src/strdup.c b/gnu/lib/libiberty/src/strdup.c index 1785b34f274..071a4a401af 100644 --- a/gnu/lib/libiberty/src/strdup.c +++ b/gnu/lib/libiberty/src/strdup.c @@ -1,10 +1,32 @@ +/* + +@deftypefn Supplemental char* strdup (const char *@var{s}) + +Returns a pointer to a copy of @var{s} in memory obtained from +@code{malloc}, or @code{NULL} if insufficient memory was available. + +@end deftypefn + +*/ + +#include <ansidecl.h> +#ifdef ANSI_PROTOTYPES +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +extern size_t strlen PARAMS ((const char*)); +extern PTR malloc PARAMS ((size_t)); +extern PTR memcpy PARAMS ((PTR, const PTR, size_t)); + char * strdup(s) char *s; { - char *result = (char*)malloc(strlen(s) + 1); - if (result == (char*)0) - return (char*)0; - strcpy(result, s); - return result; + size_t len = strlen (s) + 1; + char *result = (char*) malloc (len); + if (result == (char*) 0) + return (char*) 0; + return (char*) memcpy (result, s, len); } diff --git a/gnu/lib/libiberty/src/strncasecmp.c b/gnu/lib/libiberty/src/strncasecmp.c index 4485cac7a6a..10feee82198 100644 --- a/gnu/lib/libiberty/src/strncasecmp.c +++ b/gnu/lib/libiberty/src/strncasecmp.c @@ -10,12 +10,22 @@ * is provided ``as is'' without express or implied warranty. */ +/* + +@deftypefn Supplemental int strncasecmp (const char *@var{s1}, const char *@var{s2}) + +A case-insensitive @code{strncmp}. + +@end deftypefn + +*/ + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; #endif /* LIBC_SCCS and not lint */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long @@ -26,7 +36,7 @@ static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; * together for a case independent comparison. The mappings are * based upon ascii character sequences. */ -static unsigned char charmap[] = { +static const unsigned char charmap[] = { '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', diff --git a/gnu/lib/libiberty/src/strncmp.c b/gnu/lib/libiberty/src/strncmp.c index b3b9de16b10..ad87e1fde8b 100644 --- a/gnu/lib/libiberty/src/strncmp.c +++ b/gnu/lib/libiberty/src/strncmp.c @@ -1,8 +1,19 @@ /* strncmp -- compare two strings, stop after n bytes. This function is in the public domain. */ +/* + +@deftypefn Supplemental int strncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n}) + +Compares the first @var{n} bytes of two strings, returning a value as +@code{strcmp}. + +@end deftypefn + +*/ + #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long diff --git a/gnu/lib/libiberty/src/strstr.c b/gnu/lib/libiberty/src/strstr.c index fab36e3fb3d..a059c7f5dcb 100644 --- a/gnu/lib/libiberty/src/strstr.c +++ b/gnu/lib/libiberty/src/strstr.c @@ -3,24 +3,16 @@ /* -NAME +@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub}) - strstr -- locate first occurance of a substring +This function searches for the substring @var{sub} in the string +@var{string}, not including the terminating null characters. A pointer +to the first occurrence of @var{sub} is returned, or @code{NULL} if the +substring is absent. If @var{sub} points to a string with zero +length, the function returns @var{string}. -SYNOPSIS +@end deftypefn - #include <string.h> - - char *strstr (char *s1, char *s2) - -DESCRIPTION - - Locates the first occurance in the string pointed to by S1 of - the string pointed to by S2. Returns a pointer to the substring - found, or a NULL pointer if not found. If S2 points to a string - with zero length, the function returns S1. - -BUGS */ @@ -35,8 +27,8 @@ strstr (s1, s2) register char *p = s1; extern char *strchr (); extern int strncmp (); -#if __GNUC__==2 - extern __SIZE_TYPE__ strlen (); +#if __GNUC__ >= 2 + extern __SIZE_TYPE__ strlen (const char *); #endif register int len = strlen (s2); diff --git a/gnu/lib/libiberty/src/testsuite/test-demangle.c b/gnu/lib/libiberty/src/testsuite/test-demangle.c index 6e5d0b4b973..82f263e88af 100644 --- a/gnu/lib/libiberty/src/testsuite/test-demangle.c +++ b/gnu/lib/libiberty/src/testsuite/test-demangle.c @@ -65,7 +65,7 @@ getline(buf) line: copy this line into the buffer and return. */ while (c != EOF && c != '\n') { - if (count + 1 >= alloc) + if (count >= alloc) { alloc *= 2; data = xrealloc (data, alloc); diff --git a/gnu/lib/libiberty/src/vfprintf.c b/gnu/lib/libiberty/src/vfprintf.c index db7b2ff4c19..18f09d47d32 100644 --- a/gnu/lib/libiberty/src/vfprintf.c +++ b/gnu/lib/libiberty/src/vfprintf.c @@ -3,7 +3,8 @@ Copyright (C) 1998 Free Software Foundation, Inc. */ -#ifdef __STDC__ +#include "ansidecl.h" +#ifdef ANSI_PROTOTYPES #include <stdarg.h> #else #include <varargs.h> diff --git a/gnu/lib/libiberty/src/vprintf.c b/gnu/lib/libiberty/src/vprintf.c index 65b425a4d6b..9487896ea5e 100644 --- a/gnu/lib/libiberty/src/vprintf.c +++ b/gnu/lib/libiberty/src/vprintf.c @@ -1,10 +1,27 @@ -#ifdef __STDC__ +/* + +@deftypefn Supplemental int vprintf (const char *@var{format}, va_list @var{ap}) +@deftypefnx Supplemental int vfprintf (FILE *@var{stream}, const char *@var{format}, va_list @var{ap}) +@deftypefnx Supplemental int vsprintf (char *@var{str}, const char *@var{format}, va_list @var{ap}) + +These functions are the same as @code{printf}, @code{fprintf}, and +@code{sprintf}, respectively, except that they are called with a +@code{va_list} instead of a variable number of arguments. Note that +they do not call @code{va_end}; this is the application's +responsibility. In @libib{} they are implemented in terms of the +nonstandard but common function @code{_doprnt}. + +@end deftypefn + +*/ + +#include <ansidecl.h> +#ifdef ANSI_PROTOTYPES #include <stdarg.h> #else #include <varargs.h> #endif #include <stdio.h> -#include <ansidecl.h> #undef vprintf int vprintf (format, ap) diff --git a/gnu/lib/libiberty/src/xatexit.c b/gnu/lib/libiberty/src/xatexit.c index 31476c29ddc..075599c61f9 100644 --- a/gnu/lib/libiberty/src/xatexit.c +++ b/gnu/lib/libiberty/src/xatexit.c @@ -5,6 +5,20 @@ * %sccs.include.redist.c% */ + +/* + +@deftypefun int xatexit (void (*@var{fn}) (void)) + +Behaves as the standard @code{atexit} function, but with no limit on +the number of registered functions. Returns 0 on success, or @minus{}1 on +failure. If you use @code{xatexit} to register functions, you must use +@code{xexit} to terminate your program. + +@end deftypefun + +*/ + /* Adapted from newlib/libc/stdlib/{,at}exit.[ch]. If you use xatexit, you must call xexit instead of exit. */ @@ -13,14 +27,19 @@ #include <stdio.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long #endif +#if VMS +#include <stdlib.h> +#include <unixlib.h> +#else /* For systems with larger pointers than ints, this must be declared. */ PTR malloc PARAMS ((size_t)); +#endif static void xatexit_cleanup PARAMS ((void)); |