summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@gcc.gnu.org>2005-03-28 01:28:01 +0000
committerGabriel Dos Reis <gdr@gcc.gnu.org>2005-03-28 01:28:01 +0000
commit7a17ef5e63f029d589de5cb4e499b00cb0f620b5 (patch)
treeb5aec1f785455ee50707717b6c5a6c16dfd4814f /libiberty
parent023d54e0f553da239db6017c5a602ee57e5c4467 (diff)
ternary.h: Don't use PARAMS anymore.
include/ 2005-03-27 Gabriel Dos Reis <gdr@integreable-solutions.net> * ternary.h: Don't use PARAMS anymore. libiberty/ 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. * strncasecmp.c (strncasecmp): Likewise. * strncmp.c (strncmp): Likewise. * strndup.c (strndup): Likewise. * strrchr.c (strrchr): Likewise. * strsignal.c (init_signal_tables, signo_max, strsignal, strsigno, strtosigno, psignal, main): Likewise. * strstr.c (strstr): Likewise. * strtod.c (strtod, atof): Likewise. * strtol.c (strtol): Likewise. * strtoul.c (strtoul): Likewise. * ternary.c (ternary_insert, ternary_cleanup, ternary_search, ternary_recursivesearch): Likewise. * tmpnam.c (tmpnam): Likewise. * unlink-if-ordinary.c (unlink_if_ordinary): Likewise. * vasprintf.c (int_vasprintf, vasprintf, checkit, main): Likewise. * vfork.c (vfork): Likewise. * vfprintf.c (vfprintf): Likewise. * vprintf.c (vprintf): Likewise. * vsnprintf.c (vsnprintf, checkit, main): Likewise. * vsprintf.c (vsprintf): Likewise. * waitpid.c (waitpid): Likewise. * xatexit.c (xatexit, xatexit_cleanup): Likewise. * xexit.c (xexit): Likewise. * xmalloc.c (xmalloc_set_program_name, xmalloc_failed, xmalloc, xcalloc, xrealloc): Likewise. * xmemdup.c (xmemdup): Likewise. * xstrdup.c (xstrdup): Likewise. * xstrerror.c (xstrerror): Likewise. * xstrndup.c (xstrndup): Likewise. From-SVN: r97122
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog35
-rw-r--r--libiberty/strerror.c17
-rw-r--r--libiberty/strncasecmp.c8
-rw-r--r--libiberty/strncmp.c8
-rw-r--r--libiberty/strndup.c14
-rw-r--r--libiberty/strrchr.c4
-rw-r--r--libiberty/strsignal.c27
-rw-r--r--libiberty/strstr.c3
-rw-r--r--libiberty/strtod.c6
-rw-r--r--libiberty/strtol.c5
-rw-r--r--libiberty/strtoul.c5
-rw-r--r--libiberty/ternary.c17
-rw-r--r--libiberty/tmpnam.c5
-rw-r--r--libiberty/unlink-if-ordinary.c3
-rw-r--r--libiberty/vasprintf.c25
-rw-r--r--libiberty/vfork.c4
-rw-r--r--libiberty/vfprintf.c9
-rw-r--r--libiberty/vprintf.c8
-rw-r--r--libiberty/vsnprintf.c18
-rw-r--r--libiberty/vsprintf.c9
-rw-r--r--libiberty/waitpid.c4
-rw-r--r--libiberty/xatexit.c17
-rw-r--r--libiberty/xexit.c5
-rw-r--r--libiberty/xmalloc.c29
-rw-r--r--libiberty/xmemdup.c5
-rw-r--r--libiberty/xstrdup.c3
-rw-r--r--libiberty/xstrerror.c11
-rw-r--r--libiberty/xstrndup.c4
28 files changed, 114 insertions, 194 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index f0a1f649557..60cbe919d08 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,38 @@
+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.
+ * strncasecmp.c (strncasecmp): Likewise.
+ * strncmp.c (strncmp): Likewise.
+ * strndup.c (strndup): Likewise.
+ * strrchr.c (strrchr): Likewise.
+ * strsignal.c (init_signal_tables, signo_max, strsignal,
+ strsigno, strtosigno, psignal, main): Likewise.
+ * strstr.c (strstr): Likewise.
+ * strtod.c (strtod, atof): Likewise.
+ * strtol.c (strtol): Likewise.
+ * strtoul.c (strtoul): Likewise.
+ * ternary.c (ternary_insert, ternary_cleanup, ternary_search,
+ ternary_recursivesearch): Likewise.
+ * tmpnam.c (tmpnam): Likewise.
+ * unlink-if-ordinary.c (unlink_if_ordinary): Likewise.
+ * vasprintf.c (int_vasprintf, vasprintf, checkit, main): Likewise.
+ * vfork.c (vfork): Likewise.
+ * vfprintf.c (vfprintf): Likewise.
+ * vprintf.c (vprintf): Likewise.
+ * vsnprintf.c (vsnprintf, checkit, main): Likewise.
+ * vsprintf.c (vsprintf): Likewise.
+ * waitpid.c (waitpid): Likewise.
+ * xatexit.c (xatexit, xatexit_cleanup): Likewise.
+ * xexit.c (xexit): Likewise.
+ * xmalloc.c (xmalloc_set_program_name, xmalloc_failed, xmalloc,
+ xcalloc, xrealloc): Likewise.
+ * xmemdup.c (xmemdup): Likewise.
+ * xstrdup.c (xstrdup): Likewise.
+ * xstrerror.c (xstrerror): Likewise.
+ * xstrndup.c (xstrndup): Likewise.
+
2005-03-27 Andreas Jaeger <aj@suse.de>
* configure.ac (ac_c_preproc_warn_flag): Remove -Wtraditional
diff --git a/libiberty/strerror.c b/libiberty/strerror.c
index c0edb47e0c8..0efadc3d65e 100644
--- a/libiberty/strerror.c
+++ b/libiberty/strerror.c
@@ -43,7 +43,7 @@ extern PTR memset ();
# define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
-static void init_error_tables PARAMS ((void));
+static void init_error_tables (void);
/* Translation table for errno values. See intro(2) in most UNIX systems
Programmers Reference Manuals.
@@ -503,7 +503,7 @@ BUGS
*/
static void
-init_error_tables ()
+init_error_tables (void)
{
const struct error_info *eip;
int nbytes;
@@ -584,7 +584,7 @@ symbolic name or message.
*/
int
-errno_max ()
+errno_max (void)
{
int maxsize;
@@ -623,8 +623,7 @@ next call to @code{strerror}.
*/
char *
-strerror (errnoval)
- int errnoval;
+strerror (int errnoval)
{
const char *msg;
static char buf[32];
@@ -690,8 +689,7 @@ valid until the next call to @code{strerrno}.
*/
const char *
-strerrno (errnoval)
- int errnoval;
+strerrno (int errnoval)
{
const char *name;
static char buf[32];
@@ -738,8 +736,7 @@ to an errno value. If no translation is found, returns 0.
*/
int
-strtoerrno (name)
- const char *name;
+strtoerrno (const char *name)
{
int errnoval = 0;
@@ -779,7 +776,7 @@ strtoerrno (name)
#include <stdio.h>
int
-main ()
+main (void)
{
int errn;
int errnmax;
diff --git a/libiberty/strncasecmp.c b/libiberty/strncasecmp.c
index 10feee82198..47700dde518 100644
--- a/libiberty/strncasecmp.c
+++ b/libiberty/strncasecmp.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
@@ -72,9 +68,7 @@ static const unsigned char charmap[] = {
};
int
-strncasecmp(s1, s2, n)
- const char *s1, *s2;
- register size_t n;
+strncasecmp(const char *s1, const char *s2, register size_t n)
{
register unsigned char u1, u2;
diff --git a/libiberty/strncmp.c b/libiberty/strncmp.c
index ad87e1fde8b..916c2f07a8a 100644
--- a/libiberty/strncmp.c
+++ b/libiberty/strncmp.c
@@ -13,16 +13,10 @@ Compares the first @var{n} bytes of two strings, returning a value as
*/
#include <ansidecl.h>
-#ifdef ANSI_PROTOTYPES
#include <stddef.h>
-#else
-#define size_t unsigned long
-#endif
int
-strncmp(s1, s2, n)
- const char *s1, *s2;
- register size_t n;
+strncmp(const char *s1, const char *s2, register size_t n)
{
register unsigned char u1, u2;
diff --git a/libiberty/strndup.c b/libiberty/strndup.c
index 3d6b93d3143..b7647777bc5 100644
--- a/libiberty/strndup.c
+++ b/libiberty/strndup.c
@@ -31,20 +31,14 @@ memory was available. The result is always NUL terminated.
*/
#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 *
-strndup(s, n)
- const char *s;
- size_t n;
+strndup (const char *s, size_t n)
{
char *result;
size_t len = strlen (s);
diff --git a/libiberty/strrchr.c b/libiberty/strrchr.c
index bc380c4c5d3..5cf7c14d8b7 100644
--- a/libiberty/strrchr.c
+++ b/libiberty/strrchr.c
@@ -16,9 +16,7 @@ null character, the results are undefined.
#include <ansidecl.h>
char *
-strrchr (s, c)
- register const char *s;
- int c;
+strrchr (register const char *s, int c)
{
char *rtnval = 0;
diff --git a/libiberty/strsignal.c b/libiberty/strsignal.c
index 1ff984debc3..c3a16ab9bdc 100644
--- a/libiberty/strsignal.c
+++ b/libiberty/strsignal.c
@@ -41,18 +41,14 @@ extern PTR memset ();
#undef sys_nsig
#ifndef NULL
-# ifdef ANSI_PROTOTYPES
-# define NULL (void *) 0
-# else
-# define NULL 0
-# endif
+# define NULL (void *) 0
#endif
#ifndef MAX
# define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
-static void init_signal_tables PARAMS ((void));
+static void init_signal_tables (void);
/* Translation table for signal values.
@@ -288,7 +284,7 @@ BUGS
*/
static void
-init_signal_tables ()
+init_signal_tables (void)
{
const struct signal_info *eip;
int nbytes;
@@ -369,7 +365,7 @@ symbolic name or message.
*/
int
-signo_max ()
+signo_max (void)
{
int maxsize;
@@ -409,8 +405,7 @@ call to @code{strsignal}.
#ifndef HAVE_STRSIGNAL
const char *
-strsignal (signo)
- int signo;
+strsignal (int signo)
{
const char *msg;
static char buf[32];
@@ -469,8 +464,7 @@ valid until the next call to @code{strsigno}.
*/
const char *
-strsigno (signo)
- int signo;
+strsigno (int signo)
{
const char *name;
static char buf[32];
@@ -513,8 +507,7 @@ translation is found, returns 0.
*/
int
-strtosigno (name)
- const char *name;
+strtosigno (const char *name)
{
int signo = 0;
@@ -556,9 +549,7 @@ followed by a newline.
#ifndef HAVE_PSIGNAL
void
-psignal (signo, message)
- unsigned signo;
- char *message;
+psignal (unsigned signo, char *message)
{
if (signal_names == NULL)
{
@@ -585,7 +576,7 @@ psignal (signo, message)
#include <stdio.h>
int
-main ()
+main (void)
{
int signo;
int maxsigno;
diff --git a/libiberty/strstr.c b/libiberty/strstr.c
index a059c7f5dcb..ff8abd20f78 100644
--- a/libiberty/strstr.c
+++ b/libiberty/strstr.c
@@ -21,8 +21,7 @@ length, the function returns @var{string}.
been validated to comply with it. -fnf */
char *
-strstr (s1, s2)
- char *s1, *s2;
+strstr (char *s1, char *s2)
{
register char *p = s1;
extern char *strchr ();
diff --git a/libiberty/strtod.c b/libiberty/strtod.c
index 97fc9339344..4f119c46114 100644
--- a/libiberty/strtod.c
+++ b/libiberty/strtod.c
@@ -40,16 +40,14 @@ the location referenced by @var{endptr}.
#include "ansidecl.h"
#include "safe-ctype.h"
-extern double atof ();
+extern double atof (const char *);
/* Disclaimer: this is currently just used by CHILL in GDB and therefore
has not been tested well. It may have been tested for nothing except
that it compiles. */
double
-strtod (str, ptr)
- char *str;
- char **ptr;
+strtod (char *str, char **ptr)
{
char *p;
diff --git a/libiberty/strtol.c b/libiberty/strtol.c
index d9f54cc8f7a..5f2a1cebb20 100644
--- a/libiberty/strtol.c
+++ b/libiberty/strtol.c
@@ -85,10 +85,7 @@ extern int errno;
* alphabets and digits are each contiguous.
*/
long
-strtol(nptr, endptr, base)
- const char *nptr;
- char **endptr;
- register int base;
+strtol(const char *nptr, char **endptr, register int base)
{
register const char *s = nptr;
register unsigned long acc;
diff --git a/libiberty/strtoul.c b/libiberty/strtoul.c
index 66420f268b2..ba80063531e 100644
--- a/libiberty/strtoul.c
+++ b/libiberty/strtoul.c
@@ -58,10 +58,7 @@ extern int errno;
* alphabets and digits are each contiguous.
*/
unsigned long
-strtoul(nptr, endptr, base)
- const char *nptr;
- char **endptr;
- register int base;
+strtoul(const char *nptr, char **endptr, register int base)
{
register const char *s = nptr;
register unsigned long acc;
diff --git a/libiberty/ternary.c b/libiberty/ternary.c
index 056d2cee11e..29cf646934d 100644
--- a/libiberty/ternary.c
+++ b/libiberty/ternary.c
@@ -34,11 +34,7 @@
insertions. */
PTR
-ternary_insert (root, s, data, replace)
- ternary_tree *root;
- const char *s;
- PTR data;
- int replace;
+ternary_insert (ternary_tree *root, const char *s, PTR data, int replace)
{
int diff;
ternary_tree curr, *pcurr;
@@ -98,8 +94,7 @@ ternary_insert (root, s, data, replace)
/* Free the ternary search tree rooted at p. */
void
-ternary_cleanup (p)
- ternary_tree p;
+ternary_cleanup (ternary_tree p)
{
if (p)
{
@@ -113,9 +108,7 @@ ternary_cleanup (p)
/* Non-recursive find of a string in the ternary tree */
PTR
-ternary_search (p, s)
- const ternary_node *p;
- const char *s;
+ternary_search (const ternary_node *p, const char *s)
{
const ternary_node *curr;
int diff, spchar;
@@ -147,9 +140,7 @@ ternary_search (p, s)
/* For those who care, the recursive version of the search. Useful if
you want a starting point for pmsearch or nearsearch. */
static PTR
-ternary_recursivesearch (p, s)
- const ternary_node *p;
- const char *s;
+ternary_recursivesearch (const ternary_node *p, const char *s)
{
if (!p)
return 0;
diff --git a/libiberty/tmpnam.c b/libiberty/tmpnam.c
index 406878c49a3..cc343336642 100644
--- a/libiberty/tmpnam.c
+++ b/libiberty/tmpnam.c
@@ -24,11 +24,10 @@ not be used in new projects. Use @code{mkstemp} instead.
static char tmpnam_buffer[L_tmpnam];
static int tmpnam_counter;
-extern int getpid ();
+extern int getpid (void);
char *
-tmpnam (s)
- char *s;
+tmpnam (char *s)
{
int pid = getpid ();
diff --git a/libiberty/unlink-if-ordinary.c b/libiberty/unlink-if-ordinary.c
index 297b14bbc7d..a389ad4e3dc 100644
--- a/libiberty/unlink-if-ordinary.c
+++ b/libiberty/unlink-if-ordinary.c
@@ -58,8 +58,7 @@ was made to unlink the file because it is special.
#endif
int
-unlink_if_ordinary (name)
- const char *name;
+unlink_if_ordinary (const char *name)
{
struct stat st;
diff --git a/libiberty/vasprintf.c b/libiberty/vasprintf.c
index 7eaf2b18d6f..ff4b5315199 100644
--- a/libiberty/vasprintf.c
+++ b/libiberty/vasprintf.c
@@ -22,11 +22,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#endif
#include <ansidecl.h>
-#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#if !defined (va_copy) && defined (__va_copy)
# define va_copy(d,s) __va_copy((d),(s))
#endif
@@ -62,13 +58,10 @@ not be allocated, minus one is returned and @code{NULL} is stored in
*/
-static int int_vasprintf PARAMS ((char **, const char *, va_list));
+static int int_vasprintf (char **, const char *, va_list);
static int
-int_vasprintf (result, format, args)
- char **result;
- const char *format;
- va_list args;
+int_vasprintf (char **result, const char *format, va_list args)
{
const char *p = format;
/* Add one to make sure that it is never zero, which might cause malloc
@@ -156,13 +149,11 @@ int_vasprintf (result, format, args)
}
int
-vasprintf (result, format, args)
- char **result;
- const char *format;
+vasprintf (char **result, const char *format,
#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
- _BSD_VA_LIST_ args;
+ _BSD_VA_LIST_ args)
#else
- va_list args;
+ va_list args)
#endif
{
return int_vasprintf (result, format, args);
@@ -170,7 +161,7 @@ vasprintf (result, format, args)
#ifdef TEST
static void ATTRIBUTE_PRINTF_1
-checkit VPARAMS ((const char *format, ...))
+checkit (const char *format, ...)
{
char *result;
VA_OPEN (args, format);
@@ -187,10 +178,10 @@ checkit VPARAMS ((const char *format, ...))
free (result);
}
-extern int main PARAMS ((void));
+extern int main (void);
int
-main ()
+main (void)
{
checkit ("%d", 0x12345678);
checkit ("%200d", 5);
diff --git a/libiberty/vfork.c b/libiberty/vfork.c
index 4aa5c21d427..eb4ff622b44 100644
--- a/libiberty/vfork.c
+++ b/libiberty/vfork.c
@@ -13,10 +13,10 @@ Emulates @code{vfork} by calling @code{fork} and returning its value.
#include "ansidecl.h"
-extern int fork PARAMS ((void));
+extern int fork (void);
int
-vfork ()
+vfork (void)
{
return (fork ());
}
diff --git a/libiberty/vfprintf.c b/libiberty/vfprintf.c
index 18f09d47d32..9bd3ed555d0 100644
--- a/libiberty/vfprintf.c
+++ b/libiberty/vfprintf.c
@@ -4,19 +4,12 @@
*/
#include "ansidecl.h"
-#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <stdio.h>
#undef vfprintf
int
-vfprintf (stream, format, ap)
- FILE * stream;
- const char * format;
- va_list ap;
+vfprintf (FILE *stream, const char *format, va_list ap)
{
return _doprnt (format, ap, stream);
}
diff --git a/libiberty/vprintf.c b/libiberty/vprintf.c
index 9487896ea5e..c2553167bab 100644
--- a/libiberty/vprintf.c
+++ b/libiberty/vprintf.c
@@ -16,17 +16,11 @@ nonstandard but common function @code{_doprnt}.
*/
#include <ansidecl.h>
-#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <stdio.h>
#undef vprintf
int
-vprintf (format, ap)
- const char *format;
- va_list ap;
+vprintf (const char *format, va_list ap)
{
return vfprintf (stdout, format, ap);
}
diff --git a/libiberty/vsnprintf.c b/libiberty/vsnprintf.c
index fd3dd18a91c..8d4a1e218b4 100644
--- a/libiberty/vsnprintf.c
+++ b/libiberty/vsnprintf.c
@@ -1,5 +1,5 @@
/* Implement the vsnprintf 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. This library is free
@@ -42,11 +42,7 @@ system version of this function is used.
#include "config.h"
#include "ansidecl.h"
-#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
@@ -58,11 +54,7 @@ system version of this function is used.
/* This implementation relies on a working vasprintf. */
int
-vsnprintf (s, n, format, ap)
- char * s;
- size_t n;
- const char *format;
- va_list ap;
+vsnprintf (char *s, size_t n, const char *format, va_list ap)
{
char *buf = 0;
int result = vasprintf (&buf, format, ap);
@@ -97,7 +89,7 @@ vsnprintf (s, n, format, ap)
#define VERIFY(P) do { if (!(P)) abort(); } while (0)
static int ATTRIBUTE_PRINTF_3
-checkit VPARAMS ((char *s, size_t n, const char *format, ...))
+checkit (char *s, size_t n, const char *format, ...)
{
int result;
VA_OPEN (ap, format);
@@ -109,9 +101,9 @@ checkit VPARAMS ((char *s, size_t n, const char *format, ...))
return result;
}
-extern int main PARAMS ((void));
+extern int main (void);
int
-main ()
+main (void)
{
char buf[128];
int status;
diff --git a/libiberty/vsprintf.c b/libiberty/vsprintf.c
index 9f09d7e2758..4132ff9098a 100644
--- a/libiberty/vsprintf.c
+++ b/libiberty/vsprintf.c
@@ -27,21 +27,14 @@ This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
#include <ansidecl.h>
-#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <stdio.h>
#undef vsprintf
#if defined _IOSTRG && defined _IOWRT
int
-vsprintf (buf, format, ap)
- char *buf;
- const char *format;
- va_list ap;
+vsprintf (char *buf, const char *format, va_list ap)
{
FILE b;
int ret;
diff --git a/libiberty/waitpid.c b/libiberty/waitpid.c
index 6e31f25e305..33f2f8e38cc 100644
--- a/libiberty/waitpid.c
+++ b/libiberty/waitpid.c
@@ -23,9 +23,7 @@ does the return value. The third argument is unused in @libib{}.
#endif
pid_t
-waitpid (pid, stat_loc, options)
- pid_t pid;
- int *stat_loc, options;
+waitpid (pid_t pid, int *stat_loc, int options)
{
for (;;)
{
diff --git a/libiberty/xatexit.c b/libiberty/xatexit.c
index 075599c61f9..f29338a9f2a 100644
--- a/libiberty/xatexit.c
+++ b/libiberty/xatexit.c
@@ -27,31 +27,27 @@ failure. If you use @code{xatexit} to register functions, you must use
#include <stdio.h>
-#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));
+PTR malloc (size_t);
#endif
-static void xatexit_cleanup PARAMS ((void));
+static void xatexit_cleanup (void);
/* Pointer to function run by xexit. */
-extern void (*_xexit_cleanup) PARAMS ((void));
+extern void (*_xexit_cleanup) (void);
#define XATEXIT_SIZE 32
struct xatexit {
struct xatexit *next; /* next in list */
int ind; /* next index in this table */
- void (*fns[XATEXIT_SIZE]) PARAMS ((void)); /* the table itself */
+ void (*fns[XATEXIT_SIZE]) (void); /* the table itself */
};
/* Allocate one struct statically to guarantee that we can register
@@ -65,8 +61,7 @@ static struct xatexit *xatexit_head = &xatexit_first;
Return 0 if successful, -1 if not. */
int
-xatexit (fn)
- void (*fn) PARAMS ((void));
+xatexit (void (*fn) (void))
{
register struct xatexit *p;
@@ -90,7 +85,7 @@ xatexit (fn)
/* Call any cleanup functions. */
static void
-xatexit_cleanup ()
+xatexit_cleanup (void)
{
register struct xatexit *p;
register int n;
diff --git a/libiberty/xexit.c b/libiberty/xexit.c
index a65690f09c3..552db65df6d 100644
--- a/libiberty/xexit.c
+++ b/libiberty/xexit.c
@@ -41,11 +41,10 @@ Termination is handled via the system's normal @code{exit} call.
/* This variable is set by xatexit if it is called. This way, xmalloc
doesn't drag xatexit into the link. */
-void (*_xexit_cleanup) PARAMS ((void));
+void (*_xexit_cleanup) (void);
void
-xexit (code)
- int code;
+xexit (int code)
{
if (_xexit_cleanup != NULL)
(*_xexit_cleanup) ();
diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c
index c3fe1a84f4d..ac1f6cb9432 100644
--- a/libiberty/xmalloc.c
+++ b/libiberty/xmalloc.c
@@ -68,22 +68,17 @@ function will be called to print an error message and terminate execution.
#include <stdio.h>
-#ifdef ANSI_PROTOTYPES
#include <stddef.h>
-#else
-#define size_t unsigned long
-#define ptrdiff_t long
-#endif
#if VMS
#include <stdlib.h>
#include <unixlib.h>
#else
/* For systems with larger pointers than ints, these must be declared. */
-PTR malloc PARAMS ((size_t));
-PTR realloc PARAMS ((PTR, size_t));
-PTR calloc PARAMS ((size_t, size_t));
-PTR sbrk PARAMS ((ptrdiff_t));
+PTR malloc (size_t);
+PTR realloc (PTR, size_t);
+PTR calloc (size_t, size_t);
+PTR sbrk (ptrdiff_t);
#endif
/* The program name if set. */
@@ -96,8 +91,7 @@ static char *first_break = NULL;
#endif /* HAVE_SBRK */
void
-xmalloc_set_program_name (s)
- const char *s;
+xmalloc_set_program_name (const char *s)
{
name = s;
#ifdef HAVE_SBRK
@@ -108,8 +102,7 @@ xmalloc_set_program_name (s)
}
void
-xmalloc_failed (size)
- size_t size;
+xmalloc_failed (size_t size)
{
#ifdef HAVE_SBRK
extern char **environ;
@@ -133,8 +126,7 @@ xmalloc_failed (size)
}
PTR
-xmalloc (size)
- size_t size;
+xmalloc (size_t size)
{
PTR newmem;
@@ -148,8 +140,7 @@ xmalloc (size)
}
PTR
-xcalloc (nelem, elsize)
- size_t nelem, elsize;
+xcalloc (size_t nelem, size_t elsize)
{
PTR newmem;
@@ -164,9 +155,7 @@ xcalloc (nelem, elsize)
}
PTR
-xrealloc (oldmem, size)
- PTR oldmem;
- size_t size;
+xrealloc (PTR oldmem, size_t size)
{
PTR newmem;
diff --git a/libiberty/xmemdup.c b/libiberty/xmemdup.c
index 0dae37d8923..d4831163a20 100644
--- a/libiberty/xmemdup.c
+++ b/libiberty/xmemdup.c
@@ -31,10 +31,7 @@ allocated, the remaining memory is zeroed.
#endif
PTR
-xmemdup (input, copy_size, alloc_size)
- const PTR input;
- size_t copy_size;
- size_t alloc_size;
+xmemdup (const PTR input, size_t copy_size, size_t alloc_size)
{
PTR output = xcalloc (1, alloc_size);
return (PTR) memcpy (output, input, copy_size);
diff --git a/libiberty/xstrdup.c b/libiberty/xstrdup.c
index 5ddd2e98a93..c04623d98ec 100644
--- a/libiberty/xstrdup.c
+++ b/libiberty/xstrdup.c
@@ -28,8 +28,7 @@ obtain memory.
#include "libiberty.h"
char *
-xstrdup (s)
- const char *s;
+xstrdup (const char *s)
{
register size_t len = strlen (s) + 1;
register char *ret = xmalloc (len);
diff --git a/libiberty/xstrerror.c b/libiberty/xstrerror.c
index e3f1ca04a26..01f3a7b961a 100644
--- a/libiberty/xstrerror.c
+++ b/libiberty/xstrerror.c
@@ -21,13 +21,13 @@ will never return a @code{NULL} pointer.
#ifdef VMS
#include <errno.h>
#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES)
-extern char *strerror PARAMS ((int,...));
+extern char *strerror (int,...);
#define DONT_DECLARE_STRERROR
#endif
#endif /* VMS */
#ifndef DONT_DECLARE_STRERROR
-extern char *strerror PARAMS ((int));
+extern char *strerror (int);
#endif
/* If strerror returns NULL, we'll format the number into a static buffer. */
@@ -38,15 +38,14 @@ static char xstrerror_buf[sizeof ERRSTR_FMT + 20];
/* Like strerror, but result is never a null pointer. */
char *
-xstrerror (errnum)
- int errnum;
+xstrerror (int errnum)
{
char *errstr;
#ifdef VMS
- char *(*vmslib_strerror) PARAMS ((int,...));
+ char *(*vmslib_strerror) (int,...);
/* Override any possibly-conflicting declaration from system header. */
- vmslib_strerror = (char *(*) PARAMS ((int,...))) strerror;
+ vmslib_strerror = (char *(*) (int,...)) strerror;
/* Second argument matters iff first is EVMSERR, but it's simpler to
pass it unconditionally. `vaxc$errno' is declared in <errno.h>
and maintained by the run-time library in parallel to `errno'.
diff --git a/libiberty/xstrndup.c b/libiberty/xstrndup.c
index b481e4ad712..8dfaa9b43e6 100644
--- a/libiberty/xstrndup.c
+++ b/libiberty/xstrndup.c
@@ -45,9 +45,7 @@ always NUL terminated.
#include "libiberty.h"
char *
-xstrndup (s, n)
- const char *s;
- size_t n;
+xstrndup (const char *s, size_t n)
{
char *result;
size_t len = strlen (s);