partition.h: Remove use of PARAMS.

include/
2005-03-27  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        * partition.h: Remove use of PARAMS.
        * obstack.h: Remove conditional prototypes __STDC__.
        * objalloc.h:  Remove use of PARAMS.
        * splay-tree.h: Likewise.

libiberty/
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.

From-SVN: r97125
This commit is contained in:
Gabriel Dos Reis 2005-03-28 04:22:33 +00:00 committed by Gabriel Dos Reis
parent 6b32f9fc29
commit 885f2199f3
33 changed files with 224 additions and 490 deletions

View File

@ -2,6 +2,13 @@
* ternary.h: Don't use PARAMS anymore.
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* partition.h: Remove use of PARAMS.
* obstack.h: Remove conditional prototypes __STDC__.
* objalloc.h: Remove use of PARAMS.
* splay-tree.h: Likewise.
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.

View File

@ -64,12 +64,12 @@ struct objalloc_align { char x; double d; };
/* Create an objalloc structure. Returns NULL if malloc fails. */
extern struct objalloc *objalloc_create PARAMS ((void));
extern struct objalloc *objalloc_create (void);
/* Allocate space from an objalloc structure. Returns NULL if malloc
fails. */
extern PTR _objalloc_alloc PARAMS ((struct objalloc *, unsigned long));
extern PTR _objalloc_alloc (struct objalloc *, unsigned long);
/* The macro version of objalloc_alloc. We only define this if using
gcc, because otherwise we would have to evaluate the arguments
@ -105,11 +105,11 @@ extern PTR _objalloc_alloc PARAMS ((struct objalloc *, unsigned long));
/* Free an entire objalloc structure. */
extern void objalloc_free PARAMS ((struct objalloc *));
extern void objalloc_free (struct objalloc *);
/* Free a block allocated by objalloc_alloc. This also frees all more
recently allocated blocks. */
extern void objalloc_free_block PARAMS ((struct objalloc *, PTR));
extern void objalloc_free_block (struct objalloc *, PTR);
#endif /* OBJALLOC_H */

View File

