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>
|
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||||
|
|
||||||
* md5.h: Remove definition and uses of __P.
|
* md5.h: Remove definition and uses of __P.
|
||||||
|
@ -38,14 +38,14 @@ ternary_node;
|
|||||||
already there, and replace is 0.
|
already there, and replace is 0.
|
||||||
Otherwise, replaces if it it exists, inserts if it doesn't, and
|
Otherwise, replaces if it it exists, inserts if it doesn't, and
|
||||||
returns the data you passed in. */
|
returns the data you passed in. */
|
||||||
PTR ternary_insert PARAMS ((ternary_tree *p, const char *s,
|
PTR ternary_insert (ternary_tree *p, const char *s,
|
||||||
PTR data, int replace));
|
PTR data, int replace);
|
||||||
|
|
||||||
/* Delete the ternary search tree rooted at P.
|
/* Delete the ternary search tree rooted at P.
|
||||||
Does NOT delete the data you associated with the strings. */
|
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
|
/* Search the ternary tree for string S, returning the data associated
|
||||||
with it if found. */
|
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
|
#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>
|
2005-03-27 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
* configure.ac (ac_c_preproc_warn_flag): Remove -Wtraditional
|
* configure.ac (ac_c_preproc_warn_flag): Remove -Wtraditional
|
||||||
|
@ -43,7 +43,7 @@ extern PTR memset ();
|
|||||||
# define MAX(a,b) ((a) > (b) ? (a) : (b))
|
# define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||||
#endif
|
#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
|
/* Translation table for errno values. See intro(2) in most UNIX systems
|
||||||
Programmers Reference Manuals.
|
Programmers Reference Manuals.
|
||||||
@ -503,7 +503,7 @@ BUGS
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_error_tables ()
|
init_error_tables (void)
|
||||||
{
|
{
|
||||||
const struct error_info *eip;
|
const struct error_info *eip;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
@ -584,7 +584,7 @@ symbolic name or message.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
errno_max ()
|
errno_max (void)
|
||||||
{
|
{
|
||||||
int maxsize;
|
int maxsize;
|
||||||
|
|
||||||
@ -623,8 +623,7 @@ next call to @code{strerror}.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strerror (errnoval)
|
strerror (int errnoval)
|
||||||
int errnoval;
|
|
||||||
{
|
{
|
||||||
const char *msg;
|
const char *msg;
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
@ -690,8 +689,7 @@ valid until the next call to @code{strerrno}.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
strerrno (errnoval)
|
strerrno (int errnoval)
|
||||||
int errnoval;
|
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
@ -738,8 +736,7 @@ to an errno value. If no translation is found, returns 0.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
strtoerrno (name)
|
strtoerrno (const char *name)
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
int errnoval = 0;
|
int errnoval = 0;
|
||||||
|
|
||||||
@ -779,7 +776,7 @@ strtoerrno (name)
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
int errn;
|
int errn;
|
||||||
int errnmax;
|
int errnmax;
|
||||||
|
@ -25,11 +25,7 @@ static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
|
|||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This array is designed for mapping upper and lower case letter
|
* This array is designed for mapping upper and lower case letter
|
||||||
@ -72,9 +68,7 @@ static const unsigned char charmap[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
strncasecmp(s1, s2, n)
|
strncasecmp(const char *s1, const char *s2, register size_t n)
|
||||||
const char *s1, *s2;
|
|
||||||
register size_t n;
|
|
||||||
{
|
{
|
||||||
register unsigned char u1, u2;
|
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>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
strncmp(s1, s2, n)
|
strncmp(const char *s1, const char *s2, register size_t n)
|
||||||
const char *s1, *s2;
|
|
||||||
register size_t n;
|
|
||||||
{
|
{
|
||||||
register unsigned char u1, u2;
|
register unsigned char u1, u2;
|
||||||
|
|
||||||
|
@ -31,20 +31,14 @@ memory was available. The result is always NUL terminated.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern size_t strlen PARAMS ((const char*));
|
extern size_t strlen (const char*);
|
||||||
extern PTR malloc PARAMS ((size_t));
|
extern PTR malloc (size_t);
|
||||||
extern PTR memcpy PARAMS ((PTR, const PTR, size_t));
|
extern PTR memcpy (PTR, const PTR, size_t);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strndup(s, n)
|
strndup (const char *s, size_t n)
|
||||||
const char *s;
|
|
||||||
size_t n;
|
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
size_t len = strlen (s);
|
size_t len = strlen (s);
|
||||||
|
@ -16,9 +16,7 @@ null character, the results are undefined.
|
|||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strrchr (s, c)
|
strrchr (register const char *s, int c)
|
||||||
register const char *s;
|
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
char *rtnval = 0;
|
char *rtnval = 0;
|
||||||
|
|
||||||
|
@ -41,18 +41,14 @@ extern PTR memset ();
|
|||||||
#undef sys_nsig
|
#undef sys_nsig
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
# ifdef ANSI_PROTOTYPES
|
# define NULL (void *) 0
|
||||||
# define NULL (void *) 0
|
|
||||||
# else
|
|
||||||
# define NULL 0
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MAX
|
#ifndef MAX
|
||||||
# define MAX(a,b) ((a) > (b) ? (a) : (b))
|
# define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void init_signal_tables PARAMS ((void));
|
static void init_signal_tables (void);
|
||||||
|
|
||||||
/* Translation table for signal values.
|
/* Translation table for signal values.
|
||||||
|
|
||||||
@ -288,7 +284,7 @@ BUGS
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_signal_tables ()
|
init_signal_tables (void)
|
||||||
{
|
{
|
||||||
const struct signal_info *eip;
|
const struct signal_info *eip;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
@ -369,7 +365,7 @@ symbolic name or message.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
signo_max ()
|
signo_max (void)
|
||||||
{
|
{
|
||||||
int maxsize;
|
int maxsize;
|
||||||
|
|
||||||
@ -409,8 +405,7 @@ call to @code{strsignal}.
|
|||||||
#ifndef HAVE_STRSIGNAL
|
#ifndef HAVE_STRSIGNAL
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
strsignal (signo)
|
strsignal (int signo)
|
||||||
int signo;
|
|
||||||
{
|
{
|
||||||
const char *msg;
|
const char *msg;
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
@ -469,8 +464,7 @@ valid until the next call to @code{strsigno}.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
strsigno (signo)
|
strsigno (int signo)
|
||||||
int signo;
|
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
@ -513,8 +507,7 @@ translation is found, returns 0.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
strtosigno (name)
|
strtosigno (const char *name)
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
int signo = 0;
|
int signo = 0;
|
||||||
|
|
||||||
@ -556,9 +549,7 @@ followed by a newline.
|
|||||||
#ifndef HAVE_PSIGNAL
|
#ifndef HAVE_PSIGNAL
|
||||||
|
|
||||||
void
|
void
|
||||||
psignal (signo, message)
|
psignal (unsigned signo, char *message)
|
||||||
unsigned signo;
|
|
||||||
char *message;
|
|
||||||
{
|
{
|
||||||
if (signal_names == NULL)
|
if (signal_names == NULL)
|
||||||
{
|
{
|
||||||
@ -585,7 +576,7 @@ psignal (signo, message)
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
int signo;
|
int signo;
|
||||||
int maxsigno;
|
int maxsigno;
|
||||||
|
@ -21,8 +21,7 @@ length, the function returns @var{string}.
|
|||||||
been validated to comply with it. -fnf */
|
been validated to comply with it. -fnf */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strstr (s1, s2)
|
strstr (char *s1, char *s2)
|
||||||
char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
register char *p = s1;
|
register char *p = s1;
|
||||||
extern char *strchr ();
|
extern char *strchr ();
|
||||||
|
@ -40,16 +40,14 @@ the location referenced by @var{endptr}.
|
|||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
#include "safe-ctype.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
|
/* 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
|
has not been tested well. It may have been tested for nothing except
|
||||||
that it compiles. */
|
that it compiles. */
|
||||||
|
|
||||||
double
|
double
|
||||||
strtod (str, ptr)
|
strtod (char *str, char **ptr)
|
||||||
char *str;
|
|
||||||
char **ptr;
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
@ -85,10 +85,7 @@ extern int errno;
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
long
|
long
|
||||||
strtol(nptr, endptr, base)
|
strtol(const char *nptr, char **endptr, register int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
register int base;
|
|
||||||
{
|
{
|
||||||
register const char *s = nptr;
|
register const char *s = nptr;
|
||||||
register unsigned long acc;
|
register unsigned long acc;
|
||||||
|
@ -58,10 +58,7 @@ extern int errno;
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
unsigned long
|
unsigned long
|
||||||
strtoul(nptr, endptr, base)
|
strtoul(const char *nptr, char **endptr, register int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
register int base;
|
|
||||||
{
|
{
|
||||||
register const char *s = nptr;
|
register const char *s = nptr;
|
||||||
register unsigned long acc;
|
register unsigned long acc;
|
||||||
|
@ -34,11 +34,7 @@
|
|||||||
insertions. */
|
insertions. */
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
ternary_insert (root, s, data, replace)
|
ternary_insert (ternary_tree *root, const char *s, PTR data, int replace)
|
||||||
ternary_tree *root;
|
|
||||||
const char *s;
|
|
||||||
PTR data;
|
|
||||||
int replace;
|
|
||||||
{
|
{
|
||||||
int diff;
|
int diff;
|
||||||
ternary_tree curr, *pcurr;
|
ternary_tree curr, *pcurr;
|
||||||
@ -98,8 +94,7 @@ ternary_insert (root, s, data, replace)
|
|||||||
|
|
||||||
/* Free the ternary search tree rooted at p. */
|
/* Free the ternary search tree rooted at p. */
|
||||||
void
|
void
|
||||||
ternary_cleanup (p)
|
ternary_cleanup (ternary_tree p)
|
||||||
ternary_tree p;
|
|
||||||
{
|
{
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
@ -113,9 +108,7 @@ ternary_cleanup (p)
|
|||||||
|
|
||||||
/* Non-recursive find of a string in the ternary tree */
|
/* Non-recursive find of a string in the ternary tree */
|
||||||
PTR
|
PTR
|
||||||
ternary_search (p, s)
|
ternary_search (const ternary_node *p, const char *s)
|
||||||
const ternary_node *p;
|
|
||||||
const char *s;
|
|
||||||
{
|
{
|
||||||
const ternary_node *curr;
|
const ternary_node *curr;
|
||||||
int diff, spchar;
|
int diff, spchar;
|
||||||
@ -147,9 +140,7 @@ ternary_search (p, s)
|
|||||||
/* For those who care, the recursive version of the search. Useful if
|
/* For those who care, the recursive version of the search. Useful if
|
||||||
you want a starting point for pmsearch or nearsearch. */
|
you want a starting point for pmsearch or nearsearch. */
|
||||||
static PTR
|
static PTR
|
||||||
ternary_recursivesearch (p, s)
|
ternary_recursivesearch (const ternary_node *p, const char *s)
|
||||||
const ternary_node *p;
|
|
||||||
const char *s;
|
|
||||||
{
|
{
|
||||||
if (!p)
|
if (!p)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -24,11 +24,10 @@ not be used in new projects. Use @code{mkstemp} instead.
|
|||||||
static char tmpnam_buffer[L_tmpnam];
|
static char tmpnam_buffer[L_tmpnam];
|
||||||
static int tmpnam_counter;
|
static int tmpnam_counter;
|
||||||
|
|
||||||
extern int getpid ();
|
extern int getpid (void);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
tmpnam (s)
|
tmpnam (char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
int pid = getpid ();
|
int pid = getpid ();
|
||||||
|
|
||||||
|
@ -58,8 +58,7 @@ was made to unlink the file because it is special.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
unlink_if_ordinary (name)
|
unlink_if_ordinary (const char *name)
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
@ -22,11 +22,7 @@ Boston, MA 02111-1307, USA. */
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
#if !defined (va_copy) && defined (__va_copy)
|
#if !defined (va_copy) && defined (__va_copy)
|
||||||
# define va_copy(d,s) __va_copy((d),(s))
|
# define va_copy(d,s) __va_copy((d),(s))
|
||||||
#endif
|
#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
|
static int
|
||||||
int_vasprintf (result, format, args)
|
int_vasprintf (char **result, const char *format, va_list args)
|
||||||
char **result;
|
|
||||||
const char *format;
|
|
||||||
va_list args;
|
|
||||||
{
|
{
|
||||||
const char *p = format;
|
const char *p = format;
|
||||||
/* Add one to make sure that it is never zero, which might cause malloc
|
/* Add one to make sure that it is never zero, which might cause malloc
|
||||||
@ -156,13 +149,11 @@ int_vasprintf (result, format, args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vasprintf (result, format, args)
|
vasprintf (char **result, const char *format,
|
||||||
char **result;
|
|
||||||
const char *format;
|
|
||||||
#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
|
#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
|
||||||
_BSD_VA_LIST_ args;
|
_BSD_VA_LIST_ args)
|
||||||
#else
|
#else
|
||||||
va_list args;
|
va_list args)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
return int_vasprintf (result, format, args);
|
return int_vasprintf (result, format, args);
|
||||||
@ -170,7 +161,7 @@ vasprintf (result, format, args)
|
|||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
static void ATTRIBUTE_PRINTF_1
|
static void ATTRIBUTE_PRINTF_1
|
||||||
checkit VPARAMS ((const char *format, ...))
|
checkit (const char *format, ...)
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
VA_OPEN (args, format);
|
VA_OPEN (args, format);
|
||||||
@ -187,10 +178,10 @@ checkit VPARAMS ((const char *format, ...))
|
|||||||
free (result);
|
free (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int main PARAMS ((void));
|
extern int main (void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
checkit ("%d", 0x12345678);
|
checkit ("%d", 0x12345678);
|
||||||
checkit ("%200d", 5);
|
checkit ("%200d", 5);
|
||||||
|
@ -13,10 +13,10 @@ Emulates @code{vfork} by calling @code{fork} and returning its value.
|
|||||||
|
|
||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
|
|
||||||
extern int fork PARAMS ((void));
|
extern int fork (void);
|
||||||
|
|
||||||
int
|
int
|
||||||
vfork ()
|
vfork (void)
|
||||||
{
|
{
|
||||||
return (fork ());
|
return (fork ());
|
||||||
}
|
}
|
||||||
|
@ -4,19 +4,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#undef vfprintf
|
#undef vfprintf
|
||||||
|
|
||||||
int
|
int
|
||||||
vfprintf (stream, format, ap)
|
vfprintf (FILE *stream, const char *format, va_list ap)
|
||||||
FILE * stream;
|
|
||||||
const char * format;
|
|
||||||
va_list ap;
|
|
||||||
{
|
{
|
||||||
return _doprnt (format, ap, stream);
|
return _doprnt (format, ap, stream);
|
||||||
}
|
}
|
||||||
|
@ -16,17 +16,11 @@ nonstandard but common function @code{_doprnt}.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#undef vprintf
|
#undef vprintf
|
||||||
int
|
int
|
||||||
vprintf (format, ap)
|
vprintf (const char *format, va_list ap)
|
||||||
const char *format;
|
|
||||||
va_list ap;
|
|
||||||
{
|
{
|
||||||
return vfprintf (stdout, format, ap);
|
return vfprintf (stdout, format, ap);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Implement the vsnprintf function.
|
/* 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>.
|
Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
|
||||||
|
|
||||||
This file is part of the libiberty library. This library is free
|
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 "config.h"
|
||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
|
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STRING_H
|
#ifdef HAVE_STRING_H
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
@ -58,11 +54,7 @@ system version of this function is used.
|
|||||||
|
|
||||||
/* This implementation relies on a working vasprintf. */
|
/* This implementation relies on a working vasprintf. */
|
||||||
int
|
int
|
||||||
vsnprintf (s, n, format, ap)
|
vsnprintf (char *s, size_t n, const char *format, va_list ap)
|
||||||
char * s;
|
|
||||||
size_t n;
|
|
||||||
const char *format;
|
|
||||||
va_list ap;
|
|
||||||
{
|
{
|
||||||
char *buf = 0;
|
char *buf = 0;
|
||||||
int result = vasprintf (&buf, format, ap);
|
int result = vasprintf (&buf, format, ap);
|
||||||
@ -97,7 +89,7 @@ vsnprintf (s, n, format, ap)
|
|||||||
#define VERIFY(P) do { if (!(P)) abort(); } while (0)
|
#define VERIFY(P) do { if (!(P)) abort(); } while (0)
|
||||||
|
|
||||||
static int ATTRIBUTE_PRINTF_3
|
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;
|
int result;
|
||||||
VA_OPEN (ap, format);
|
VA_OPEN (ap, format);
|
||||||
@ -109,9 +101,9 @@ checkit VPARAMS ((char *s, size_t n, const char *format, ...))
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int main PARAMS ((void));
|
extern int main (void);
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
int status;
|
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. */
|
the executable file might be covered by the GNU General Public License. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#undef vsprintf
|
#undef vsprintf
|
||||||
|
|
||||||
#if defined _IOSTRG && defined _IOWRT
|
#if defined _IOSTRG && defined _IOWRT
|
||||||
|
|
||||||
int
|
int
|
||||||
vsprintf (buf, format, ap)
|
vsprintf (char *buf, const char *format, va_list ap)
|
||||||
char *buf;
|
|
||||||
const char *format;
|
|
||||||
va_list ap;
|
|
||||||
{
|
{
|
||||||
FILE b;
|
FILE b;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -23,9 +23,7 @@ does the return value. The third argument is unused in @libib{}.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
waitpid (pid, stat_loc, options)
|
waitpid (pid_t pid, int *stat_loc, int options)
|
||||||
pid_t pid;
|
|
||||||
int *stat_loc, options;
|
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -27,31 +27,27 @@ failure. If you use @code{xatexit} to register functions, you must use
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if VMS
|
#if VMS
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unixlib.h>
|
#include <unixlib.h>
|
||||||
#else
|
#else
|
||||||
/* For systems with larger pointers than ints, this must be declared. */
|
/* For systems with larger pointers than ints, this must be declared. */
|
||||||
PTR malloc PARAMS ((size_t));
|
PTR malloc (size_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void xatexit_cleanup PARAMS ((void));
|
static void xatexit_cleanup (void);
|
||||||
|
|
||||||
/* Pointer to function run by xexit. */
|
/* Pointer to function run by xexit. */
|
||||||
extern void (*_xexit_cleanup) PARAMS ((void));
|
extern void (*_xexit_cleanup) (void);
|
||||||
|
|
||||||
#define XATEXIT_SIZE 32
|
#define XATEXIT_SIZE 32
|
||||||
|
|
||||||
struct xatexit {
|
struct xatexit {
|
||||||
struct xatexit *next; /* next in list */
|
struct xatexit *next; /* next in list */
|
||||||
int ind; /* next index in this table */
|
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
|
/* 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. */
|
Return 0 if successful, -1 if not. */
|
||||||
|
|
||||||
int
|
int
|
||||||
xatexit (fn)
|
xatexit (void (*fn) (void))
|
||||||
void (*fn) PARAMS ((void));
|
|
||||||
{
|
{
|
||||||
register struct xatexit *p;
|
register struct xatexit *p;
|
||||||
|
|
||||||
@ -90,7 +85,7 @@ xatexit (fn)
|
|||||||
/* Call any cleanup functions. */
|
/* Call any cleanup functions. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xatexit_cleanup ()
|
xatexit_cleanup (void)
|
||||||
{
|
{
|
||||||
register struct xatexit *p;
|
register struct xatexit *p;
|
||||||
register int n;
|
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
|
/* This variable is set by xatexit if it is called. This way, xmalloc
|
||||||
doesn't drag xatexit into the link. */
|
doesn't drag xatexit into the link. */
|
||||||
void (*_xexit_cleanup) PARAMS ((void));
|
void (*_xexit_cleanup) (void);
|
||||||
|
|
||||||
void
|
void
|
||||||
xexit (code)
|
xexit (int code)
|
||||||
int code;
|
|
||||||
{
|
{
|
||||||
if (_xexit_cleanup != NULL)
|
if (_xexit_cleanup != NULL)
|
||||||
(*_xexit_cleanup) ();
|
(*_xexit_cleanup) ();
|
||||||
|
@ -68,22 +68,17 @@ function will be called to print an error message and terminate execution.
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#define ptrdiff_t long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if VMS
|
#if VMS
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unixlib.h>
|
#include <unixlib.h>
|
||||||
#else
|
#else
|
||||||
/* For systems with larger pointers than ints, these must be declared. */
|
/* For systems with larger pointers than ints, these must be declared. */
|
||||||
PTR malloc PARAMS ((size_t));
|
PTR malloc (size_t);
|
||||||
PTR realloc PARAMS ((PTR, size_t));
|
PTR realloc (PTR, size_t);
|
||||||
PTR calloc PARAMS ((size_t, size_t));
|
PTR calloc (size_t, size_t);
|
||||||
PTR sbrk PARAMS ((ptrdiff_t));
|
PTR sbrk (ptrdiff_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The program name if set. */
|
/* The program name if set. */
|
||||||
@ -96,8 +91,7 @@ static char *first_break = NULL;
|
|||||||
#endif /* HAVE_SBRK */
|
#endif /* HAVE_SBRK */
|
||||||
|
|
||||||
void
|
void
|
||||||
xmalloc_set_program_name (s)
|
xmalloc_set_program_name (const char *s)
|
||||||
const char *s;
|
|
||||||
{
|
{
|
||||||
name = s;
|
name = s;
|
||||||
#ifdef HAVE_SBRK
|
#ifdef HAVE_SBRK
|
||||||
@ -108,8 +102,7 @@ xmalloc_set_program_name (s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xmalloc_failed (size)
|
xmalloc_failed (size_t size)
|
||||||
size_t size;
|
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SBRK
|
#ifdef HAVE_SBRK
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
@ -133,8 +126,7 @@ xmalloc_failed (size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
xmalloc (size)
|
xmalloc (size_t size)
|
||||||
size_t size;
|
|
||||||
{
|
{
|
||||||
PTR newmem;
|
PTR newmem;
|
||||||
|
|
||||||
@ -148,8 +140,7 @@ xmalloc (size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
xcalloc (nelem, elsize)
|
xcalloc (size_t nelem, size_t elsize)
|
||||||
size_t nelem, elsize;
|
|
||||||
{
|
{
|
||||||
PTR newmem;
|
PTR newmem;
|
||||||
|
|
||||||
@ -164,9 +155,7 @@ xcalloc (nelem, elsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
xrealloc (oldmem, size)
|
xrealloc (PTR oldmem, size_t size)
|
||||||
PTR oldmem;
|
|
||||||
size_t size;
|
|
||||||
{
|
{
|
||||||
PTR newmem;
|
PTR newmem;
|
||||||
|
|
||||||
|
@ -31,10 +31,7 @@ allocated, the remaining memory is zeroed.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
xmemdup (input, copy_size, alloc_size)
|
xmemdup (const PTR input, size_t copy_size, size_t alloc_size)
|
||||||
const PTR input;
|
|
||||||
size_t copy_size;
|
|
||||||
size_t alloc_size;
|
|
||||||
{
|
{
|
||||||
PTR output = xcalloc (1, alloc_size);
|
PTR output = xcalloc (1, alloc_size);
|
||||||
return (PTR) memcpy (output, input, copy_size);
|
return (PTR) memcpy (output, input, copy_size);
|
||||||
|
@ -28,8 +28,7 @@ obtain memory.
|
|||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xstrdup (s)
|
xstrdup (const char *s)
|
||||||
const char *s;
|
|
||||||
{
|
{
|
||||||
register size_t len = strlen (s) + 1;
|
register size_t len = strlen (s) + 1;
|
||||||
register char *ret = xmalloc (len);
|
register char *ret = xmalloc (len);
|
||||||
|
@ -21,13 +21,13 @@ will never return a @code{NULL} pointer.
|
|||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES)
|
#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES)
|
||||||
extern char *strerror PARAMS ((int,...));
|
extern char *strerror (int,...);
|
||||||
#define DONT_DECLARE_STRERROR
|
#define DONT_DECLARE_STRERROR
|
||||||
#endif
|
#endif
|
||||||
#endif /* VMS */
|
#endif /* VMS */
|
||||||
|
|
||||||
#ifndef DONT_DECLARE_STRERROR
|
#ifndef DONT_DECLARE_STRERROR
|
||||||
extern char *strerror PARAMS ((int));
|
extern char *strerror (int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If strerror returns NULL, we'll format the number into a static buffer. */
|
/* 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. */
|
/* Like strerror, but result is never a null pointer. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xstrerror (errnum)
|
xstrerror (int errnum)
|
||||||
int errnum;
|
|
||||||
{
|
{
|
||||||
char *errstr;
|
char *errstr;
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
char *(*vmslib_strerror) PARAMS ((int,...));
|
char *(*vmslib_strerror) (int,...);
|
||||||
|
|
||||||
/* Override any possibly-conflicting declaration from system header. */
|
/* 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
|
/* Second argument matters iff first is EVMSERR, but it's simpler to
|
||||||
pass it unconditionally. `vaxc$errno' is declared in <errno.h>
|
pass it unconditionally. `vaxc$errno' is declared in <errno.h>
|
||||||
and maintained by the run-time library in parallel to `errno'.
|
and maintained by the run-time library in parallel to `errno'.
|
||||||
|
@ -45,9 +45,7 @@ always NUL terminated.
|
|||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xstrndup (s, n)
|
xstrndup (const char *s, size_t n)
|
||||||
const char *s;
|
|
||||||
size_t n;
|
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
size_t len = strlen (s);
|
size_t len = strlen (s);
|
||||||
|
Loading…
Reference in New Issue
Block a user