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

View File

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

View File

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

View File

@ -64,13 +64,10 @@ typedef struct partition_def
struct partition_elem elements[1]; struct partition_elem elements[1];
} *partition; } *partition;
extern partition partition_new PARAMS((int)); extern partition partition_new (int);
extern void partition_delete PARAMS((partition)); extern void partition_delete (partition);
extern int partition_union PARAMS((partition, extern int partition_union (partition, int, int);
int, extern void partition_print (partition, FILE*);
int));
extern void partition_print PARAMS((partition,
FILE*));
/* Returns the canonical element corresponding to the class containing /* Returns the canonical element corresponding to the class containing
ELEMENT__ in PARTITION__. */ 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 /* The type of a function which compares two splay-tree keys. The
function should return values as for qsort. */ 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 /* The type of a function used to deallocate any resources associated
with the key. */ 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 /* The type of a function used to deallocate any resources associated
with the value. */ 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. */ /* 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 /* The type of a function used to allocate memory for tree root and
node structures. The first argument is the number of bytes needed; node structures. The first argument is the number of bytes needed;
the second is a data pointer the splay tree functions pass through the second is a data pointer the splay tree functions pass through
to the allocator. This function must never return zero. */ 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 /* The type of a function used to free memory allocated using the
corresponding splay_tree_allocate_fn. The first argument is the corresponding splay_tree_allocate_fn. The first argument is the
memory to be freed; the latter is a data pointer the splay tree memory to be freed; the latter is a data pointer the splay tree
functions pass through to the freer. */ 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. */ /* The nodes in the splay tree. */
struct splay_tree_node_s GTY(()) struct splay_tree_node_s GTY(())
@ -114,43 +114,28 @@ struct splay_tree_s GTY(())
}; };
typedef struct splay_tree_s *splay_tree; 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_key_fn,
splay_tree_delete_value_fn)); splay_tree_delete_value_fn);
extern splay_tree splay_tree_new_with_allocator extern splay_tree splay_tree_new_with_allocator (splay_tree_compare_fn,
PARAMS((splay_tree_compare_fn, splay_tree_delete_key_fn,
splay_tree_delete_key_fn,
splay_tree_delete_value_fn, splay_tree_delete_value_fn,
splay_tree_allocate_fn, splay_tree_allocate_fn,
splay_tree_deallocate_fn, splay_tree_deallocate_fn,
void *)); void *);
extern void splay_tree_delete PARAMS((splay_tree)); extern void splay_tree_delete (splay_tree);
extern splay_tree_node splay_tree_insert extern splay_tree_node splay_tree_insert (splay_tree,
PARAMS((splay_tree, splay_tree_key,
splay_tree_key, splay_tree_value);
splay_tree_value)); extern void splay_tree_remove (splay_tree, splay_tree_key);
extern void splay_tree_remove PARAMS((splay_tree, extern splay_tree_node splay_tree_lookup (splay_tree, splay_tree_key);
splay_tree_key)); extern splay_tree_node splay_tree_predecessor (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_lookup extern splay_tree_node splay_tree_successor (splay_tree, splay_tree_key);
PARAMS((splay_tree, extern splay_tree_node splay_tree_max (splay_tree);
splay_tree_key)); extern splay_tree_node splay_tree_min (splay_tree);
extern splay_tree_node splay_tree_predecessor extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*);
PARAMS((splay_tree, extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key);
splay_tree_key)); extern int splay_tree_compare_pointers (splay_tree_key, 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));
#ifdef __cplusplus #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> 2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 6/n. Convert libiberty to use ISO C prototype style 6/n.

View File

