aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog45
-rw-r--r--libiberty/mempcpy.c13
-rw-r--r--libiberty/memset.c9
-rw-r--r--libiberty/mkstemps.c4
-rw-r--r--libiberty/objalloc.c17
-rw-r--r--libiberty/obstack.c135
-rw-r--r--libiberty/partition.c19
-rw-r--r--libiberty/pex-djgpp.c15
-rw-r--r--libiberty/pex-msdos.c15
-rw-r--r--libiberty/pex-unix.c18
-rw-r--r--libiberty/pex-win32.c21
-rw-r--r--libiberty/physmem.c8
-rw-r--r--libiberty/putenv.c3
-rw-r--r--libiberty/random.c15
-rw-r--r--libiberty/rename.c4
-rw-r--r--libiberty/rindex.c4
-rw-r--r--libiberty/safe-ctype.c3
-rw-r--r--libiberty/setenv.c8
-rw-r--r--libiberty/sigsetmask.c5
-rw-r--r--libiberty/snprintf.c9
-rw-r--r--libiberty/sort.c8
-rw-r--r--libiberty/spaces.c7
-rw-r--r--libiberty/splay-tree.c113
-rw-r--r--libiberty/stpcpy.c12
-rw-r--r--libiberty/stpncpy.c13
-rw-r--r--libiberty/strcasecmp.c7
-rw-r--r--libiberty/strchr.c4
-rw-r--r--libiberty/strdup.c13
28 files changed, 179 insertions, 368 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 60cbe91..8eb73b7 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,5 +1,50 @@
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
+ Convert libiberty to use ISO C prototype style 5/n.
+ * random.c (srandom, initstate, setstate, random): Use ISO C
+ prototypes.
+ * putenv.c (putenv): Likewise.
+ * physmem.c (physmem_available, physmem_total, main): Likewise.
+ * pex-win32.c (fix_argv, pexecute, pwait): Likewise.
+ * pex-unix.c (pexecute, pwait): Likewise.
+ * pex-msdos.c (pexecute, pwait): Likewise.
+ * pex-djgpp.c (pexecute, pwait): Likewise.
+ * partition.c (partition_new, partition_delete, partition_union)
+ (elem_compare, partition_print): Likewise.
+ * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk,
+ _obstack_allocated_p, _obstack_free, obstack_free,
+ _obstack_memory_used, print_and_abort, obstack_next_free,
+ obstack_object_size, obstack_base): Likewise. Remove codes
+ predicated on !defined(__STDC__).
+ * objalloc.c (objalloc_create, _objalloc_alloc, objalloc_free,
+ objalloc_free_block): Use ISO C prototypes.
+ * mkstemps.c (mkstemps): Likewise.
+ * memset.c (memset): Likewise.
+ * mempcpy.c (mempcpy): Likewise.
+ * rename.c (rename): Likewise.
+ * rindex.c (rindex): Likewise.
+ * setenv.c (setenv, unsetenv): Likewise.
+ * sigsetmask.c (sigsetmask): Likewise.
+ * snprintf.c (snprintf): Likewise.
+ * sort.c (sort_pointers, xmalloc): Likewise.
+ * spaces.c (spaces): Likewise.
+ * splay-tree.c (splay_tree_delete_helper,
+ splay_tree_splay_helper, splay_tree_splay,
+ splay_tree_foreach_helper, splay_tree_xmalloc_allocate,
+ splay_tree_new, splay_tree_xmalloc_allocate,
+ splay_tree_new_with_allocator, splay_tree_delete,
+ splay_tree_insert, splay_tree_remove, splay_tree_lookup,
+ splay_tree_max, splay_tree_min, splay_tree_predecessor,
+ splay_tree_successor, splay_tree_foreach,
+ splay_tree_compare_ints, splay_tree_compare_pointers): Likewise.
+ * stpcpy.c (stpcpy): Likewise.
+ * stpncpy.c (stpncpy): Likewise.
+ * strcasecmp.c (strcasecmp): Likewise.
+ * strchr.c (strchr): Likewise.
+ * strdup.c (strdup): Likewise.
+
+2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
Convert libiberty to use ISO C prototype style 6/n.
* strerror.c (init_error_tables, errno_max, strerror, strerrno,
strtoerrno, main): Use ISO C prototype style.
diff --git a/libiberty/mempcpy.c b/libiberty/mempcpy.c
index b0dccfa..ebd105c 100644
--- a/libiberty/mempcpy.c
+++ b/libiberty/mempcpy.c
@@ -1,5 +1,5 @@
/* Implement the mempcpy function.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library.
@@ -30,19 +30,12 @@ Copies @var{length} bytes from memory region @var{in} to region
*/
#include <ansidecl.h>
-#ifdef ANSI_PROTOTYPES
#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-extern PTR memcpy PARAMS ((PTR, const PTR, size_t));
+extern PTR memcpy (PTR, const PTR, size_t);
PTR
-mempcpy (dst, src, len)
- PTR dst;
- const PTR src;
- size_t len;
+mempcpy (PTR dst, const PTR src, size_t len)
{
return (char *) memcpy (dst, src, len) + len;
}
diff --git a/libiberty/memset.c b/libiberty/memset.c
index 5119f85..1951ad6 100644
--- a/libiberty/memset.c
+++ b/libiberty/memset.c
@@ -13,17 +13,10 @@ Sets the first @var{count} bytes of @var{s} to the constant byte
*/
#include <ansidecl.h>
-#ifdef ANSI_PROTOTYPES
#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
PTR
-memset (dest, val, len)
- PTR dest;
- register int val;
- register size_t len;
+memset (PTR dest, register int val, register size_t len)
{
register unsigned char *ptr = (unsigned char*)dest;
while (len-- > 0)
diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c
index 94edf78..5963f58 100644
--- a/libiberty/mkstemps.c
+++ b/libiberty/mkstemps.c
@@ -71,9 +71,7 @@ reading and writing.
*/
int
-mkstemps (template, suffix_len)
- char *template;
- int suffix_len;
+mkstemps (char *template, int suffix_len)
{
static const char letters[]
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
diff --git a/libiberty/objalloc.c b/libiberty/objalloc.c
index 1cda7b9..a06047d 100644
--- a/libiberty/objalloc.c
+++ b/libiberty/objalloc.c
@@ -39,8 +39,8 @@ Boston, MA 02111-1307, USA. */
#include <stdlib.h>
#else
/* For systems with larger pointers than ints, this must be declared. */
-extern PTR malloc PARAMS ((size_t));
-extern void free PARAMS ((PTR));
+extern PTR malloc (size_t);
+extern void free (PTR);
#endif
#endif
@@ -85,7 +85,7 @@ struct objalloc_chunk
/* Create an objalloc structure. */
struct objalloc *
-objalloc_create ()
+objalloc_create (void)
{
struct objalloc *ret;
struct objalloc_chunk *chunk;
@@ -114,9 +114,7 @@ objalloc_create ()
/* Allocate space from an objalloc structure. */
PTR
-_objalloc_alloc (o, len)
- struct objalloc *o;
- unsigned long len;
+_objalloc_alloc (struct objalloc *o, unsigned long len)
{
/* We avoid confusion from zero sized objects by always allocating
at least 1 byte. */
@@ -171,8 +169,7 @@ _objalloc_alloc (o, len)
/* Free an entire objalloc structure. */
void
-objalloc_free (o)
- struct objalloc *o;
+objalloc_free (struct objalloc *o)
{
struct objalloc_chunk *l;
@@ -193,9 +190,7 @@ objalloc_free (o)
recently allocated blocks. */
void
-objalloc_free_block (o, block)
- struct objalloc *o;
- PTR block;
+objalloc_free_block (struct objalloc *o, PTR block)
{
struct objalloc_chunk *p, *small;
char *b = (char *) block;
diff --git a/libiberty/obstack.c b/libiberty/obstack.c
index 02560c9..1e12a87 100644
--- a/libiberty/obstack.c
+++ b/libiberty/obstack.c
@@ -52,11 +52,7 @@
#ifndef ELIDE_CODE
-#if defined (__STDC__) && __STDC__
#define POINTER void *
-#else
-#define POINTER char *
-#endif
/* Determine default alignment. */
struct fooalign {char x; double d;};
@@ -81,13 +77,8 @@ union fooround {long x; double d;};
jump to the handler pointed to by `obstack_alloc_failed_handler'.
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
/* Exit value used when `print_and_abort' is used. */
#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
@@ -148,17 +139,8 @@ struct obstack *_obstack;
free up some memory, then call this again. */
int
-_obstack_begin (h, size, alignment, chunkfun, freefun)
- 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,
+ POINTER (*chunkfun) (long), void (*freefun) (void *))
{
register struct _obstack_chunk *chunk; /* points to new chunk */
@@ -181,13 +163,8 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
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;
@@ -206,18 +183,9 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
}
int
-_obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
- 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,
+ POINTER (*chunkfun) (POINTER, long),
+ void (*freefun) (POINTER, POINTER), POINTER arg)
{
register struct _obstack_chunk *chunk; /* points to new chunk */
@@ -240,13 +208,8 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
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;
@@ -272,9 +235,7 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
to the beginning of the new one. */
void
-_obstack_newchunk (h, length)
- 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;
@@ -335,16 +296,12 @@ _obstack_newchunk (h, length)
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 (h, obj)
- struct obstack *h;
- POINTER obj;
+_obstack_allocated_p (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 */
@@ -370,9 +327,7 @@ _obstack_allocated_p (h, obj)
This is the first one, called from non-ANSI code. */
void
-_obstack_free (h, obj)
- struct obstack *h;
- POINTER obj;
+_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 */
@@ -404,9 +359,7 @@ _obstack_free (h, obj)
/* This function is used from ANSI code. */
void
-obstack_free (h, obj)
- struct obstack *h;
- POINTER obj;
+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 */
@@ -436,8 +389,7 @@ obstack_free (h, obj)
}
int
-_obstack_memory_used (h)
- struct obstack *h;
+_obstack_memory_used (struct obstack *h)
{
register struct _obstack_chunk* lp;
register int nbytes = 0;
@@ -462,7 +414,7 @@ _obstack_memory_used (h)
#endif
static void
-print_and_abort ()
+print_and_abort (void)
{
fputs (_("memory exhausted\n"), stderr);
exit (obstack_exit_failure);
@@ -475,119 +427,84 @@ print_and_abort ()
/* 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;
+POINTER (obstack_base) (struct obstack *obstack)
{
return obstack_base (obstack);
}
-POINTER (obstack_next_free) (obstack)
- struct obstack *obstack;
+POINTER (obstack_next_free) (struct obstack *obstack)
{
return obstack_next_free (obstack);
}
-int (obstack_object_size) (obstack)
- struct obstack *obstack;
+int (obstack_object_size) (struct obstack *obstack)
{
return obstack_object_size (obstack);
}
-int (obstack_room) (obstack)
- struct obstack *obstack;
+int (obstack_room) (struct obstack *obstack)
{
return obstack_room (obstack);
}
-int (obstack_make_room) (obstack, length)
- struct obstack *obstack;
- int length;
+int (obstack_make_room) (struct obstack *obstack, int length)
{
return obstack_make_room (obstack, length);
}
-void (obstack_grow) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
+void (obstack_grow) (struct obstack *obstack, POINTER pointer, int length)
{
obstack_grow (obstack, pointer, length);
}
-void (obstack_grow0) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
+void (obstack_grow0) (struct obstack *obstack, POINTER pointer, int length)
{
obstack_grow0 (obstack, pointer, length);
}
-void (obstack_1grow) (obstack, character)
- struct obstack *obstack;
- int character;
+void (obstack_1grow) (struct obstack *obstack, int character)
{
obstack_1grow (obstack, character);
}
-void (obstack_blank) (obstack, length)
- struct obstack *obstack;
- int length;
+void (obstack_blank) (struct obstack *obstack, int length)
{
obstack_blank (obstack, length);
}
-void (obstack_1grow_fast) (obstack, character)
- struct obstack *obstack;
- int character;
+void (obstack_1grow_fast) (struct obstack *obstack, int character)
{
obstack_1grow_fast (obstack, character);
}
-void (obstack_blank_fast) (obstack, length)
- struct obstack *obstack;
- int length;
+void (obstack_blank_fast) (struct obstack *obstack, int length)
{
obstack_blank_fast (obstack, length);
}
-POINTER (obstack_finish) (obstack)
- struct obstack *obstack;
+POINTER (obstack_finish) (struct obstack *obstack)
{
return obstack_finish (obstack);
}
-POINTER (obstack_alloc) (obstack, length)
- struct obstack *obstack;
- int length;
+POINTER (obstack_alloc) (struct obstack *obstack, int length)
{
return obstack_alloc (obstack, length);
}
-POINTER (obstack_copy) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
+POINTER (obstack_copy) (struct obstack *obstack, POINTER pointer, int length)
{
return obstack_copy (obstack, pointer, length);
}
-POINTER (obstack_copy0) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
+POINTER (obstack_copy0) (struct obstack *obstack, POINTER pointer, int length)
{
return obstack_copy0 (obstack, pointer, length);
}
-#endif /* __STDC__ */
-
#endif /* 0 */
#endif /* !ELIDE_CODE */
diff --git a/libiberty/partition.c b/libiberty/partition.c
index 0715472..b67f058 100644
--- a/libiberty/partition.c
+++ b/libiberty/partition.c
@@ -40,8 +40,7 @@ static int elem_compare PARAMS ((const void *, const void *));
element is in a class by itself. */
partition
-partition_new (num_elements)
- int num_elements;
+partition_new (int num_elements)
{
int e;
@@ -62,8 +61,7 @@ partition_new (num_elements)
/* Freeds a partition. */
void
-partition_delete (part)
- partition part;
+partition_delete (partition part)
{
free (part);
}
@@ -74,10 +72,7 @@ partition_delete (part)
resulting union class. */
int
-partition_union (part, elem1, elem2)
- partition part;
- int elem1;
- int elem2;
+partition_union (partition part, int elem1, int elem2)
{
struct partition_elem *elements = part->elements;
struct partition_elem *e1;
@@ -126,9 +121,7 @@ partition_union (part, elem1, elem2)
pointer to each. Used to qsort such an array. */
static int
-elem_compare (elem1, elem2)
- const void *elem1;
- const void *elem2;
+elem_compare (const void *elem1, const void *elem2)
{
int e1 = * (const int *) elem1;
int e2 = * (const int *) elem2;
@@ -144,9 +137,7 @@ elem_compare (elem1, elem2)
class are sorted. */
void
-partition_print (part, fp)
- partition part;
- FILE *fp;
+partition_print (partition part, FILE *fp)
{
char *done;
int num_elements = part->num_elements;
diff --git a/libiberty/pex-djgpp.c b/libiberty/pex-djgpp.c
index 968e784..fe5b80b 100644
--- a/libiberty/pex-djgpp.c
+++ b/libiberty/pex-djgpp.c
@@ -49,13 +49,9 @@ static int last_status = 0;
static int last_reaped = 0;
int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
+pexecute (const char *program, char * const *argv, const char *this_pname,
+ const char *temp_base, char **errmsg_fmt,
+ char **errmsg_arg, int flags)
{
int rc;
@@ -82,10 +78,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
}
int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
+pwait (int pid, int *status, int flags)
{
/* On MSDOS each pexecute must be followed by its associated pwait. */
if (pid != last_pid
diff --git a/libiberty/pex-msdos.c b/libiberty/pex-msdos.c
index d61c129..f91e416 100644
--- a/libiberty/pex-msdos.c
+++ b/libiberty/pex-msdos.c
@@ -47,13 +47,9 @@ static int last_status = 0;
static int last_reaped = 0;
int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
+pexecute (const char *program, char * const *argv, const char *this_pname,
+ const char *temp_base, char **errmsg_fmt, char **errmsg_arg,
+ int flags)
{
int rc;
char *scmd, *rf;
@@ -126,10 +122,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
#endif
int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
+pwait (int pid, int *status, int flags)
{
/* On MSDOS each pexecute must be followed by its associated pwait. */
if (pid != last_pid
diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c
index 55a055e..0c5f85c 100644
--- a/libiberty/pex-unix.c
+++ b/libiberty/pex-unix.c
@@ -1,7 +1,7 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. Generic Unix version
(also used for UWIN and VMS).
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of the libiberty library.
@@ -80,14 +80,9 @@ extern int errno;
exactly once and is not an argument, or is marked volatile. */
int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg,
- flagsarg)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base ATTRIBUTE_UNUSED;
- char **errmsg_fmt, **errmsg_arg;
- int flagsarg;
+pexecute (const char *program, char * const *argv, const char *this_pname,
+ const char *temp_base ATTRIBUTE_UNUSED,
+ char **errmsg_fmt, char **errmsg_arg, int flagsarg)
{
int pid;
int pdes[2];
@@ -203,10 +198,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg,
}
int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags ATTRIBUTE_UNUSED;
+pwait (int pid, int *status, int flags ATTRIBUTE_UNUSED)
{
/* ??? Here's an opportunity to canonicalize the values in STATUS.
Needed? */
diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c
index 2b4abdf..8d3cb97 100644
--- a/libiberty/pex-win32.c
+++ b/libiberty/pex-win32.c
@@ -1,6 +1,6 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. Generic Win32 specialization.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of the libiberty library.
@@ -53,8 +53,7 @@ Boston, MA 02111-1307, USA. */
to remove the outermost set of double quotes from all arguments. */
static const char * const *
-fix_argv (argvec)
- char **argvec;
+fix_argv (char **argvec)
{
int i;
char * command0 = argvec[0];
@@ -138,13 +137,10 @@ fix_argv (argvec)
/* Win32 supports pipes */
int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname ATTRIBUTE_UNUSED;
- const char *temp_base ATTRIBUTE_UNUSED;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
+pexecute (const char *program, char * const *argv,
+ const char *this_pname ATTRIBUTE_UNUSED,
+ const char *temp_base ATTRIBUTE_UNUSED,
+ char **errmsg_fmt, char **errmsg_arg, int flags)
{
int pid;
int pdes[2];
@@ -230,10 +226,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
macros. Note that WIFSIGNALED will never be true under CRTDLL. */
int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags ATTRIBUTE_UNUSED;
+pwait (int pid, int *status, int flags ATTRIBUTE_UNUSED)
{
int termstat;
diff --git a/libiberty/physmem.c b/libiberty/physmem.c
index f64e07c..9c6d9cb 100644
--- a/libiberty/physmem.c
+++ b/libiberty/physmem.c
@@ -1,5 +1,5 @@
/* Calculate the size of physical memory.
- Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -80,7 +80,7 @@ typedef WINBOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
/* Return the total amount of physical memory. */
double
-physmem_total ()
+physmem_total (void)
{
#if defined _SC_PHYS_PAGES && defined _SC_PAGESIZE
{ /* This works on linux-gnu, solaris2 and cygwin. */
@@ -184,7 +184,7 @@ physmem_total ()
/* Return the amount of physical memory available. */
double
-physmem_available ()
+physmem_available (void)
{
#if defined _SC_AVPHYS_PAGES && defined _SC_PAGESIZE
{ /* This works on linux-gnu, solaris2 and cygwin. */
@@ -290,7 +290,7 @@ physmem_available ()
# include <stdlib.h>
int
-main ()
+main (void)
{
printf ("%12.f %12.f\n", physmem_total (), physmem_available ());
exit (0);
diff --git a/libiberty/putenv.c b/libiberty/putenv.c
index 6d027dc..e04b759 100644
--- a/libiberty/putenv.c
+++ b/libiberty/putenv.c
@@ -67,8 +67,7 @@ extern char *alloca ();
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
int
-putenv (string)
- const char *string;
+putenv (const char *string)
{
const char *const name_end = strchr (string, '=');
diff --git a/libiberty/random.c b/libiberty/random.c
index 48035f0..c306698 100644
--- a/libiberty/random.c
+++ b/libiberty/random.c
@@ -80,7 +80,7 @@ control over the state of the random number generator.
#endif
-long int random ();
+long int random (void);
/* An improved random number generation package. In addition to the standard
rand()/srand() like interface, this package also has a special state info
@@ -227,8 +227,7 @@ static long int *end_ptr = &randtbl[sizeof(randtbl) / sizeof(randtbl[0])];
introduced by the L.C.R.N.G. Note that the initialization of randtbl[]
for default usage relies on values produced by this routine. */
void
-srandom (x)
- unsigned int x;
+srandom (unsigned int x)
{
state[0] = x;
if (rand_type != TYPE_0)
@@ -255,10 +254,7 @@ srandom (x)
setstate so that it doesn't matter when initstate is called.
Returns a pointer to the old state. */
PTR
-initstate (seed, arg_state, n)
- unsigned int seed;
- PTR arg_state;
- unsigned long n;
+initstate (unsigned int seed, PTR arg_state, unsigned long n)
{
PTR ostate = (PTR) &state[-1];
@@ -324,8 +320,7 @@ initstate (seed, arg_state, n)
Returns a pointer to the old state information. */
PTR
-setstate (arg_state)
- PTR arg_state;
+setstate (PTR arg_state)
{
register long int *new_state = (long int *) arg_state;
register int type = new_state[0] % MAX_TYPES;
@@ -378,7 +373,7 @@ setstate (arg_state)
pointer if the front one has wrapped. Returns a 31-bit random number. */
long int
-random ()
+random (void)
{
if (rand_type == TYPE_0)
{
diff --git a/libiberty/rename.c b/libiberty/rename.c
index 399980a..ad342ff 100644
--- a/libiberty/rename.c
+++ b/libiberty/rename.c
@@ -22,9 +22,7 @@ exists, it is removed.
#endif
int
-rename (zfrom, zto)
- const char *zfrom;
- const char *zto;
+rename (const char *zfrom, const char *zto)
{
if (link (zfrom, zto) < 0)
{
diff --git a/libiberty/rindex.c b/libiberty/rindex.c
index ef9cdc5..741fd8e 100644
--- a/libiberty/rindex.c
+++ b/libiberty/rindex.c
@@ -15,9 +15,7 @@ deprecated in new programs in favor of @code{strrchr}.
extern char *strrchr ();
char *
-rindex (s, c)
- char *s;
- int c;
+rindex (char *s, int c)
{
return strrchr (s, c);
}
diff --git a/libiberty/safe-ctype.c b/libiberty/safe-ctype.c
index 91a0e9a..44ef99f 100644
--- a/libiberty/safe-ctype.c
+++ b/libiberty/safe-ctype.c
@@ -1,6 +1,7 @@
/* <ctype.h> replacement macros.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004,
+ 2005 Free Software Foundation, Inc.
Contributed by Zack Weinberg <zackw@stanford.edu>.
This file is part of the libiberty library.
diff --git a/libiberty/setenv.c b/libiberty/setenv.c
index 8394faf..35f2a31 100644
--- a/libiberty/setenv.c
+++ b/libiberty/setenv.c
@@ -80,10 +80,7 @@ static char **last_environ;
int
-setenv (name, value, replace)
- const char *name;
- const char *value;
- int replace;
+setenv (const char *name, const char *value, int replace)
{
register char **ep = 0;
register size_t size;
@@ -164,8 +161,7 @@ setenv (name, value, replace)
}
void
-unsetenv (name)
- const char *name;
+unsetenv (const char *name)
{
const size_t len = strlen (name);
char **ep;
diff --git a/libiberty/sigsetmask.c b/libiberty/sigsetmask.c
index 4de3e4b..2df96fc 100644
--- a/libiberty/sigsetmask.c
+++ b/libiberty/sigsetmask.c
@@ -21,12 +21,11 @@ be the value @code{1}).
#include <sys/types.h>
#include <signal.h>
-extern void abort PARAMS ((void)) ATTRIBUTE_NORETURN;
+extern void abort (void) ATTRIBUTE_NORETURN;
#ifdef SIG_SETMASK
int
-sigsetmask (set)
- int set;
+sigsetmask (int set)
{
sigset_t new;
sigset_t old;
diff --git a/libiberty/snprintf.c b/libiberty/snprintf.c
index 8916469..d8eb585 100644
--- a/libiberty/snprintf.c
+++ b/libiberty/snprintf.c
@@ -41,18 +41,13 @@ this function is used.
#include "ansidecl.h"
-#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#include <stddef.h>
-#else
-#include <varargs.h>
-#define size_t unsigned long
-#endif
-int vsnprintf PARAMS ((char *, size_t, const char *, va_list));
+int vsnprintf (char *, size_t, const char *, va_list);
int
-snprintf VPARAMS ((char *s, size_t n, const char *format, ...))
+snprintf (char *s, size_t n, const char *format, ...)
{
int result;
VA_OPEN (ap, format);
diff --git a/libiberty/sort.c b/libiberty/sort.c
index 90c97e0..a525b81 100644
--- a/libiberty/sort.c
+++ b/libiberty/sort.c
@@ -44,10 +44,7 @@ Boston, MA 02111-1307, USA. */
/* POINTERS and WORK are both arrays of N pointers. When this
function returns POINTERS will be sorted in ascending order. */
-void sort_pointers (n, pointers, work)
- size_t n;
- void **pointers;
- void **work;
+void sort_pointers (size_t n, void **pointers, void **work)
{
/* The type of a single digit. This can be any unsigned integral
type. When changing this, DIGIT_MAX should be changed as
@@ -140,8 +137,7 @@ void sort_pointers (n, pointers, work)
#include <stdio.h>
-void *xmalloc (n)
- size_t n;
+void *xmalloc (size_t n)
{
return malloc (n);
}
diff --git a/libiberty/spaces.c b/libiberty/spaces.c
index bfead7ed..6df0b13 100644
--- a/libiberty/spaces.c
+++ b/libiberty/spaces.c
@@ -37,13 +37,12 @@ valid until at least the next call.
#include <unixlib.h>
#else
/* For systems with larger pointers than ints, these must be declared. */
-extern PTR malloc PARAMS ((size_t));
-extern void free PARAMS ((PTR));
+extern PTR malloc (size_t);
+extern void free (PTR);
#endif
const char *
-spaces (count)
- int count;
+spaces (int count)
{
register char *t;
static char *buf;
diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c
index b1410aa..29eaf16 100644
--- a/libiberty/splay-tree.c
+++ b/libiberty/splay-tree.c
@@ -37,27 +37,20 @@ Boston, MA 02111-1307, USA. */
#include "libiberty.h"
#include "splay-tree.h"
-static void splay_tree_delete_helper PARAMS((splay_tree,
- splay_tree_node));
-static void splay_tree_splay PARAMS((splay_tree,
- splay_tree_key));
-static splay_tree_node splay_tree_splay_helper
- PARAMS((splay_tree,
+static void splay_tree_delete_helper (splay_tree, splay_tree_node);
+static void splay_tree_splay (splay_tree, splay_tree_key);
+static splay_tree_node splay_tree_splay_helper (splay_tree,
splay_tree_key,
splay_tree_node*,
splay_tree_node*,
- splay_tree_node*));
-static int splay_tree_foreach_helper PARAMS((splay_tree,
- splay_tree_node,
- splay_tree_foreach_fn,
- void*));
+ splay_tree_node*);
+static int splay_tree_foreach_helper (splay_tree, splay_tree_node,
+ splay_tree_foreach_fn, void*);
/* Deallocate NODE (a member of SP), and all its sub-trees. */
static void
-splay_tree_delete_helper (sp, node)
- splay_tree sp;
- splay_tree_node node;
+splay_tree_delete_helper (splay_tree sp, splay_tree_node node)
{
splay_tree_node pending = 0;
splay_tree_node active = 0;
@@ -118,12 +111,9 @@ splay_tree_delete_helper (sp, node)
and grandparent, respectively, of NODE. */
static splay_tree_node
-splay_tree_splay_helper (sp, key, node, parent, grandparent)
- splay_tree sp;
- splay_tree_key key;
- splay_tree_node *node;
- splay_tree_node *parent;
- splay_tree_node *grandparent;
+splay_tree_splay_helper (splay_tree sp, splay_tree_key key,
+ splay_tree_node *node, splay_tree_node *parent,
+ splay_tree_node *grandparent)
{
splay_tree_node *next;
splay_tree_node n;
@@ -229,9 +219,7 @@ splay_tree_splay_helper (sp, key, node, parent, grandparent)
/* Splay SP around KEY. */
static void
-splay_tree_splay (sp, key)
- splay_tree sp;
- splay_tree_key key;
+splay_tree_splay (splay_tree sp, splay_tree_key key)
{
if (sp->root == 0)
return;
@@ -246,11 +234,8 @@ splay_tree_splay (sp, key)
value is returned. Otherwise, this function returns 0. */
static int
-splay_tree_foreach_helper (sp, node, fn, data)
- splay_tree sp;
- splay_tree_node node;
- splay_tree_foreach_fn fn;
- void* data;
+splay_tree_foreach_helper (splay_tree sp, splay_tree_node node,
+ splay_tree_foreach_fn fn, void *data)
{
int val;
@@ -271,17 +256,13 @@ splay_tree_foreach_helper (sp, node, fn, data)
/* An allocator and deallocator based on xmalloc. */
static void *
-splay_tree_xmalloc_allocate (size, data)
- int size;
- void *data ATTRIBUTE_UNUSED;
+splay_tree_xmalloc_allocate (int size, void *data ATTRIBUTE_UNUSED)
{
return (void *) xmalloc (size);
}
static void
-splay_tree_xmalloc_deallocate (object, data)
- void *object;
- void *data ATTRIBUTE_UNUSED;
+splay_tree_xmalloc_deallocate (void *object, void *data ATTRIBUTE_UNUSED)
{
free (object);
}
@@ -293,10 +274,9 @@ splay_tree_xmalloc_deallocate (object, data)
nodes added. */
splay_tree
-splay_tree_new (compare_fn, delete_key_fn, delete_value_fn)
- splay_tree_compare_fn compare_fn;
- splay_tree_delete_key_fn delete_key_fn;
- splay_tree_delete_value_fn delete_value_fn;
+splay_tree_new (splay_tree_compare_fn compare_fn,
+ splay_tree_delete_key_fn delete_key_fn,
+ splay_tree_delete_value_fn delete_value_fn)
{
return (splay_tree_new_with_allocator
(compare_fn, delete_key_fn, delete_value_fn,
@@ -309,14 +289,12 @@ splay_tree_new (compare_fn, delete_key_fn, delete_value_fn)
values. */
splay_tree
-splay_tree_new_with_allocator (compare_fn, delete_key_fn, delete_value_fn,
- allocate_fn, deallocate_fn, allocate_data)
- splay_tree_compare_fn compare_fn;
- splay_tree_delete_key_fn delete_key_fn;
- splay_tree_delete_value_fn delete_value_fn;
- splay_tree_allocate_fn allocate_fn;
- splay_tree_deallocate_fn deallocate_fn;
- void *allocate_data;
+splay_tree_new_with_allocator (splay_tree_compare_fn compare_fn,
+ splay_tree_delete_key_fn delete_key_fn,
+ splay_tree_delete_value_fn delete_value_fn,
+ splay_tree_allocate_fn allocate_fn,
+ splay_tree_deallocate_fn deallocate_fn,
+ void *allocate_data)
{
splay_tree sp = (splay_tree) (*allocate_fn) (sizeof (struct splay_tree_s),
allocate_data);
@@ -334,8 +312,7 @@ splay_tree_new_with_allocator (compare_fn, delete_key_fn, delete_value_fn,
/* Deallocate SP. */
void
-splay_tree_delete (sp)
- splay_tree sp;
+splay_tree_delete (splay_tree sp)
{
splay_tree_delete_helper (sp, sp->root);
(*sp->deallocate) ((char*) sp, sp->allocate_data);
@@ -346,10 +323,7 @@ splay_tree_delete (sp)
with the new value. Returns the new node. */
splay_tree_node
-splay_tree_insert (sp, key, value)
- splay_tree sp;
- splay_tree_key key;
- splay_tree_value value;
+splay_tree_insert (splay_tree sp, splay_tree_key key, splay_tree_value value)
{
int comparison = 0;
@@ -401,9 +375,7 @@ splay_tree_insert (sp, key, value)
/* Remove KEY from SP. It is not an error if it did not exist. */
void
-splay_tree_remove (sp, key)
- splay_tree sp;
- splay_tree_key key;
+splay_tree_remove (splay_tree sp, splay_tree_key key)
{
splay_tree_splay (sp, key);
@@ -443,9 +415,7 @@ splay_tree_remove (sp, key)
otherwise. */
splay_tree_node
-splay_tree_lookup (sp, key)
- splay_tree sp;
- splay_tree_key key;
+splay_tree_lookup (splay_tree sp, splay_tree_key key)
{
splay_tree_splay (sp, key);
@@ -458,8 +428,7 @@ splay_tree_lookup (sp, key)
/* Return the node in SP with the greatest key. */
splay_tree_node
-splay_tree_max (sp)
- splay_tree sp;
+splay_tree_max (splay_tree sp)
{
splay_tree_node n = sp->root;
@@ -475,8 +444,7 @@ splay_tree_max (sp)
/* Return the node in SP with the smallest key. */
splay_tree_node
-splay_tree_min (sp)
- splay_tree sp;
+splay_tree_min (splay_tree sp)
{
splay_tree_node n = sp->root;
@@ -493,9 +461,7 @@ splay_tree_min (sp)
predecessor. KEY need not be present in the tree. */
splay_tree_node
-splay_tree_predecessor (sp, key)
- splay_tree sp;
- splay_tree_key key;
+splay_tree_predecessor (splay_tree sp, splay_tree_key key)
{
int comparison;
splay_tree_node node;
@@ -526,9 +492,7 @@ splay_tree_predecessor (sp, key)
successor. KEY need not be present in the tree. */
splay_tree_node
-splay_tree_successor (sp, key)
- splay_tree sp;
- splay_tree_key key;
+splay_tree_successor (splay_tree sp, splay_tree_key key)
{
int comparison;
splay_tree_node node;
@@ -561,10 +525,7 @@ splay_tree_successor (sp, key)
Otherwise, this function returns 0. */
int
-splay_tree_foreach (sp, fn, data)
- splay_tree sp;
- splay_tree_foreach_fn fn;
- void *data;
+splay_tree_foreach (splay_tree sp, splay_tree_foreach_fn fn, void *data)
{
return splay_tree_foreach_helper (sp, sp->root, fn, data);
}
@@ -572,9 +533,7 @@ splay_tree_foreach (sp, fn, data)
/* Splay-tree comparison function, treating the keys as ints. */
int
-splay_tree_compare_ints (k1, k2)
- splay_tree_key k1;
- splay_tree_key k2;
+splay_tree_compare_ints (splay_tree_key k1, splay_tree_key k2)
{
if ((int) k1 < (int) k2)
return -1;
@@ -587,9 +546,7 @@ splay_tree_compare_ints (k1, k2)
/* Splay-tree comparison function, treating the keys as pointers. */
int
-splay_tree_compare_pointers (k1, k2)
- splay_tree_key k1;
- splay_tree_key k2;
+splay_tree_compare_pointers (splay_tree_key k1, splay_tree_key k2)
{
if ((char*) k1 < (char*) k2)
return -1;
diff --git a/libiberty/stpcpy.c b/libiberty/stpcpy.c
index a589642..b7148d8 100644
--- a/libiberty/stpcpy.c
+++ b/libiberty/stpcpy.c
@@ -30,19 +30,13 @@ Copies the string @var{src} into @var{dst}. Returns a pointer to
*/
#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 memcpy PARAMS ((PTR, const PTR, size_t));
+extern size_t strlen (const char *);
+extern PTR memcpy (PTR, const PTR, size_t);
char *
-stpcpy (dst, src)
- char *dst;
- const char *src;
+stpcpy (char *dst, const char *src)
{
const size_t len = strlen (src);
return (char *) memcpy (dst, src, len + 1) + len;
diff --git a/libiberty/stpncpy.c b/libiberty/stpncpy.c
index cb67b4d..b885d85 100644
--- a/libiberty/stpncpy.c
+++ b/libiberty/stpncpy.c
@@ -32,20 +32,13 @@ strlen(@var{src}).
*/
#include <ansidecl.h>
-#ifdef ANSI_PROTOTYPES
#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
-extern size_t strlen PARAMS ((const char *));
-extern char *strncpy PARAMS ((char *, const char *, size_t));
+extern size_t strlen (const char *);
+extern char *strncpy (char *, const char *, size_t);
char *
-stpncpy (dst, src, len)
- char *dst;
- const char *src;
- size_t len;
+stpncpy (char *dst, const char *src, size_t len)
{
size_t n = strlen (src);
if (n > len)
diff --git a/libiberty/strcasecmp.c b/libiberty/strcasecmp.c
index d2608dc..131d81c 100644
--- a/libiberty/strcasecmp.c
+++ b/libiberty/strcasecmp.c
@@ -25,11 +25,7 @@ static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
#endif /* LIBC_SCCS and not lint */
#include <ansidecl.h>
-#ifdef ANSI_PROTOTYPES
#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
/*
* This array is designed for mapping upper and lower case letter
@@ -73,8 +69,7 @@ static const unsigned char charmap[] = {
};
int
-strcasecmp(s1, s2)
- const char *s1, *s2;
+strcasecmp(const char *s1, const char *s2)
{
register unsigned char u1, u2;
diff --git a/libiberty/strchr.c b/libiberty/strchr.c
index 1f71c51..935805e 100644
--- a/libiberty/strchr.c
+++ b/libiberty/strchr.c
@@ -16,9 +16,7 @@ null character, the results are undefined.
#include <ansidecl.h>
char *
-strchr (s, c)
- register const char *s;
- int c;
+strchr (register const char *s, int c)
{
do {
if (*s == c)
diff --git a/libiberty/strdup.c b/libiberty/strdup.c
index a3f17d3..78c2093 100644
--- a/libiberty/strdup.c
+++ b/libiberty/strdup.c
@@ -10,19 +10,14 @@ Returns a pointer to a copy of @var{s} in memory obtained from
*/
#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));
+extern size_t strlen (const char*);
+extern PTR malloc (size_t);
+extern PTR memcpy (PTR, const PTR, size_t);
char *
-strdup(s)
- const char *s;
+strdup(const char *s)
{
size_t len = strlen (s) + 1;
char *result = (char*) malloc (len);