@ -1,6 +1,6 @@
/* obstack.h - object stack macros
Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
1999, 2000
1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
@ -145,11 +145,7 @@ extern "C" {
#if defined _LIBC || defined HAVE_STRING_H
# include <string.h>
# if defined __STDC__ && __STDC__
# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
# else
# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
# endif
#else
# ifdef memcpy
# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
@ -174,18 +170,12 @@ struct obstack /* control current object in current chunk */
char *chunk_limit; /* address of char after current chunk */
PTR_INT_TYPE temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */
#if defined __STDC__ && __STDC__
/* These prototypes vary based on `use_extra_arg', and we use
casts to the prototypeless function type in all assignments,
but having prototypes here quiets -Wstrict-prototypes. */
struct _obstack_chunk *(*chunkfun) (void *, long);
void (*freefun) (void *, struct _obstack_chunk *);
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
#else
struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
void (*freefun) (); /* User's function to free a chunk. */
char *extra_arg; /* first arg for chunk alloc/dealloc funcs */
#endif
unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
unsigned maybe_empty_object:1;/* There is a possibility that the current
chunk contains a zero-length object. This
@ -198,7 +188,6 @@ struct obstack /* control current object in current chunk */
/* Declare the external functions we use; they are in obstack.c. */
#if defined __STDC__ && __STDC__
extern void _obstack_newchunk (struct obstack *, int);
extern void _obstack_free (struct obstack *, void *);
extern int _obstack_begin (struct obstack *, int, int,
@ -207,16 +196,7 @@ extern int _obstack_begin_1 (struct obstack *, int, int,
void *(*) (void *, long),
void (*) (void *, void *), void *);
extern int _obstack_memory_used (struct obstack *);
#else
extern void _obstack_newchunk ();
extern void _obstack_free ();
extern int _obstack_begin ();
extern int _obstack_begin_1 ();
extern int _obstack_memory_used ();
#endif
#if defined __STDC__ && __STDC__
/* Do the function-declarations after the structs
but before defining the macros. */
@ -255,19 +235,10 @@ int obstack_alignment_mask (struct obstack *obstack);
int obstack_chunk_size (struct obstack *obstack);
int obstack_memory_used (struct obstack *obstack);
#endif /* __STDC__ */
/* Non-ANSI C cannot really support alternative functions for these macros,
so we do not declare them. */
/* Error handler called when `obstack_chunk_alloc' failed to allocate
more memory. This can be set to a user defined function. The
default action is to print a message and abort. */
#if defined __STDC__ && __STDC__
extern void (*obstack_alloc_failed_handler) (void);
#else
extern void (*obstack_alloc_failed_handler) ();
#endif
/* Exit value used when `print_and_abort' is used. */
extern int obstack_exit_failure;
@ -292,8 +263,6 @@ extern int obstack_exit_failure;
/* To prevent prototype warnings provide complete argument list in
standard C version. */
#if defined __STDC__ && __STDC__
# define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
@ -317,32 +286,6 @@ extern int obstack_exit_failure;
# define obstack_freefun(h, newfreefun) \
((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
#else
# define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
# define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, \
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
_obstack_begin ((h), (size), (alignment), \
(void *(*) ()) (chunkfun), (void (*) ()) (freefun))
# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
_obstack_begin_1 ((h), (size), (alignment), \
(void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg))
# define obstack_chunkfun(h, newchunkfun) \
((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun))
# define obstack_freefun(h, newfreefun) \
((h) -> freefun = (void (*)()) (newfreefun))
#endif
#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar))
#define obstack_blank_fast(h,n) ((h)->next_free += (n))
@ -586,21 +529,12 @@ __extension__ \
(h)->object_base = (h)->next_free, \
__INT_TO_PTR ((h)->temp))
# if defined __STDC__ && __STDC__
# define obstack_free(h,obj) \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
# else
# define obstack_free(h,obj) \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0)))
# endif
#endif /* not __GNUC__ or not __STDC__ */

View File

@ -64,13 +64,10 @@ typedef struct partition_def
struct partition_elem elements[1];
} *partition;
extern partition partition_new PARAMS((int));
extern void partition_delete PARAMS((partition));
extern int partition_union PARAMS((partition,
int,
int));
extern void partition_print PARAMS((partition,
FILE*));
extern partition partition_new (int);
extern void partition_delete (partition);
extern int partition_union (partition, int, int);
extern void partition_print (partition, FILE*);
/* Returns the canonical element corresponding to the class containing
ELEMENT__ in PARTITION__. */

View File

@ -52,30 +52,30 @@ typedef struct splay_tree_node_s *splay_tree_node;
/* The type of a function which compares two splay-tree keys. The
function should return values as for qsort. */
typedef int (*splay_tree_compare_fn) PARAMS((splay_tree_key, splay_tree_key));
typedef int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key);
/* The type of a function used to deallocate any resources associated
with the key. */
typedef void (*splay_tree_delete_key_fn) PARAMS((splay_tree_key));
typedef void (*splay_tree_delete_key_fn) (splay_tree_key);
/* The type of a function used to deallocate any resources associated
with the value. */
typedef void (*splay_tree_delete_value_fn) PARAMS((splay_tree_value));
typedef void (*splay_tree_delete_value_fn) (splay_tree_value);
/* The type of a function used to iterate over the tree. */
typedef int (*splay_tree_foreach_fn) PARAMS((splay_tree_node, void*));
typedef int (*splay_tree_foreach_fn) (splay_tree_node, void*);
/* The type of a function used to allocate memory for tree root and
node structures. The first argument is the number of bytes needed;
the second is a data pointer the splay tree functions pass through
to the allocator. This function must never return zero. */
typedef PTR (*splay_tree_allocate_fn) PARAMS((int, void *));
typedef PTR (*splay_tree_allocate_fn) (int, void *);
/* The type of a function used to free memory allocated using the
corresponding splay_tree_allocate_fn. The first argument is the
memory to be freed; the latter is a data pointer the splay tree
functions pass through to the freer. */
typedef void (*splay_tree_deallocate_fn) PARAMS((void *, void *));
typedef void (*splay_tree_deallocate_fn) (void *, void *);
/* The nodes in the splay tree. */
struct splay_tree_node_s GTY(())
@ -114,43 +114,28 @@ struct splay_tree_s GTY(())
};
typedef struct splay_tree_s *splay_tree;
extern splay_tree splay_tree_new PARAMS((splay_tree_compare_fn,
extern splay_tree splay_tree_new (splay_tree_compare_fn,
splay_tree_delete_key_fn,
splay_tree_delete_value_fn));
extern splay_tree splay_tree_new_with_allocator
PARAMS((splay_tree_compare_fn,
splay_tree_delete_value_fn);
extern splay_tree splay_tree_new_with_allocator (splay_tree_compare_fn,
splay_tree_delete_key_fn,
splay_tree_delete_value_fn,
splay_tree_allocate_fn,
splay_tree_deallocate_fn,
void *));
extern void splay_tree_delete PARAMS((splay_tree));
extern splay_tree_node splay_tree_insert
PARAMS((splay_tree,
void *);
extern void splay_tree_delete (splay_tree);
extern splay_tree_node splay_tree_insert (splay_tree,
splay_tree_key,
splay_tree_value));
extern void splay_tree_remove PARAMS((splay_tree,
splay_tree_key));
extern splay_tree_node splay_tree_lookup
PARAMS((splay_tree,
splay_tree_key));
extern splay_tree_node splay_tree_predecessor
PARAMS((splay_tree,
splay_tree_key));
extern splay_tree_node splay_tree_successor
PARAMS((splay_tree,
splay_tree_key));
extern splay_tree_node splay_tree_max
PARAMS((splay_tree));
extern splay_tree_node splay_tree_min
PARAMS((splay_tree));
extern int splay_tree_foreach PARAMS((splay_tree,
splay_tree_foreach_fn,
void*));
extern int splay_tree_compare_ints PARAMS((splay_tree_key,
splay_tree_key));
extern int splay_tree_compare_pointers PARAMS((splay_tree_key,
splay_tree_key));
splay_tree_value);
extern void splay_tree_remove (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_lookup (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_predecessor (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_successor (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_max (splay_tree);
extern splay_tree_node splay_tree_min (splay_tree);
extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*);
extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key);
extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key);
#ifdef __cplusplus
}

View File

@ -1,3 +1,48 @@
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.

View File

@ -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;
}

View File

@ -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)

View File

@ -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";

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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? */

View File

@ -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;

View File

@ -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);

View File

@ -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, '=');

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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);
}

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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)

View File

@ -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);