@ -1,5 +1,5 @@
/* Implement the mempcpy function. /* 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>. Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library. 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> #include <ansidecl.h>
#ifdef ANSI_PROTOTYPES
#include <stddef.h> #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 PTR
mempcpy (dst, src, len) mempcpy (PTR dst, const PTR src, size_t len)
PTR dst;
const PTR src;
size_t len;
{ {
return (char *) memcpy (dst, src, len) + 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> #include <ansidecl.h>
#ifdef ANSI_PROTOTYPES
#include <stddef.h> #include <stddef.h>
#else
#define size_t unsigned long
#endif
PTR PTR
memset (dest, val, len) memset (PTR dest, register int val, register size_t len)
PTR dest;
register int val;
register size_t len;
{ {
register unsigned char *ptr = (unsigned char*)dest; register unsigned char *ptr = (unsigned char*)dest;
while (len-- > 0) while (len-- > 0)

View File

@ -71,9 +71,7 @@ reading and writing.
*/ */
int int
mkstemps (template, suffix_len) mkstemps (char *template, int suffix_len)
char *template;
int suffix_len;
{ {
static const char letters[] static const char letters[]
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

View File

@ -39,8 +39,8 @@ Boston, MA 02111-1307, USA. */
#include <stdlib.h> #include <stdlib.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. */
extern PTR malloc PARAMS ((size_t)); extern PTR malloc (size_t);
extern void free PARAMS ((PTR)); extern void free (PTR);
#endif #endif
#endif #endif
@ -85,7 +85,7 @@ struct objalloc_chunk
/* Create an objalloc structure. */ /* Create an objalloc structure. */
struct objalloc * struct objalloc *
objalloc_create () objalloc_create (void)
{ {
struct objalloc *ret; struct objalloc *ret;
struct objalloc_chunk *chunk; struct objalloc_chunk *chunk;
@ -114,9 +114,7 @@ objalloc_create ()
/* Allocate space from an objalloc structure. */ /* Allocate space from an objalloc structure. */
PTR PTR
_objalloc_alloc (o, len) _objalloc_alloc (struct objalloc *o, unsigned long len)
struct objalloc *o;
unsigned long len;
{ {
/* We avoid confusion from zero sized objects by always allocating /* We avoid confusion from zero sized objects by always allocating
at least 1 byte. */ at least 1 byte. */
@ -171,8 +169,7 @@ _objalloc_alloc (o, len)
/* Free an entire objalloc structure. */ /* Free an entire objalloc structure. */
void void
objalloc_free (o) objalloc_free (struct objalloc *o)
struct objalloc *o;
{ {
struct objalloc_chunk *l; struct objalloc_chunk *l;
@ -193,9 +190,7 @@ objalloc_free (o)
recently allocated blocks. */ recently allocated blocks. */
void void
objalloc_free_block (o, block) objalloc_free_block (struct objalloc *o, PTR block)
struct objalloc *o;
PTR block;
{ {
struct objalloc_chunk *p, *small; struct objalloc_chunk *p, *small;
char *b = (char *) block; char *b = (char *) block;

View File

@ -52,11 +52,7 @@
#ifndef ELIDE_CODE #ifndef ELIDE_CODE
#if defined (__STDC__) && __STDC__
#define POINTER void * #define POINTER void *
#else
#define POINTER char *
#endif
/* Determine default alignment. */ /* Determine default alignment. */
struct fooalign {char x; double d;}; 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'. jump to the handler pointed to by `obstack_alloc_failed_handler'.
This variable by default points to the internal function This variable by default points to the internal function
`print_and_abort'. */ `print_and_abort'. */
#if defined (__STDC__) && __STDC__
static void print_and_abort (void); static void print_and_abort (void);
void (*obstack_alloc_failed_handler) (void) = print_and_abort; 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. */ /* Exit value used when `print_and_abort' is used. */
#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H #if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
@ -148,17 +139,8 @@ struct obstack *_obstack;
free up some memory, then call this again. */ free up some memory, then call this again. */
int int
_obstack_begin (h, size, alignment, chunkfun, freefun) _obstack_begin (struct obstack *h, int size, int alignment,
struct obstack *h; POINTER (*chunkfun) (long), void (*freefun) (void *))
int size;
int alignment;
#if defined (__STDC__) && __STDC__
POINTER (*chunkfun) (long);
void (*freefun) (void *);
#else
POINTER (*chunkfun) ();
void (*freefun) ();
#endif
{ {
register struct _obstack_chunk *chunk; /* points to new chunk */ register struct _obstack_chunk *chunk; /* points to new chunk */
@ -181,13 +163,8 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
size = 4096 - extra; size = 4096 - extra;
} }
#if defined (__STDC__) && __STDC__
h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun; h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
#else
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
h->freefun = freefun;
#endif
h->chunk_size = size; h->chunk_size = size;
h->alignment_mask = alignment - 1; h->alignment_mask = alignment - 1;
h->use_extra_arg = 0; h->use_extra_arg = 0;
@ -206,18 +183,9 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
} }
int int
_obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg) _obstack_begin_1 (struct obstack *h, int size, int alignment,
struct obstack *h; POINTER (*chunkfun) (POINTER, long),
int size; void (*freefun) (POINTER, POINTER), POINTER arg)
int alignment;
#if defined (__STDC__) && __STDC__
POINTER (*chunkfun) (POINTER, long);
void (*freefun) (POINTER, POINTER);
#else
POINTER (*chunkfun) ();
void (*freefun) ();
#endif
POINTER arg;
{ {
register struct _obstack_chunk *chunk; /* points to new chunk */ 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; size = 4096 - extra;
} }
#if defined(__STDC__) && __STDC__
h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun; h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
#else
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
h->freefun = freefun;
#endif
h->chunk_size = size; h->chunk_size = size;
h->alignment_mask = alignment - 1; h->alignment_mask = alignment - 1;
h->extra_arg = arg; h->extra_arg = arg;
@ -272,9 +235,7 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
to the beginning of the new one. */ to the beginning of the new one. */
void void
_obstack_newchunk (h, length) _obstack_newchunk (struct obstack *h, int length)
struct obstack *h;
int length;
{ {
register struct _obstack_chunk *old_chunk = h->chunk; register struct _obstack_chunk *old_chunk = h->chunk;
register struct _obstack_chunk *new_chunk; register struct _obstack_chunk *new_chunk;
@ -335,16 +296,12 @@ _obstack_newchunk (h, length)
This is here for debugging. This is here for debugging.
If you use it in a program, you are probably losing. */ 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 /* Suppress -Wmissing-prototypes warning. We don't want to declare this in
obstack.h because it is just for debugging. */ obstack.h because it is just for debugging. */
int _obstack_allocated_p (struct obstack *h, POINTER obj); int _obstack_allocated_p (struct obstack *h, POINTER obj);
#endif
int int
_obstack_allocated_p (h, obj) _obstack_allocated_p (struct obstack *h, POINTER obj)
struct obstack *h;
POINTER obj;
{ {
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk *plp; /* point to previous chunk if any */ 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. */ This is the first one, called from non-ANSI code. */
void void
_obstack_free (h, obj) _obstack_free (struct obstack *h, POINTER obj)
struct obstack *h;
POINTER obj;
{ {
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk *plp; /* point to previous chunk if any */ 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. */ /* This function is used from ANSI code. */
void void
obstack_free (h, obj) obstack_free (struct obstack *h, POINTER obj)
struct obstack *h;
POINTER obj;
{ {
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk *plp; /* point to previous chunk if any */ register struct _obstack_chunk *plp; /* point to previous chunk if any */
@ -436,8 +389,7 @@ obstack_free (h, obj)
} }
int int
_obstack_memory_used (h) _obstack_memory_used (struct obstack *h)
struct obstack *h;
{ {
register struct _obstack_chunk* lp; register struct _obstack_chunk* lp;
register int nbytes = 0; register int nbytes = 0;
@ -462,7 +414,7 @@ _obstack_memory_used (h)
#endif #endif
static void static void
print_and_abort () print_and_abort (void)
{ {
fputs (_("memory exhausted\n"), stderr); fputs (_("memory exhausted\n"), stderr);
exit (obstack_exit_failure); exit (obstack_exit_failure);
@ -475,119 +427,84 @@ print_and_abort ()
/* Now define the functional versions of the obstack macros. /* Now define the functional versions of the obstack macros.
Define them to simply use the corresponding macros to do the job. */ 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 function names appear in parentheses in order to prevent
the macro-definitions of the names from being expanded there. */ the macro-definitions of the names from being expanded there. */
POINTER (obstack_base) (obstack) POINTER (obstack_base) (struct obstack *obstack)
struct obstack *obstack;
{ {
return obstack_base (obstack); return obstack_base (obstack);
} }
POINTER (obstack_next_free) (obstack) POINTER (obstack_next_free) (struct obstack *obstack)
struct obstack *obstack;
{ {
return obstack_next_free (obstack); return obstack_next_free (obstack);
} }
int (obstack_object_size) (obstack) int (obstack_object_size) (struct obstack *obstack)
struct obstack *obstack;
{ {
return obstack_object_size (obstack); return obstack_object_size (obstack);
} }
int (obstack_room) (obstack) int (obstack_room) (struct obstack *obstack)
struct obstack *obstack;
{ {
return obstack_room (obstack); return obstack_room (obstack);
} }
int (obstack_make_room) (obstack, length) int (obstack_make_room) (struct obstack *obstack, int length)
struct obstack *obstack;
int length;
{ {
return obstack_make_room (obstack, length); return obstack_make_room (obstack, length);
} }
void (obstack_grow) (obstack, pointer, length) void (obstack_grow) (struct obstack *obstack, POINTER pointer, int length)
struct obstack *obstack;
POINTER pointer;
int length;
{ {
obstack_grow (obstack, pointer, length); obstack_grow (obstack, pointer, length);
} }
void (obstack_grow0) (obstack, pointer, length) void (obstack_grow0) (struct obstack *obstack, POINTER pointer, int length)
struct obstack *obstack;
POINTER pointer;
int length;
{ {
obstack_grow0 (obstack, pointer, length); obstack_grow0 (obstack, pointer, length);
} }
void (obstack_1grow) (obstack, character) void (obstack_1grow) (struct obstack *obstack, int character)
struct obstack *obstack;
int character;
{ {
obstack_1grow (obstack, character); obstack_1grow (obstack, character);
} }
void (obstack_blank) (obstack, length) void (obstack_blank) (struct obstack *obstack, int length)
struct obstack *obstack;
int length;
{ {
obstack_blank (obstack, length); obstack_blank (obstack, length);
} }
void (obstack_1grow_fast) (obstack, character) void (obstack_1grow_fast) (struct obstack *obstack, int character)
struct obstack *obstack;
int character;
{ {
obstack_1grow_fast (obstack, character); obstack_1grow_fast (obstack, character);
} }
void (obstack_blank_fast) (obstack, length) void (obstack_blank_fast) (struct obstack *obstack, int length)
struct obstack *obstack;
int length;
{ {
obstack_blank_fast (obstack, length); obstack_blank_fast (obstack, length);
} }
POINTER (obstack_finish) (obstack) POINTER (obstack_finish) (struct obstack *obstack)
struct obstack *obstack;
{ {
return obstack_finish (obstack); return obstack_finish (obstack);
} }
POINTER (obstack_alloc) (obstack, length) POINTER (obstack_alloc) (struct obstack *obstack, int length)
struct obstack *obstack;
int length;
{ {
return obstack_alloc (obstack, length); return obstack_alloc (obstack, length);
} }
POINTER (obstack_copy) (obstack, pointer, length) POINTER (obstack_copy) (struct obstack *obstack, POINTER pointer, int length)
struct obstack *obstack;
POINTER pointer;
int length;
{ {
return obstack_copy (obstack, pointer, length); return obstack_copy (obstack, pointer, length);
} }
POINTER (obstack_copy0) (obstack, pointer, length) POINTER (obstack_copy0) (struct obstack *obstack, POINTER pointer, int length)
struct obstack *obstack;
POINTER pointer;
int length;
{ {
return obstack_copy0 (obstack, pointer, length); return obstack_copy0 (obstack, pointer, length);
} }
#endif /* __STDC__ */
#endif /* 0 */ #endif /* 0 */
#endif /* !ELIDE_CODE */ #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. */ element is in a class by itself. */
partition partition
partition_new (num_elements) partition_new (int num_elements)
int num_elements;
{ {
int e; int e;
@ -62,8 +61,7 @@ partition_new (num_elements)
/* Freeds a partition. */ /* Freeds a partition. */
void void
partition_delete (part) partition_delete (partition part)
partition part;
{ {
free (part); free (part);
} }
@ -74,10 +72,7 @@ partition_delete (part)
resulting union class. */ resulting union class. */
int int
partition_union (part, elem1, elem2) partition_union (partition part, int elem1, int elem2)
partition part;
int elem1;
int elem2;
{ {
struct partition_elem *elements = part->elements; struct partition_elem *elements = part->elements;
struct partition_elem *e1; struct partition_elem *e1;
@ -126,9 +121,7 @@ partition_union (part, elem1, elem2)
pointer to each. Used to qsort such an array. */ pointer to each. Used to qsort such an array. */
static int static int
elem_compare (elem1, elem2) elem_compare (const void *elem1, const void *elem2)
const void *elem1;
const void *elem2;
{ {
int e1 = * (const int *) elem1; int e1 = * (const int *) elem1;
int e2 = * (const int *) elem2; int e2 = * (const int *) elem2;
@ -144,9 +137,7 @@ elem_compare (elem1, elem2)
class are sorted. */ class are sorted. */
void void
partition_print (part, fp) partition_print (partition part, FILE *fp)
partition part;
FILE *fp;
{ {
char *done; char *done;
int num_elements = part->num_elements; int num_elements = part->num_elements;

View File

@ -49,13 +49,9 @@ static int last_status = 0;
static int last_reaped = 0; static int last_reaped = 0;
int int
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) pexecute (const char *program, char * const *argv, const char *this_pname,
const char *program; const char *temp_base, char **errmsg_fmt,
char * const *argv; char **errmsg_arg, int flags)
const char *this_pname;
const char *temp_base;
char **errmsg_fmt, **errmsg_arg;
int flags;
{ {
int rc; int rc;
@ -82,10 +78,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
} }
int int
pwait (pid, status, flags) pwait (int pid, int *status, int flags)
int pid;
int *status;
int flags;
{ {
/* On MSDOS each pexecute must be followed by its associated pwait. */ /* On MSDOS each pexecute must be followed by its associated pwait. */
if (pid != last_pid if (pid != last_pid

View File

@ -47,13 +47,9 @@ static int last_status = 0;
static int last_reaped = 0; static int last_reaped = 0;
int int
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) pexecute (const char *program, char * const *argv, const char *this_pname,
const char *program; const char *temp_base, char **errmsg_fmt, char **errmsg_arg,
char * const *argv; int flags)
const char *this_pname;
const char *temp_base;
char **errmsg_fmt, **errmsg_arg;
int flags;
{ {
int rc; int rc;
char *scmd, *rf; char *scmd, *rf;
@ -126,10 +122,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
#endif #endif
int int
pwait (pid, status, flags) pwait (int pid, int *status, int flags)
int pid;
int *status;
int flags;
{ {
/* On MSDOS each pexecute must be followed by its associated pwait. */ /* On MSDOS each pexecute must be followed by its associated pwait. */
if (pid != last_pid if (pid != last_pid

View File

@ -1,7 +1,7 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes /* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. Generic Unix version with other subprocesses), and wait for it. Generic Unix version
(also used for UWIN and VMS). (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. Free Software Foundation, Inc.
This file is part of the libiberty library. 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. */ exactly once and is not an argument, or is marked volatile. */
int int
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, pexecute (const char *program, char * const *argv, const char *this_pname,
flagsarg) const char *temp_base ATTRIBUTE_UNUSED,
const char *program; char **errmsg_fmt, char **errmsg_arg, int flagsarg)
char * const *argv;
const char *this_pname;
const char *temp_base ATTRIBUTE_UNUSED;
char **errmsg_fmt, **errmsg_arg;
int flagsarg;
{ {
int pid; int pid;
int pdes[2]; int pdes[2];
@ -203,10 +198,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg,
} }
int int
pwait (pid, status, flags) pwait (int pid, int *status, int flags ATTRIBUTE_UNUSED)
int pid;
int *status;
int flags ATTRIBUTE_UNUSED;
{ {
/* ??? Here's an opportunity to canonicalize the values in STATUS. /* ??? Here's an opportunity to canonicalize the values in STATUS.
Needed? */ Needed? */

View File

@ -1,6 +1,6 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes /* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. Generic Win32 specialization. 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. Free Software Foundation, Inc.
This file is part of the libiberty library. 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. */ to remove the outermost set of double quotes from all arguments. */
static const char * const * static const char * const *
fix_argv (argvec) fix_argv (char **argvec)
char **argvec;
{ {
int i; int i;
char * command0 = argvec[0]; char * command0 = argvec[0];
@ -138,13 +137,10 @@ fix_argv (argvec)
/* Win32 supports pipes */ /* Win32 supports pipes */
int int
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) pexecute (const char *program, char * const *argv,
const char *program; const char *this_pname ATTRIBUTE_UNUSED,
char * const *argv; const char *temp_base ATTRIBUTE_UNUSED,
const char *this_pname ATTRIBUTE_UNUSED; char **errmsg_fmt, char **errmsg_arg, int flags)
const char *temp_base ATTRIBUTE_UNUSED;
char **errmsg_fmt, **errmsg_arg;
int flags;
{ {
int pid; int pid;
int pdes[2]; 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. */ macros. Note that WIFSIGNALED will never be true under CRTDLL. */
int int
pwait (pid, status, flags) pwait (int pid, int *status, int flags ATTRIBUTE_UNUSED)
int pid;
int *status;
int flags ATTRIBUTE_UNUSED;
{ {
int termstat; int termstat;

View File

@ -1,5 +1,5 @@
/* Calculate the size of physical memory. /* 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 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 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. */ /* Return the total amount of physical memory. */
double double
physmem_total () physmem_total (void)
{ {
#if defined _SC_PHYS_PAGES && defined _SC_PAGESIZE #if defined _SC_PHYS_PAGES && defined _SC_PAGESIZE
{ /* This works on linux-gnu, solaris2 and cygwin. */ { /* This works on linux-gnu, solaris2 and cygwin. */
@ -184,7 +184,7 @@ physmem_total ()
/* Return the amount of physical memory available. */ /* Return the amount of physical memory available. */
double double
physmem_available () physmem_available (void)
{ {
#if defined _SC_AVPHYS_PAGES && defined _SC_PAGESIZE #if defined _SC_AVPHYS_PAGES && defined _SC_PAGESIZE
{ /* This works on linux-gnu, solaris2 and cygwin. */ { /* This works on linux-gnu, solaris2 and cygwin. */
@ -290,7 +290,7 @@ physmem_available ()
# include <stdlib.h> # include <stdlib.h>
int int
main () main (void)
{ {
printf ("%12.f %12.f\n", physmem_total (), physmem_available ()); printf ("%12.f %12.f\n", physmem_total (), physmem_available ());
exit (0); exit (0);

View File

@ -67,8 +67,7 @@ extern char *alloca ();
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */ /* Put STRING, which is of the form "NAME=VALUE", in the environment. */
int int
putenv (string) putenv (const char *string)
const char *string;
{ {
const char *const name_end = strchr (string, '='); const char *const name_end = strchr (string, '=');

View File

@ -80,7 +80,7 @@ control over the state of the random number generator.
#endif #endif
long int random (); long int random (void);
/* An improved random number generation package. In addition to the standard /* An improved random number generation package. In addition to the standard
rand()/srand() like interface, this package also has a special state info 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[] introduced by the L.C.R.N.G. Note that the initialization of randtbl[]
for default usage relies on values produced by this routine. */ for default usage relies on values produced by this routine. */
void void
srandom (x) srandom (unsigned int x)
unsigned int x;
{ {
state[0] = x; state[0] = x;
if (rand_type != TYPE_0) if (rand_type != TYPE_0)
@ -255,10 +254,7 @@ srandom (x)
setstate so that it doesn't matter when initstate is called. setstate so that it doesn't matter when initstate is called.
Returns a pointer to the old state. */ Returns a pointer to the old state. */
PTR PTR
initstate (seed, arg_state, n) initstate (unsigned int seed, PTR arg_state, unsigned long n)
unsigned int seed;
PTR arg_state;
unsigned long n;
{ {
PTR ostate = (PTR) &state[-1]; PTR ostate = (PTR) &state[-1];
@ -324,8 +320,7 @@ initstate (seed, arg_state, n)
Returns a pointer to the old state information. */ Returns a pointer to the old state information. */
PTR PTR
setstate (arg_state) setstate (PTR arg_state)
PTR arg_state;
{ {
register long int *new_state = (long int *) arg_state; register long int *new_state = (long int *) arg_state;
register int type = new_state[0] % MAX_TYPES; 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. */ pointer if the front one has wrapped. Returns a 31-bit random number. */
long int long int
random () random (void)
{ {
if (rand_type == TYPE_0) if (rand_type == TYPE_0)
{ {

View File

@ -22,9 +22,7 @@ exists, it is removed.
#endif #endif
int int
rename (zfrom, zto) rename (const char *zfrom, const char *zto)
const char *zfrom;
const char *zto;
{ {
if (link (zfrom, zto) < 0) if (link (zfrom, zto) < 0)
{ {

View File

@ -15,9 +15,7 @@ deprecated in new programs in favor of @code{strrchr}.
extern char *strrchr (); extern char *strrchr ();
char * char *
rindex (s, c) rindex (char *s, int c)
char *s;
int c;
{ {
return strrchr (s, c); return strrchr (s, c);
} }

View File

@ -1,6 +1,7 @@
/* <ctype.h> replacement macros. /* <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>. Contributed by Zack Weinberg <zackw@stanford.edu>.
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -80,10 +80,7 @@ static char **last_environ;
int int
setenv (name, value, replace) setenv (const char *name, const char *value, int replace)
const char *name;
const char *value;
int replace;
{ {
register char **ep = 0; register char **ep = 0;
register size_t size; register size_t size;
@ -164,8 +161,7 @@ setenv (name, value, replace)
} }
void void
unsetenv (name) unsetenv (const char *name)
const char *name;
{ {
const size_t len = strlen (name); const size_t len = strlen (name);
char **ep; char **ep;

View File

@ -21,12 +21,11 @@ be the value @code{1}).
#include <sys/types.h> #include <sys/types.h>
#include <signal.h> #include <signal.h>
extern void abort PARAMS ((void)) ATTRIBUTE_NORETURN; extern void abort (void) ATTRIBUTE_NORETURN;
#ifdef SIG_SETMASK #ifdef SIG_SETMASK
int int
sigsetmask (set) sigsetmask (int set)
int set;
{ {
sigset_t new; sigset_t new;
sigset_t old; sigset_t old;

View File

@ -41,18 +41,13 @@ this function is used.
#include "ansidecl.h" #include "ansidecl.h"
#ifdef ANSI_PROTOTYPES
#include <stdarg.h> #include <stdarg.h>
#include <stddef.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 int
snprintf VPARAMS ((char *s, size_t n, const char *format, ...)) snprintf (char *s, size_t n, const char *format, ...)
{ {
int result; int result;
VA_OPEN (ap, format); 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 /* POINTERS and WORK are both arrays of N pointers. When this
function returns POINTERS will be sorted in ascending order. */ function returns POINTERS will be sorted in ascending order. */
void sort_pointers (n, pointers, work) void sort_pointers (size_t n, void **pointers, void **work)
size_t n;
void **pointers;
void **work;
{ {
/* The type of a single digit. This can be any unsigned integral /* The type of a single digit. This can be any unsigned integral
type. When changing this, DIGIT_MAX should be changed as type. When changing this, DIGIT_MAX should be changed as
@ -140,8 +137,7 @@ void sort_pointers (n, pointers, work)
#include <stdio.h> #include <stdio.h>
void *xmalloc (n) void *xmalloc (size_t n)
size_t n;
{ {
return malloc (n); return malloc (n);
} }

View File

@ -37,13 +37,12 @@ valid until at least the next call.
#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. */
extern PTR malloc PARAMS ((size_t)); extern PTR malloc (size_t);
extern void free PARAMS ((PTR)); extern void free (PTR);
#endif #endif
const char * const char *
spaces (count) spaces (int count)
int count;
{ {
register char *t; register char *t;
static char *buf; static char *buf;

View File

@ -37,27 +37,20 @@ Boston, MA 02111-1307, USA. */
#include "libiberty.h" #include "libiberty.h"
#include "splay-tree.h" #include "splay-tree.h"
static void splay_tree_delete_helper PARAMS((splay_tree, static void splay_tree_delete_helper (splay_tree, splay_tree_node);
splay_tree_node)); static void splay_tree_splay (splay_tree, splay_tree_key);
static void splay_tree_splay PARAMS((splay_tree, static splay_tree_node splay_tree_splay_helper (splay_tree,
splay_tree_key));
static splay_tree_node splay_tree_splay_helper
PARAMS((splay_tree,
splay_tree_key, splay_tree_key,
splay_tree_node*, splay_tree_node*,
splay_tree_node*, splay_tree_node*,
splay_tree_node*)); splay_tree_node*);
static int splay_tree_foreach_helper PARAMS((splay_tree, static int splay_tree_foreach_helper (splay_tree, splay_tree_node,
splay_tree_node, splay_tree_foreach_fn, void*);
splay_tree_foreach_fn,
void*));
/* Deallocate NODE (a member of SP), and all its sub-trees. */ /* Deallocate NODE (a member of SP), and all its sub-trees. */
static void static void
splay_tree_delete_helper (sp, node) splay_tree_delete_helper (splay_tree sp, splay_tree_node node)
splay_tree sp;
splay_tree_node node;
{ {
splay_tree_node pending = 0; splay_tree_node pending = 0;
splay_tree_node active = 0; splay_tree_node active = 0;
@ -118,12 +111,9 @@ splay_tree_delete_helper (sp, node)
and grandparent, respectively, of NODE. */ and grandparent, respectively, of NODE. */
static splay_tree_node static splay_tree_node
splay_tree_splay_helper (sp, key, node, parent, grandparent) splay_tree_splay_helper (splay_tree sp, splay_tree_key key,
splay_tree sp; splay_tree_node *node, splay_tree_node *parent,
splay_tree_key key; splay_tree_node *grandparent)
splay_tree_node *node;
splay_tree_node *parent;
splay_tree_node *grandparent;
{ {
splay_tree_node *next; splay_tree_node *next;
splay_tree_node n; splay_tree_node n;
@ -229,9 +219,7 @@ splay_tree_splay_helper (sp, key, node, parent, grandparent)
/* Splay SP around KEY. */ /* Splay SP around KEY. */
static void static void
splay_tree_splay (sp, key) splay_tree_splay (splay_tree sp, splay_tree_key key)
splay_tree sp;
splay_tree_key key;
{ {
if (sp->root == 0) if (sp->root == 0)
return; return;
@ -246,11 +234,8 @@ splay_tree_splay (sp, key)
value is returned. Otherwise, this function returns 0. */ value is returned. Otherwise, this function returns 0. */
static int static int
splay_tree_foreach_helper (sp, node, fn, data) splay_tree_foreach_helper (splay_tree sp, splay_tree_node node,
splay_tree sp; splay_tree_foreach_fn fn, void *data)
splay_tree_node node;
splay_tree_foreach_fn fn;
void* data;
{ {
int val; int val;
@ -271,17 +256,13 @@ splay_tree_foreach_helper (sp, node, fn, data)
/* An allocator and deallocator based on xmalloc. */ /* An allocator and deallocator based on xmalloc. */
static void * static void *
splay_tree_xmalloc_allocate (size, data) splay_tree_xmalloc_allocate (int size, void *data ATTRIBUTE_UNUSED)
int size;
void *data ATTRIBUTE_UNUSED;
{ {
return (void *) xmalloc (size); return (void *) xmalloc (size);
} }
static void static void
splay_tree_xmalloc_deallocate (object, data) splay_tree_xmalloc_deallocate (void *object, void *data ATTRIBUTE_UNUSED)
void *object;
void *data ATTRIBUTE_UNUSED;
{ {
free (object); free (object);
} }
@ -293,10 +274,9 @@ splay_tree_xmalloc_deallocate (object, data)
nodes added. */ nodes added. */
splay_tree splay_tree
splay_tree_new (compare_fn, delete_key_fn, delete_value_fn) splay_tree_new (splay_tree_compare_fn compare_fn,
splay_tree_compare_fn compare_fn; splay_tree_delete_key_fn delete_key_fn,
splay_tree_delete_key_fn delete_key_fn; splay_tree_delete_value_fn delete_value_fn)
splay_tree_delete_value_fn delete_value_fn;
{ {
return (splay_tree_new_with_allocator return (splay_tree_new_with_allocator
(compare_fn, delete_key_fn, delete_value_fn, (compare_fn, delete_key_fn, delete_value_fn,
@ -309,14 +289,12 @@ splay_tree_new (compare_fn, delete_key_fn, delete_value_fn)
values. */ values. */
splay_tree splay_tree
splay_tree_new_with_allocator (compare_fn, delete_key_fn, delete_value_fn, splay_tree_new_with_allocator (splay_tree_compare_fn compare_fn,
allocate_fn, deallocate_fn, allocate_data) splay_tree_delete_key_fn delete_key_fn,
splay_tree_compare_fn compare_fn; splay_tree_delete_value_fn delete_value_fn,
splay_tree_delete_key_fn delete_key_fn; splay_tree_allocate_fn allocate_fn,
splay_tree_delete_value_fn delete_value_fn; splay_tree_deallocate_fn deallocate_fn,
splay_tree_allocate_fn allocate_fn; void *allocate_data)
splay_tree_deallocate_fn deallocate_fn;
void *allocate_data;
{ {
splay_tree sp = (splay_tree) (*allocate_fn) (sizeof (struct splay_tree_s), splay_tree sp = (splay_tree) (*allocate_fn) (sizeof (struct splay_tree_s),
allocate_data); allocate_data);
@ -334,8 +312,7 @@ splay_tree_new_with_allocator (compare_fn, delete_key_fn, delete_value_fn,
/* Deallocate SP. */ /* Deallocate SP. */
void void
splay_tree_delete (sp) splay_tree_delete (splay_tree sp)
splay_tree sp;
{ {
splay_tree_delete_helper (sp, sp->root); splay_tree_delete_helper (sp, sp->root);
(*sp->deallocate) ((char*) sp, sp->allocate_data); (*sp->deallocate) ((char*) sp, sp->allocate_data);
@ -346,10 +323,7 @@ splay_tree_delete (sp)
with the new value. Returns the new node. */ with the new value. Returns the new node. */
splay_tree_node splay_tree_node
splay_tree_insert (sp, key, value) splay_tree_insert (splay_tree sp, splay_tree_key key, splay_tree_value value)
splay_tree sp;
splay_tree_key key;
splay_tree_value value;
{ {
int comparison = 0; 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. */ /* Remove KEY from SP. It is not an error if it did not exist. */
void void
splay_tree_remove (sp, key) splay_tree_remove (splay_tree sp, splay_tree_key key)
splay_tree sp;
splay_tree_key key;
{ {
splay_tree_splay (sp, key); splay_tree_splay (sp, key);
@ -443,9 +415,7 @@ splay_tree_remove (sp, key)
otherwise. */ otherwise. */
splay_tree_node splay_tree_node
splay_tree_lookup (sp, key) splay_tree_lookup (splay_tree sp, splay_tree_key key)
splay_tree sp;
splay_tree_key key;
{ {
splay_tree_splay (sp, key); splay_tree_splay (sp, key);
@ -458,8 +428,7 @@ splay_tree_lookup (sp, key)
/* Return the node in SP with the greatest key. */ /* Return the node in SP with the greatest key. */
splay_tree_node splay_tree_node
splay_tree_max (sp) splay_tree_max (splay_tree sp)
splay_tree sp;
{ {
splay_tree_node n = sp->root; splay_tree_node n = sp->root;
@ -475,8 +444,7 @@ splay_tree_max (sp)
/* Return the node in SP with the smallest key. */ /* Return the node in SP with the smallest key. */
splay_tree_node splay_tree_node
splay_tree_min (sp) splay_tree_min (splay_tree sp)
splay_tree sp;
{ {
splay_tree_node n = sp->root; splay_tree_node n = sp->root;
@ -493,9 +461,7 @@ splay_tree_min (sp)
predecessor. KEY need not be present in the tree. */ predecessor. KEY need not be present in the tree. */
splay_tree_node splay_tree_node
splay_tree_predecessor (sp, key) splay_tree_predecessor (splay_tree sp, splay_tree_key key)
splay_tree sp;
splay_tree_key key;
{ {
int comparison; int comparison;
splay_tree_node node; splay_tree_node node;
@ -526,9 +492,7 @@ splay_tree_predecessor (sp, key)
successor. KEY need not be present in the tree. */ successor. KEY need not be present in the tree. */
splay_tree_node splay_tree_node
splay_tree_successor (sp, key) splay_tree_successor (splay_tree sp, splay_tree_key key)
splay_tree sp;
splay_tree_key key;
{ {
int comparison; int comparison;
splay_tree_node node; splay_tree_node node;
@ -561,10 +525,7 @@ splay_tree_successor (sp, key)
Otherwise, this function returns 0. */ Otherwise, this function returns 0. */
int int
splay_tree_foreach (sp, fn, data) splay_tree_foreach (splay_tree sp, splay_tree_foreach_fn fn, void *data)
splay_tree sp;
splay_tree_foreach_fn fn;
void *data;
{ {
return splay_tree_foreach_helper (sp, sp->root, fn, 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. */ /* Splay-tree comparison function, treating the keys as ints. */
int int
splay_tree_compare_ints (k1, k2) splay_tree_compare_ints (splay_tree_key k1, splay_tree_key k2)
splay_tree_key k1;
splay_tree_key k2;
{ {
if ((int) k1 < (int) k2) if ((int) k1 < (int) k2)
return -1; return -1;
@ -587,9 +546,7 @@ splay_tree_compare_ints (k1, k2)
/* Splay-tree comparison function, treating the keys as pointers. */ /* Splay-tree comparison function, treating the keys as pointers. */
int int
splay_tree_compare_pointers (k1, k2) splay_tree_compare_pointers (splay_tree_key k1, splay_tree_key k2)
splay_tree_key k1;
splay_tree_key k2;
{ {
if ((char*) k1 < (char*) k2) if ((char*) k1 < (char*) k2)
return -1; return -1;

View File

@ -30,19 +30,13 @@ Copies the string @var{src} into @var{dst}. Returns a pointer to
*/ */
#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 memcpy PARAMS ((PTR, const PTR, size_t)); extern PTR memcpy (PTR, const PTR, size_t);
char * char *
stpcpy (dst, src) stpcpy (char *dst, const char *src)
char *dst;
const char *src;
{ {
const size_t len = strlen (src); const size_t len = strlen (src);
return (char *) memcpy (dst, src, len + 1) + len; return (char *) memcpy (dst, src, len + 1) + len;

View File

@ -32,20 +32,13 @@ strlen(@var{src}).
*/ */
#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 char *strncpy PARAMS ((char *, const char *, size_t)); extern char *strncpy (char *, const char *, size_t);
char * char *
stpncpy (dst, src, len) stpncpy (char *dst, const char *src, size_t len)
char *dst;
const char *src;
size_t len;
{ {
size_t n = strlen (src); size_t n = strlen (src);
if (n > len) 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 */ #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
@ -73,8 +69,7 @@ static const unsigned char charmap[] = {
}; };
int int
strcasecmp(s1, s2) strcasecmp(const char *s1, const char *s2)
const char *s1, *s2;
{ {
register unsigned char u1, u2; register unsigned char u1, u2;

View File

@ -16,9 +16,7 @@ null character, the results are undefined.
#include <ansidecl.h> #include <ansidecl.h>
char * char *
strchr (s, c) strchr (register const char *s, int c)
register const char *s;
int c;
{ {
do { do {
if (*s == c) 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> #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 *
strdup(s) strdup(const char *s)
const char *s;
{ {
size_t len = strlen (s) + 1; size_t len = strlen (s) + 1;
char *result = (char*) malloc (len); char *result = (char*) malloc (len);