mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
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
This commit is contained in:
parent
023d54e0f5
commit
7a17ef5e63
@ -1,3 +1,7 @@
|
||||
2005-03-27 Gabriel Dos Reis <gdr@integreable-solutions.net>
|
||||
|
||||
* ternary.h: Don't use PARAMS anymore.
|
||||
|
||||
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
* md5.h: Remove definition and uses of __P.
|
||||
|
@ -38,14 +38,14 @@ ternary_node;
|
||||
already there, and replace is 0.
|
||||
Otherwise, replaces if it it exists, inserts if it doesn't, and
|
||||
returns the data you passed in. */
|
||||
PTR ternary_insert PARAMS ((ternary_tree *p, const char *s,
|
||||
PTR data, int replace));
|
||||
PTR ternary_insert (ternary_tree *p, const char *s,
|
||||
PTR data, int replace);
|
||||
|
||||
/* Delete the ternary search tree rooted at P.
|
||||
Does NOT delete the data you associated with the strings. */
|
||||
void ternary_cleanup PARAMS ((ternary_tree p));
|
||||
void ternary_cleanup (ternary_tree p);
|
||||
|
||||
/* Search the ternary tree for string S, returning the data associated
|
||||
with it if found. */
|
||||
PTR ternary_search PARAMS ((const ternary_node *p, const char *s));
|
||||
PTR ternary_search (const ternary_node *p, const char *s);
|
||||
#endif
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -41,18 +41,14 @@ extern PTR memset ();
|
||||
#undef sys_nsig
|
||||
|
||||
#ifndef NULL
|
||||
# ifdef ANSI_PROTOTYPES
|
||||
# define NULL (void *) 0
|
||||
# else
|
||||
# define NULL 0
|
||||
# endif
|
||||
#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;
|
||||
|
@ -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 ();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 ();
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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 ());
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 (;;)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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) ();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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'.
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user