md5.h: Remove definition and uses of __P.

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

	* md5.h: Remove definition and uses of __P.
	* dyn-string.h: Remove uses of PARAMS.
	* fibheap.h: Likewise.
	* floatformat.h: Likewise.
	* hashtab.h: Likewise.

libiberty/

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

	Convert libiberty to use ISO C prototype style 4/n.
	* hashtab.c (higher_prime_index, hash_pointer, eq_pointer,
	htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2,
	htab_create_alloc, htab_set_functions_ex, htab_create,
	htab_try_create, htab_delete, htab_empty,
	find_empty_slot_for_expand, htab_expand, htab_find_with_hash,
	htab_find, htab_find_slot_with_hash, htab_find_slot,
	htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot,
	htab_traverse_noresize, htab_traverse, htab_collisions,
	htab_hash_string, iterative_hash): Use ISO C prototype.
	* hex.c (hex_init): Likewise.
	* index.c (index): Likewise.
	* insque.c (insque, remque): Likewise.
	* lbasename.c (lbasename): Likewise.
	* lrealpath.c (lrealpath): Likewise.
	* make-relative-prefix.c (save_string, split_directories,
	free_split_directories, make_relative_prefix): Likewise.
	* make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise.
	* md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
	md5_buffer, md5_process_bytes, md5_process_block): Likewise.
	* memchr.c (memchr): Likewise.
	* memcpy.c (memcpy): Likewise.
	* memmove.c (memmove): Likewise.
	* gettimeofday.c (gettimeofday): Likewise.
	* getruntime.c (get_run_time): Likewise.
	* getpwd.c (getpwd, getpwd): Likewise.
	* getpagesize.c (getpagesize): Likewise.
	* getopt1.c (getopt_long, getopt_long_only, main): Likewise.
	* getopt.c (my_index, exchange, _getopt_initialize,
	_getopt_internal, getopt, main): Likewise.
	* getcwd.c (getcwd): Likewise.
	* fnmatch.c (fnmatch): Likewise.
	* floatformat.c (floatformat_always_valid,
	floatformat_i387_ext_is_valid, get_field, floatformat_to_double,
	put_field, floatformat_from_double, floatformat_is_valid,
	ieee_test, main): Likewise.
	* fibheap.c (fibheap_new, fibnode_new, fibheap_compare,
	fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key,
	fibheap_union, fibheap_extract_min, fibheap_replace_key_data,
	fibheap_replace_key, fibheap_replace_data, fibheap_delete_node,
	fibheap_delete, fibheap_empty, fibheap_extr_min_node,
	fibheap_ins_root, fibheap_rem_root, fibheap_consolidate,
	fibheap_link, fibheap_cut, fibheap_cascading_cut,
	fibnode_insert_after, fibnode_remove): Likewise.
	* ffs.c (ffs): Likewise.
	* fdmatch.c (fdmatch): Likewise.
	* dyn-string.c (dyn_string_init, dyn_string_new,
	dyn_string_delete, dyn_string_release, dyn_string_resize,
	dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
	dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
	dyn_string_insert_cstr, dyn_string_insert_char,
	dyn_string_append, dyn_string_append_cstr,
	dyn_string_append_char, dyn_string_substring, dyn_string_eq):
	Likewise.

From-SVN: r97113
This commit is contained in:
Gabriel Dos Reis 2005-03-27 15:31:13 +00:00 committed by Gabriel Dos Reis
parent c295d7b369
commit 6da879de22
33 changed files with 334 additions and 528 deletions

View File

@ -1,3 +1,11 @@
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.
* dyn-string.h: Remove uses of PARAMS.
* fibheap.h: Likewise.
* floatformat.h: Likewise.
* hashtab.h: Likewise.
2005-03-26 Gabriel Dos Reis <gdr@integrable-solutions.net>
* demangle.h: Remove uses of PARAMS.

View File

@ -40,24 +40,21 @@ typedef struct dyn_string
(strcmp ((DS1)->s, (DS2)->s))
extern int dyn_string_init PARAMS ((struct dyn_string *, int));
extern dyn_string_t dyn_string_new PARAMS ((int));
extern void dyn_string_delete PARAMS ((dyn_string_t));
extern char *dyn_string_release PARAMS ((dyn_string_t));
extern dyn_string_t dyn_string_resize PARAMS ((dyn_string_t, int));
extern void dyn_string_clear PARAMS ((dyn_string_t));
extern int dyn_string_copy PARAMS ((dyn_string_t, dyn_string_t));
extern int dyn_string_copy_cstr PARAMS ((dyn_string_t, const char *));
extern int dyn_string_prepend PARAMS ((dyn_string_t, dyn_string_t));
extern int dyn_string_prepend_cstr PARAMS ((dyn_string_t, const char *));
extern int dyn_string_insert PARAMS ((dyn_string_t, int,
dyn_string_t));
extern int dyn_string_insert_cstr PARAMS ((dyn_string_t, int,
const char *));
extern int dyn_string_insert_char PARAMS ((dyn_string_t, int, int));
extern int dyn_string_append PARAMS ((dyn_string_t, dyn_string_t));
extern int dyn_string_append_cstr PARAMS ((dyn_string_t, const char *));
extern int dyn_string_append_char PARAMS ((dyn_string_t, int));
extern int dyn_string_substring PARAMS ((dyn_string_t,
dyn_string_t, int, int));
extern int dyn_string_eq PARAMS ((dyn_string_t, dyn_string_t));
extern int dyn_string_init (struct dyn_string *, int);
extern dyn_string_t dyn_string_new (int);
extern void dyn_string_delete (dyn_string_t);
extern char *dyn_string_release (dyn_string_t);
extern dyn_string_t dyn_string_resize (dyn_string_t, int);
extern void dyn_string_clear (dyn_string_t);
extern int dyn_string_copy (dyn_string_t, dyn_string_t);
extern int dyn_string_copy_cstr (dyn_string_t, const char *);
extern int dyn_string_prepend (dyn_string_t, dyn_string_t);
extern int dyn_string_prepend_cstr (dyn_string_t, const char *);
extern int dyn_string_insert (dyn_string_t, int, dyn_string_t);
extern int dyn_string_insert_cstr (dyn_string_t, int, const char *);
extern int dyn_string_insert_char (dyn_string_t, int, int);
extern int dyn_string_append (dyn_string_t, dyn_string_t);
extern int dyn_string_append_cstr (dyn_string_t, const char *);
extern int dyn_string_append_char (dyn_string_t, int);
extern int dyn_string_substring (dyn_string_t, dyn_string_t, int, int);
extern int dyn_string_eq (dyn_string_t, dyn_string_t);

View File

@ -68,19 +68,19 @@ typedef struct fibnode
#endif
} *fibnode_t;
extern fibheap_t fibheap_new PARAMS ((void));
extern fibnode_t fibheap_insert PARAMS ((fibheap_t, fibheapkey_t, void *));
extern int fibheap_empty PARAMS ((fibheap_t));
extern fibheapkey_t fibheap_min_key PARAMS ((fibheap_t));
extern fibheapkey_t fibheap_replace_key PARAMS ((fibheap_t, fibnode_t,
fibheapkey_t));
extern void *fibheap_replace_key_data PARAMS ((fibheap_t, fibnode_t,
fibheapkey_t, void *));
extern void *fibheap_extract_min PARAMS ((fibheap_t));
extern void *fibheap_min PARAMS ((fibheap_t));
extern void *fibheap_replace_data PARAMS ((fibheap_t, fibnode_t, void *));
extern void *fibheap_delete_node PARAMS ((fibheap_t, fibnode_t));
extern void fibheap_delete PARAMS ((fibheap_t));
extern fibheap_t fibheap_union PARAMS ((fibheap_t, fibheap_t));
extern fibheap_t fibheap_new (void);
extern fibnode_t fibheap_insert (fibheap_t, fibheapkey_t, void *);
extern int fibheap_empty (fibheap_t);
extern fibheapkey_t fibheap_min_key (fibheap_t);
extern fibheapkey_t fibheap_replace_key (fibheap_t, fibnode_t,
fibheapkey_t);
extern void *fibheap_replace_key_data (fibheap_t, fibnode_t,
fibheapkey_t, void *);
extern void *fibheap_extract_min (fibheap_t);
extern void *fibheap_min (fibheap_t);
extern void *fibheap_replace_data (fibheap_t, fibnode_t, void *);
extern void *fibheap_delete_node (fibheap_t, fibnode_t);
extern void fibheap_delete (fibheap_t);
extern fibheap_t fibheap_union (fibheap_t, fibheap_t);
#endif /* _FIBHEAP_H_ */

View File

@ -82,7 +82,7 @@ struct floatformat
const char *name;
/* Validator method. */
int (*is_valid) PARAMS ((const struct floatformat *fmt, const char *from));
int (*is_valid) (const struct floatformat *fmt, const char *from);
};
/* floatformats for IEEE single and double, big and little endian. */
@ -116,18 +116,17 @@ extern const struct floatformat floatformat_ia64_quad_little;
Store the double in *TO. */
extern void
floatformat_to_double PARAMS ((const struct floatformat *, const char *, double *));
floatformat_to_double (const struct floatformat *, const char *, double *);
/* The converse: convert the double *FROM to FMT
and store where TO points. */
extern void
floatformat_from_double PARAMS ((const struct floatformat *,
const double *, char *));
floatformat_from_double (const struct floatformat *, const double *, char *);
/* Return non-zero iff the data at FROM is a valid number in format FMT. */
extern int
floatformat_is_valid PARAMS ((const struct floatformat *fmt, const char *from));
floatformat_is_valid (const struct floatformat *fmt, const char *from);
#endif /* defined (FLOATFORMAT_H) */

View File

@ -48,38 +48,38 @@ typedef unsigned int hashval_t;
/* Callback function pointer types. */
/* Calculate hash of a table entry. */
typedef hashval_t (*htab_hash) PARAMS ((const void *));
typedef hashval_t (*htab_hash) (const void *);
/* Compare a table entry with a possible entry. The entry already in
the table always comes first, so the second element can be of a
different type (but in this case htab_find and htab_find_slot
cannot be used; instead the variants that accept a hash value
must be used). */
typedef int (*htab_eq) PARAMS ((const void *, const void *));
typedef int (*htab_eq) (const void *, const void *);
/* Cleanup function called whenever a live element is removed from
the hash table. */
typedef void (*htab_del) PARAMS ((void *));
typedef void (*htab_del) (void *);
/* Function called by htab_traverse for each live element. The first
arg is the slot of the element (which can be passed to htab_clear_slot
if desired), the second arg is the auxiliary pointer handed to
htab_traverse. Return 1 to continue scan, 0 to stop. */
typedef int (*htab_trav) PARAMS ((void **, void *));
typedef int (*htab_trav) (void **, void *);
/* Memory-allocation function, with the same functionality as calloc().
Iff it returns NULL, the hash table implementation will pass an error
code back to the user, so if your code doesn't handle errors,
best if you use xcalloc instead. */
typedef PTR (*htab_alloc) PARAMS ((size_t, size_t));
typedef PTR (*htab_alloc) (size_t, size_t);
/* We also need a free() routine. */
typedef void (*htab_free) PARAMS ((PTR));
typedef void (*htab_free) (PTR);
/* Memory allocation and deallocation; variants which take an extra
argument. */
typedef PTR (*htab_alloc_with_arg) PARAMS ((void *, size_t, size_t));
typedef void (*htab_free_with_arg) PARAMS ((void *, void *));
typedef PTR (*htab_alloc_with_arg) (void *, size_t, size_t);
typedef void (*htab_free_with_arg) (void *, void *);
/* Hash tables are of the following type. The structure
(implementation) of this type is not needed for using the hash
@ -139,45 +139,43 @@ enum insert_option {NO_INSERT, INSERT};
/* The prototypes of the package functions. */
extern htab_t htab_create_alloc PARAMS ((size_t, htab_hash,
htab_eq, htab_del,
htab_alloc, htab_free));
extern htab_t htab_create_alloc (size_t, htab_hash,
htab_eq, htab_del,
htab_alloc, htab_free);
extern htab_t htab_create_alloc_ex PARAMS ((size_t, htab_hash,
htab_eq, htab_del,
PTR, htab_alloc_with_arg,
htab_free_with_arg));
extern htab_t htab_create_alloc_ex (size_t, htab_hash,
htab_eq, htab_del,
PTR, htab_alloc_with_arg,
htab_free_with_arg);
/* Backward-compatibility functions. */
extern htab_t htab_create PARAMS ((size_t, htab_hash, htab_eq, htab_del));
extern htab_t htab_try_create PARAMS ((size_t, htab_hash, htab_eq, htab_del));
extern htab_t htab_create (size_t, htab_hash, htab_eq, htab_del);
extern htab_t htab_try_create (size_t, htab_hash, htab_eq, htab_del);
extern void htab_set_functions_ex PARAMS ((htab_t, htab_hash,
htab_eq, htab_del,
PTR, htab_alloc_with_arg,
htab_free_with_arg));
extern void htab_set_functions_ex (htab_t, htab_hash,
htab_eq, htab_del,
PTR, htab_alloc_with_arg,
htab_free_with_arg);
extern void htab_delete PARAMS ((htab_t));
extern void htab_empty PARAMS ((htab_t));
extern void htab_delete (htab_t);
extern void htab_empty (htab_t);
extern PTR htab_find PARAMS ((htab_t, const void *));
extern PTR *htab_find_slot PARAMS ((htab_t, const void *,
enum insert_option));
extern PTR htab_find_with_hash PARAMS ((htab_t, const void *,
hashval_t));
extern PTR *htab_find_slot_with_hash PARAMS ((htab_t, const void *,
hashval_t,
enum insert_option));
extern void htab_clear_slot PARAMS ((htab_t, void **));
extern void htab_remove_elt PARAMS ((htab_t, void *));
extern void htab_remove_elt_with_hash PARAMS ((htab_t, void *, hashval_t));
extern PTR htab_find (htab_t, const void *);
extern PTR *htab_find_slot (htab_t, const void *, enum insert_option);
extern PTR htab_find_with_hash (htab_t, const void *, hashval_t);
extern PTR *htab_find_slot_with_hash (htab_t, const void *,
hashval_t,
enum insert_option);
extern void htab_clear_slot (htab_t, void **);
extern void htab_remove_elt (htab_t, void *);
extern void htab_remove_elt_with_hash (htab_t, void *, hashval_t);
extern void htab_traverse PARAMS ((htab_t, htab_trav, void *));
extern void htab_traverse_noresize PARAMS ((htab_t, htab_trav, void *));
extern void htab_traverse (htab_t, htab_trav, void *);
extern void htab_traverse_noresize (htab_t, htab_trav, void *);
extern size_t htab_size PARAMS ((htab_t));
extern size_t htab_elements PARAMS ((htab_t));
extern double htab_collisions PARAMS ((htab_t));
extern size_t htab_size (htab_t);
extern size_t htab_elements (htab_t);
extern double htab_collisions (htab_t);
/* A hash function for pointers. */
extern htab_hash htab_hash_pointer;
@ -186,10 +184,10 @@ extern htab_hash htab_hash_pointer;
extern htab_eq htab_eq_pointer;
/* A hash function for null-terminated strings. */
extern hashval_t htab_hash_string PARAMS ((const PTR));
extern hashval_t htab_hash_string (const PTR);
/* An iterative hash function for arbitrary data. */
extern hashval_t iterative_hash PARAMS ((const PTR, size_t, hashval_t));
extern hashval_t iterative_hash (const PTR, size_t, hashval_t);
/* Shorthand for hashing something with an intrinsic size. */
#define iterative_hash_object(OB,INIT) iterative_hash (&OB, sizeof (OB), INIT)

View File

@ -66,13 +66,6 @@ typedef u_int32_t md5_uint32;
# endif
#endif
#undef __P
#if defined (__STDC__) && __STDC__
#define __P(x) x
#else
#define __P(x) ()
#endif
/* Structure to save state of computation between the single steps. */
struct md5_ctx
{
@ -93,21 +86,21 @@ struct md5_ctx
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
extern void md5_init_ctx __P ((struct md5_ctx *ctx));
extern void md5_init_ctx (struct md5_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is necessary that LEN is a multiple of 64!!! */
extern void md5_process_block __P ((const void *buffer, size_t len,
struct md5_ctx *ctx));
extern void md5_process_block (const void *buffer, size_t len,
struct md5_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is NOT required that LEN is a multiple of 64. */
extern void md5_process_bytes __P ((const void *buffer, size_t len,
struct md5_ctx *ctx));
extern void md5_process_bytes (const void *buffer, size_t len,
struct md5_ctx *ctx);
/* Process the remaining bytes in the buffer and put result from CTX
in first 16 bytes following RESBUF. The result is always in little
@ -116,7 +109,7 @@ extern void md5_process_bytes __P ((const void *buffer, size_t len,
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf);
/* Put result from CTX in first 16 bytes following RESBUF. The result is
@ -125,18 +118,18 @@ extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf);
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
extern int md5_stream __P ((FILE *stream, void *resblock));
extern int md5_stream (FILE *stream, void *resblock);
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
extern void *md5_buffer (const char *buffer, size_t len, void *resblock);
#endif

View File

@ -1,3 +1,60 @@
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 4/n.
* hashtab.c (higher_prime_index, hash_pointer, eq_pointer,
htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2,
htab_create_alloc, htab_set_functions_ex, htab_create,
htab_try_create, htab_delete, htab_empty,
find_empty_slot_for_expand, htab_expand, htab_find_with_hash,
htab_find, htab_find_slot_with_hash, htab_find_slot,
htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot,
htab_traverse_noresize, htab_traverse, htab_collisions,
htab_hash_string, iterative_hash): Use ISO C prototype.
* hex.c (hex_init): Likewise.
* index.c (index): Likewise.
* insque.c (insque, remque): Likewise.
* lbasename.c (lbasename): Likewise.
* lrealpath.c (lrealpath): Likewise.
* make-relative-prefix.c (save_string, split_directories,
free_split_directories, make_relative_prefix): Likewise.
* make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise.
* md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
md5_buffer, md5_process_bytes, md5_process_block): Likewise.
* memchr.c (memchr): Likewise.
* memcpy.c (memcpy): Likewise.
* memmove.c (memmove): Likewise.
* gettimeofday.c (gettimeofday): Likewise.
* getruntime.c (get_run_time): Likewise.
* getpwd.c (getpwd, getpwd): Likewise.
* getpagesize.c (getpagesize): Likewise.
* getopt1.c (getopt_long, getopt_long_only, main): Likewise.
* getopt.c (my_index, exchange, _getopt_initialize,
_getopt_internal, getopt, main): Likewise.
* getcwd.c (getcwd): Likewise.
* fnmatch.c (fnmatch): Likewise.
* floatformat.c (floatformat_always_valid,
floatformat_i387_ext_is_valid, get_field, floatformat_to_double,
put_field, floatformat_from_double, floatformat_is_valid,
ieee_test, main): Likewise.
* fibheap.c (fibheap_new, fibnode_new, fibheap_compare,
fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key,
fibheap_union, fibheap_extract_min, fibheap_replace_key_data,
fibheap_replace_key, fibheap_replace_data, fibheap_delete_node,
fibheap_delete, fibheap_empty, fibheap_extr_min_node,
fibheap_ins_root, fibheap_rem_root, fibheap_consolidate,
fibheap_link, fibheap_cut, fibheap_cascading_cut,
fibnode_insert_after, fibnode_remove): Likewise.
* ffs.c (ffs): Likewise.
* fdmatch.c (fdmatch): Likewise.
* dyn-string.c (dyn_string_init, dyn_string_new,
dyn_string_delete, dyn_string_release, dyn_string_resize,
dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
dyn_string_insert_cstr, dyn_string_insert_char,
dyn_string_append, dyn_string_append_cstr,
dyn_string_append_char, dyn_string_substring, dyn_string_eq):
Likewise.
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 3/n.

View File

@ -56,9 +56,7 @@ Boston, MA 02111-1307, USA. */
fails, returns 0. Otherwise returns 1. */
int
dyn_string_init (ds_struct_ptr, space)
struct dyn_string *ds_struct_ptr;
int space;
dyn_string_init (struct dyn_string *ds_struct_ptr, int space)
{
/* We need at least one byte in which to store the terminating NUL. */
if (space == 0)
@ -85,8 +83,7 @@ dyn_string_init (ds_struct_ptr, space)
returns the newly allocated string. */
dyn_string_t
dyn_string_new (space)
int space;
dyn_string_new (int space)
{
dyn_string_t result;
#ifdef RETURN_ON_ALLOCATION_FAILURE
@ -108,8 +105,7 @@ dyn_string_new (space)
/* Free the memory used by DS. */
void
dyn_string_delete (ds)
dyn_string_t ds;
dyn_string_delete (dyn_string_t ds)
{
free (ds->s);
free (ds);
@ -120,8 +116,7 @@ dyn_string_delete (ds)
DS is then set to the empty string. Deletes DS itself. */
char*
dyn_string_release (ds)
dyn_string_t ds;
dyn_string_release (dyn_string_t ds)
{
/* Store the old buffer. */
char* result = ds->s;
@ -141,9 +136,7 @@ dyn_string_release (ds)
operation fails, deletes DS and returns NULL. */
dyn_string_t
dyn_string_resize (ds, space)
dyn_string_t ds;
int space;
dyn_string_resize (dyn_string_t ds, int space)
{
int new_allocated = ds->allocated;
@ -176,8 +169,7 @@ dyn_string_resize (ds, space)
/* Sets the contents of DS to the empty string. */
void
dyn_string_clear (ds)
dyn_string_t ds;
dyn_string_clear (dyn_string_t ds)
{
/* A dyn_string always has room for at least the NUL terminator. */
ds->s[0] = '\0';
@ -189,9 +181,7 @@ dyn_string_clear (ds)
RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
int
dyn_string_copy (dest, src)
dyn_string_t dest;
dyn_string_t src;
dyn_string_copy (dyn_string_t dest, dyn_string_t src)
{
if (dest == src)
abort ();
@ -211,9 +201,7 @@ dyn_string_copy (dest, src)
and returns 0. */
int
dyn_string_copy_cstr (dest, src)
dyn_string_t dest;
const char *src;
dyn_string_copy_cstr (dyn_string_t dest, const char *src)
{
int length = strlen (src);
/* Make room in DEST. */
@ -232,9 +220,7 @@ dyn_string_copy_cstr (dest, src)
returns 0. */
int
dyn_string_prepend (dest, src)
dyn_string_t dest;
dyn_string_t src;
dyn_string_prepend (dyn_string_t dest, dyn_string_t src)
{
return dyn_string_insert (dest, 0, src);
}
@ -244,9 +230,7 @@ dyn_string_prepend (dest, src)
if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
int
dyn_string_prepend_cstr (dest, src)
dyn_string_t dest;
const char *src;
dyn_string_prepend_cstr (dyn_string_t dest, const char *src)
{
return dyn_string_insert_cstr (dest, 0, src);
}
@ -257,10 +241,7 @@ dyn_string_prepend_cstr (dest, src)
and returns 0. */
int
dyn_string_insert (dest, pos, src)
dyn_string_t dest;
int pos;
dyn_string_t src;
dyn_string_insert (dyn_string_t dest, int pos, dyn_string_t src)
{
int i;
@ -285,10 +266,7 @@ dyn_string_insert (dest, pos, src)
and returns 0. */
int
dyn_string_insert_cstr (dest, pos, src)
dyn_string_t dest;
int pos;
const char *src;
dyn_string_insert_cstr (dyn_string_t dest, int pos, const char *src)
{
int i;
int length = strlen (src);
@ -310,10 +288,7 @@ dyn_string_insert_cstr (dest, pos, src)
RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
int
dyn_string_insert_char (dest, pos, c)
dyn_string_t dest;
int pos;
int c;
dyn_string_insert_char (dyn_string_t dest, int pos, int c)
{
int i;
@ -334,9 +309,7 @@ dyn_string_insert_char (dest, pos, c)
returns 0. */
int
dyn_string_append (dest, s)
dyn_string_t dest;
dyn_string_t s;
dyn_string_append (dyn_string_t dest, dyn_string_t s)
{
if (dyn_string_resize (dest, dest->length + s->length) == 0)
return 0;
@ -350,9 +323,7 @@ dyn_string_append (dest, s)
deletes DEST and returns 0. */
int
dyn_string_append_cstr (dest, s)
dyn_string_t dest;
const char *s;
dyn_string_append_cstr (dyn_string_t dest, const char *s)
{
int len = strlen (s);
@ -369,9 +340,7 @@ dyn_string_append_cstr (dest, s)
if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
int
dyn_string_append_char (dest, c)
dyn_string_t dest;
int c;
dyn_string_append_char (dyn_string_t dest, int c)
{
/* Make room for the extra character. */
if (dyn_string_resize (dest, dest->length + 1) == NULL)
@ -392,11 +361,8 @@ dyn_string_append_char (dest, c)
deletes DEST and returns 0. */
int
dyn_string_substring (dest, src, start, end)
dyn_string_t dest;
dyn_string_t src;
int start;
int end;
dyn_string_substring (dyn_string_t dest, dyn_string_t src,
int start, int end)
{
int i;
int length = end - start;
@ -421,9 +387,7 @@ dyn_string_substring (dest, src, start, end)
/* Returns non-zero if DS1 and DS2 have the same contents. */
int
dyn_string_eq (ds1, ds2)
dyn_string_t ds1;
dyn_string_t ds2;
dyn_string_eq (dyn_string_t ds1, dyn_string_t ds2)
{
/* If DS1 and DS2 have different lengths, they must not be the same. */
if (ds1->length != ds2->length)

View File

@ -46,9 +46,7 @@ BUGS
#include <sys/types.h>
#include <sys/stat.h>
int fdmatch (fd1, fd2)
int fd1;
int fd2;
int fdmatch (int fd1, int fd2)
{
struct stat sbuf1;
struct stat sbuf2;

View File

@ -11,8 +11,7 @@ value 1). If @var{valu} is zero, zero is returned.
*/
int
ffs (valu)
register int valu;
ffs (register int valu)
{
register int bit;

View File

@ -37,32 +37,31 @@ Boston, MA 02111-1307, USA. */
#define FIBHEAPKEY_MIN LONG_MIN
static void fibheap_ins_root PARAMS ((fibheap_t, fibnode_t));
static void fibheap_rem_root PARAMS ((fibheap_t, fibnode_t));
static void fibheap_consolidate PARAMS ((fibheap_t));
static void fibheap_link PARAMS ((fibheap_t, fibnode_t, fibnode_t));
static void fibheap_cut PARAMS ((fibheap_t, fibnode_t, fibnode_t));
static void fibheap_cascading_cut PARAMS ((fibheap_t, fibnode_t));
static fibnode_t fibheap_extr_min_node PARAMS ((fibheap_t));
static int fibheap_compare PARAMS ((fibheap_t, fibnode_t, fibnode_t));
static int fibheap_comp_data PARAMS ((fibheap_t, fibheapkey_t, void *,
fibnode_t));
static fibnode_t fibnode_new PARAMS ((void));
static void fibnode_insert_after PARAMS ((fibnode_t, fibnode_t));
static void fibheap_ins_root (fibheap_t, fibnode_t);
static void fibheap_rem_root (fibheap_t, fibnode_t);
static void fibheap_consolidate (fibheap_t);
static void fibheap_link (fibheap_t, fibnode_t, fibnode_t);
static void fibheap_cut (fibheap_t, fibnode_t, fibnode_t);
static void fibheap_cascading_cut (fibheap_t, fibnode_t);
static fibnode_t fibheap_extr_min_node (fibheap_t);
static int fibheap_compare (fibheap_t, fibnode_t, fibnode_t);
static int fibheap_comp_data (fibheap_t, fibheapkey_t, void *, fibnode_t);
static fibnode_t fibnode_new (void);
static void fibnode_insert_after (fibnode_t, fibnode_t);
#define fibnode_insert_before(a, b) fibnode_insert_after (a->left, b)
static fibnode_t fibnode_remove PARAMS ((fibnode_t));
static fibnode_t fibnode_remove (fibnode_t);
/* Create a new fibonacci heap. */
fibheap_t
fibheap_new ()
fibheap_new (void)
{
return (fibheap_t) xcalloc (1, sizeof (struct fibheap));
}
/* Create a new fibonacci heap node. */
static fibnode_t
fibnode_new ()
fibnode_new (void)
{
fibnode_t node;
@ -74,10 +73,7 @@ fibnode_new ()
}
static inline int
fibheap_compare (heap, a, b)
fibheap_t heap ATTRIBUTE_UNUSED;
fibnode_t a;
fibnode_t b;
fibheap_compare (fibheap_t heap ATTRIBUTE_UNUSED, fibnode_t a, fibnode_t b)
{
if (a->key < b->key)
return -1;
@ -87,11 +83,7 @@ fibheap_compare (heap, a, b)
}
static inline int
fibheap_comp_data (heap, key, data, b)
fibheap_t heap;
fibheapkey_t key;
void *data;
fibnode_t b;
fibheap_comp_data (fibheap_t heap, fibheapkey_t key, void *data, fibnode_t b)
{
struct fibnode a;
@ -103,10 +95,7 @@ fibheap_comp_data (heap, key, data, b)
/* Insert DATA, with priority KEY, into HEAP. */
fibnode_t
fibheap_insert (heap, key, data)
fibheap_t heap;
fibheapkey_t key;
void *data;
fibheap_insert (fibheap_t heap, fibheapkey_t key, void *data)
{
fibnode_t node;
@ -132,8 +121,7 @@ fibheap_insert (heap, key, data)
/* Return the data of the minimum node (if we know it). */
void *
fibheap_min (heap)
fibheap_t heap;
fibheap_min (fibheap_t heap)
{
/* If there is no min, we can't easily return it. */
if (heap->min == NULL)
@ -143,8 +131,7 @@ fibheap_min (heap)
/* Return the key of the minimum node (if we know it). */
fibheapkey_t
fibheap_min_key (heap)
fibheap_t heap;
fibheap_min_key (fibheap_t heap)
{
/* If there is no min, we can't easily return it. */
if (heap->min == NULL)
@ -154,9 +141,7 @@ fibheap_min_key (heap)
/* Union HEAPA and HEAPB into a new heap. */
fibheap_t
fibheap_union (heapa, heapb)
fibheap_t heapa;
fibheap_t heapb;
fibheap_union (fibheap_t heapa, fibheap_t heapb)
{
fibnode_t a_root, b_root, temp;
@ -190,8 +175,7 @@ fibheap_union (heapa, heapb)
/* Extract the data of the minimum node from HEAP. */
void *
fibheap_extract_min (heap)
fibheap_t heap;
fibheap_extract_min (fibheap_t heap)
{
fibnode_t z;
void *ret = NULL;
@ -211,11 +195,8 @@ fibheap_extract_min (heap)
/* Replace both the KEY and the DATA associated with NODE. */
void *
fibheap_replace_key_data (heap, node, key, data)
fibheap_t heap;
fibnode_t node;
fibheapkey_t key;
void *data;
fibheap_replace_key_data (fibheap_t heap, fibnode_t node,
fibheapkey_t key, void *data)
{
void *odata;
fibheapkey_t okey;
@ -253,20 +234,14 @@ fibheap_replace_key_data (heap, node, key, data)
/* Replace the DATA associated with NODE. */
void *
fibheap_replace_data (heap, node, data)
fibheap_t heap;
fibnode_t node;
void *data;
fibheap_replace_data (fibheap_t heap, fibnode_t node, void *data)
{
return fibheap_replace_key_data (heap, node, node->key, data);
}
/* Replace the KEY associated with NODE. */
fibheapkey_t
fibheap_replace_key (heap, node, key)
fibheap_t heap;
fibnode_t node;
fibheapkey_t key;
fibheap_replace_key (fibheap_t heap, fibnode_t node, fibheapkey_t key)
{
int okey = node->key;
fibheap_replace_key_data (heap, node, key, node->data);
@ -275,9 +250,7 @@ fibheap_replace_key (heap, node, key)
/* Delete NODE from HEAP. */
void *
fibheap_delete_node (heap, node)
fibheap_t heap;
fibnode_t node;
fibheap_delete_node (fibheap_t heap, fibnode_t node)
{
void *ret = node->data;
@ -290,8 +263,7 @@ fibheap_delete_node (heap, node)
/* Delete HEAP. */
void
fibheap_delete (heap)
fibheap_t heap;
fibheap_delete (fibheap_t heap)
{
while (heap->min != NULL)
free (fibheap_extr_min_node (heap));
@ -301,16 +273,14 @@ fibheap_delete (heap)
/* Determine if HEAP is empty. */
int
fibheap_empty (heap)
fibheap_t heap;
fibheap_empty (fibheap_t heap)
{
return heap->nodes == 0;
}
/* Extract the minimum node of the heap. */
static fibnode_t
fibheap_extr_min_node (heap)
fibheap_t heap;
fibheap_extr_min_node (fibheap_t heap)
{
fibnode_t ret = heap->min;
fibnode_t x, y, orig;
@ -346,9 +316,7 @@ fibheap_extr_min_node (heap)
/* Insert NODE into the root list of HEAP. */
static void
fibheap_ins_root (heap, node)
fibheap_t heap;
fibnode_t node;
fibheap_ins_root (fibheap_t heap, fibnode_t node)
{
/* If the heap is currently empty, the new node becomes the singleton
circular root list. */
@ -367,9 +335,7 @@ fibheap_ins_root (heap, node)
/* Remove NODE from the rootlist of HEAP. */
static void
fibheap_rem_root (heap, node)
fibheap_t heap;
fibnode_t node;
fibheap_rem_root (fibheap_t heap, fibnode_t node)
{
if (node->left == node)
heap->root = NULL;
@ -379,8 +345,7 @@ fibheap_rem_root (heap, node)
/* Consolidate the heap. */
static void
fibheap_consolidate (heap)
fibheap_t heap;
fibheap_consolidate (fibheap_t heap)
{
fibnode_t a[1 + 8 * sizeof (long)];
fibnode_t w;
@ -427,10 +392,8 @@ fibheap_consolidate (heap)
/* Make NODE a child of PARENT. */
static void
fibheap_link (heap, node, parent)
fibheap_t heap ATTRIBUTE_UNUSED;
fibnode_t node;
fibnode_t parent;
fibheap_link (fibheap_t heap ATTRIBUTE_UNUSED,
fibnode_t node, fibnode_t parent)
{
if (parent->child == NULL)
parent->child = node;
@ -443,10 +406,7 @@ fibheap_link (heap, node, parent)
/* Remove NODE from PARENT's child list. */
static void
fibheap_cut (heap, node, parent)
fibheap_t heap;
fibnode_t node;
fibnode_t parent;
fibheap_cut (fibheap_t heap, fibnode_t node, fibnode_t parent)
{
fibnode_remove (node);
parent->degree--;
@ -456,9 +416,7 @@ fibheap_cut (heap, node, parent)
}
static void
fibheap_cascading_cut (heap, y)
fibheap_t heap;
fibnode_t y;
fibheap_cascading_cut (fibheap_t heap, fibnode_t y)
{
fibnode_t z;
@ -478,9 +436,7 @@ fibheap_cascading_cut (heap, y)
}
static void
fibnode_insert_after (a, b)
fibnode_t a;
fibnode_t b;
fibnode_insert_after (fibnode_t a, fibnode_t b)
{
if (a == a->right)
{
@ -499,8 +455,7 @@ fibnode_insert_after (a, b)
}
static fibnode_t
fibnode_remove (node)
fibnode_t node;
fibnode_remove (fibnode_t node)
{
fibnode_t ret;

View File

@ -46,18 +46,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define NAN (0.0 / 0.0)
#endif
static unsigned long get_field PARAMS ((const unsigned char *,
enum floatformat_byteorders,
unsigned int,
unsigned int,
unsigned int));
static int floatformat_always_valid PARAMS ((const struct floatformat *fmt,
const char *from));
static unsigned long get_field (const unsigned char *,
enum floatformat_byteorders,
unsigned int,
unsigned int,
unsigned int);
static int floatformat_always_valid (const struct floatformat *fmt,
const char *from);
static int
floatformat_always_valid (fmt, from)
const struct floatformat *fmt ATTRIBUTE_UNUSED;
const char *from ATTRIBUTE_UNUSED;
floatformat_always_valid (const struct floatformat *fmt ATTRIBUTE_UNUSED,
const char *from ATTRIBUTE_UNUSED)
{
return 1;
}
@ -108,12 +107,10 @@ const struct floatformat floatformat_ieee_double_littlebyte_bigword =
floatformat_always_valid
};
static int floatformat_i387_ext_is_valid PARAMS ((const struct floatformat *fmt, const char *from));
static int floatformat_i387_ext_is_valid (const struct floatformat *fmt, const char *from);
static int
floatformat_i387_ext_is_valid (fmt, from)
const struct floatformat *fmt;
const char *from;
floatformat_i387_ext_is_valid (const struct floatformat *fmt, const char *from)
{
/* In the i387 double-extended format, if the exponent is all ones,
then the integer bit must be set. If the exponent is neither 0
@ -220,12 +217,8 @@ const struct floatformat floatformat_ia64_quad_little =
/* Extract a field which starts at START and is LEN bits long. DATA and
TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
static unsigned long
get_field (data, order, total_len, start, len)
const unsigned char *data;
enum floatformat_byteorders order;
unsigned int total_len;
unsigned int start;
unsigned int len;
get_field (const unsigned char *data, enum floatformat_byteorders order,
unsigned int total_len, unsigned int start, unsigned int len)
{
unsigned long result;
unsigned int cur_byte;
@ -273,10 +266,8 @@ get_field (data, order, total_len, start, len)
Store the double in *TO. */
void
floatformat_to_double (fmt, from, to)
const struct floatformat *fmt;
const char *from;
double *to;
floatformat_to_double (const struct floatformat *fmt,
const char *from, double *to)
{
const unsigned char *ufrom = (const unsigned char *)from;
double dto;
@ -381,22 +372,18 @@ floatformat_to_double (fmt, from, to)
*to = dto;
}
static void put_field PARAMS ((unsigned char *, enum floatformat_byteorders,
unsigned int,
unsigned int,
unsigned int,
unsigned long));
static void put_field (unsigned char *, enum floatformat_byteorders,
unsigned int,
unsigned int,
unsigned int,
unsigned long);
/* Set a field which starts at START and is LEN bits long. DATA and
TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
static void
put_field (data, order, total_len, start, len, stuff_to_put)
unsigned char *data;
enum floatformat_byteorders order;
unsigned int total_len;
unsigned int start;
unsigned int len;
unsigned long stuff_to_put;
put_field (unsigned char *data, enum floatformat_byteorders order,
unsigned int total_len, unsigned int start, unsigned int len,
unsigned long stuff_to_put)
{
unsigned int cur_byte;
int cur_bitshift;
@ -443,10 +430,8 @@ put_field (data, order, total_len, start, len, stuff_to_put)
restrictions. */
void
floatformat_from_double (fmt, from, to)
const struct floatformat *fmt;
const double *from;
char *to;
floatformat_from_double (const struct floatformat *fmt,
const double *from, char *to)
{
double dfrom;
int exponent;
@ -541,9 +526,7 @@ floatformat_from_double (fmt, from, to)
/* Return non-zero iff the data at FROM is a valid number in format FMT. */
int
floatformat_is_valid (fmt, from)
const struct floatformat *fmt;
const char *from;
floatformat_is_valid (const struct floatformat *fmt, const char *from)
{
return fmt->is_valid (fmt, from);
}
@ -556,8 +539,7 @@ floatformat_is_valid (fmt, from)
/* This is to be run on a host which uses IEEE floating point. */
void
ieee_test (n)
double n;
ieee_test (double n)
{
double result;
@ -597,7 +579,7 @@ ieee_test (n)
}
int
main ()
main (void)
{
ieee_test (0.0);
ieee_test (0.5);

View File

@ -65,10 +65,7 @@ extern int errno;
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */
int
fnmatch (pattern, string, flags)
const char *pattern;
const char *string;
int flags;
fnmatch (const char *pattern, const char *string, int flags)
{
register const char *p = pattern, *n = string;
register unsigned char c;

View File

@ -38,9 +38,7 @@ extern int errno;
#endif
char *
getcwd (buf, len)
char *buf;
size_t len;
getcwd (char *buf, size_t len)
{
char ourbuf[MAXPATHLEN];
char *result;

View File

@ -217,9 +217,7 @@ extern char *getenv ();
#endif
static char *
my_index (str, chr)
const char *str;
int chr;
my_index (const char *str, int chr)
{
while (*str)
{
@ -307,8 +305,7 @@ static void exchange (char **);
#endif
static void
exchange (argv)
char **argv;
exchange (char **argv)
{
int bottom = first_nonopt;
int middle = last_nonopt;
@ -392,10 +389,7 @@ exchange (argv)
static const char *_getopt_initialize (int, char *const *, const char *);
#endif
static const char *
_getopt_initialize (argc, argv, optstring)
int argc;
char *const *argv;
const char *optstring;
_getopt_initialize (int argc, char *const *argv, const char *optstring)
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
@ -514,13 +508,9 @@ _getopt_initialize (argc, argv, optstring)
long-named options. */
int
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
int argc;
char *const *argv;
const char *optstring;
const struct option *longopts;
int *longind;
int long_only;
_getopt_internal (int argc, char *const *argv, const char *optstring,
const struct option *longopts,
int *longind, int long_only)
{
optarg = NULL;
@ -970,10 +960,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
}
int
getopt (argc, argv, optstring)
int argc;
char *const *argv;
const char *optstring;
getopt (int argc, char *const *argv, const char *optstring)
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
@ -989,9 +976,7 @@ getopt (argc, argv, optstring)
the above definition of `getopt'. */
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
int c;
int digit_optind = 0;

View File

@ -66,12 +66,8 @@
#endif
int
getopt_long (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
getopt_long (int argc, char *const *argv, const char *options,
const struct option *long_options, int *opt_index)
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
@ -82,12 +78,8 @@ getopt_long (argc, argv, options, long_options, opt_index)
instead. */
int
getopt_long_only (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
getopt_long_only (int argc, char *const *argv, const struct option *options,
const struct option *long_options, int *opt_index)
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
}
@ -100,9 +92,7 @@ getopt_long_only (argc, argv, options, long_options, opt_index)
#include <stdio.h>
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
int c;
int digit_optind = 0;

View File

@ -61,7 +61,7 @@ BUGS
#endif /* GNU_OUR_PAGESIZE */
int
getpagesize ()
getpagesize (void)
{
return (GNU_OUR_PAGESIZE);
}
@ -76,7 +76,7 @@ getpagesize ()
#endif
extern unsigned long lib$getsyi(const unsigned short *,...);
int getpagesize ()
int getpagesize (void)
{
long pagsiz = 0L;
unsigned short itmcod = SYI$_PAGE_SIZE;

View File

@ -67,7 +67,7 @@ extern char *getwd ();
yield 0 and set errno. */
char *
getpwd ()
getpwd (void)
{
static char *pwd;
static int failure_errno;
@ -114,7 +114,7 @@ getpwd ()
#endif
char *
getpwd ()
getpwd (void)
{
static char *pwd = 0;

View File

@ -90,7 +90,7 @@ process started.
*/
long
get_run_time ()
get_run_time (void)
{
#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
struct rusage rusage;

View File

@ -19,9 +19,7 @@ that @var{tz} be NULL. Returns 0 on success, -1 on failure.
*/
int
gettimeofday (tp, tz)
struct timeval *tp;
void *tz;
gettimeofday (struct timeval *tp, void *tz)
{
if (tz)
abort ();

View File

@ -73,14 +73,14 @@ Boston, MA 02111-1307, USA. */
#define DELETED_ENTRY ((PTR) 1)
static unsigned int higher_prime_index PARAMS ((unsigned long));
static hashval_t htab_mod_1 PARAMS ((hashval_t, hashval_t, hashval_t, int));
static hashval_t htab_mod PARAMS ((hashval_t, htab_t));
static hashval_t htab_mod_m2 PARAMS ((hashval_t, htab_t));
static hashval_t hash_pointer PARAMS ((const void *));
static int eq_pointer PARAMS ((const void *, const void *));
static int htab_expand PARAMS ((htab_t));
static PTR *find_empty_slot_for_expand PARAMS ((htab_t, hashval_t));
static unsigned int higher_prime_index (unsigned long);
static hashval_t htab_mod_1 (hashval_t, hashval_t, hashval_t, int);
static hashval_t htab_mod (hashval_t, htab_t);
static hashval_t htab_mod_m2 (hashval_t, htab_t);
static hashval_t hash_pointer (const void *);
static int eq_pointer (const void *, const void *);
static int htab_expand (htab_t);
static PTR *find_empty_slot_for_expand (htab_t, hashval_t);
/* At some point, we could make these be NULL, and modify the
hash-table routines to handle NULL specially; that would avoid
@ -176,8 +176,7 @@ static struct prime_ent const prime_tab[] = {
nearest prime number which is greater than N, and near a power of two. */
static unsigned int
higher_prime_index (n)
unsigned long n;
higher_prime_index (unsigned long n)
{
unsigned int low = 0;
unsigned int high = sizeof(prime_tab) / sizeof(prime_tab[0]);
@ -204,8 +203,7 @@ higher_prime_index (n)
/* Returns a hash code for P. */
static hashval_t
hash_pointer (p)
const PTR p;
hash_pointer (const PTR p)
{
return (hashval_t) ((long)p >> 3);
}
@ -213,9 +211,7 @@ hash_pointer (p)
/* Returns non-zero if P1 and P2 are equal. */
static int
eq_pointer (p1, p2)
const PTR p1;
const PTR p2;
eq_pointer (const PTR p1, const PTR p2)
{
return p1 == p2;
}
@ -223,8 +219,7 @@ eq_pointer (p1, p2)
/* Return the current size of given hash table. */
inline size_t
htab_size (htab)
htab_t htab;
htab_size (htab_t htab)
{
return htab->size;
}
@ -232,8 +227,7 @@ htab_size (htab)
/* Return the current number of elements in given hash table. */
inline size_t
htab_elements (htab)
htab_t htab;
htab_elements (htab_t htab)
{
return htab->n_elements - htab->n_deleted;
}
@ -241,9 +235,7 @@ htab_elements (htab)
/* Return X % Y. */
static inline hashval_t
htab_mod_1 (x, y, inv, shift)
hashval_t x, y, inv;
int shift;
htab_mod_1 (hashval_t x, hashval_t y, hashval_t inv, int shift)
{
/* The multiplicative inverses computed above are for 32-bit types, and
requires that we be able to compute a highpart multiply. */
@ -271,9 +263,7 @@ htab_mod_1 (x, y, inv, shift)
/* Compute the primary hash for HASH given HTAB's current size. */
static inline hashval_t
htab_mod (hash, htab)
hashval_t hash;
htab_t htab;
htab_mod (hashval_t hash, htab_t htab)
{
const struct prime_ent *p = &prime_tab[htab->size_prime_index];
return htab_mod_1 (hash, p->prime, p->inv, p->shift);
@ -282,9 +272,7 @@ htab_mod (hash, htab)
/* Compute the secondary hash for HASH given HTAB's current size. */
static inline hashval_t
htab_mod_m2 (hash, htab)
hashval_t hash;
htab_t htab;
htab_mod_m2 (hashval_t hash, htab_t htab)
{
const struct prime_ent *p = &prime_tab[htab->size_prime_index];
return 1 + htab_mod_1 (hash, p->prime - 2, p->inv_m2, p->shift);
@ -296,13 +284,8 @@ htab_mod_m2 (hash, htab)
created hash table, or NULL if memory allocation fails. */
htab_t
htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f)
size_t size;
htab_hash hash_f;
htab_eq eq_f;
htab_del del_f;
htab_alloc alloc_f;
htab_free free_f;
htab_create_alloc (size_t size, htab_hash hash_f, htab_eq eq_f,
htab_del del_f, htab_alloc alloc_f, htab_free free_f)
{
htab_t result;
unsigned int size_prime_index;
@ -374,14 +357,9 @@ htab_create_alloc_ex (size, hash_f, eq_f, del_f, alloc_arg, alloc_f,
/* Update the function pointers and allocation parameter in the htab_t. */
void
htab_set_functions_ex (htab, hash_f, eq_f, del_f, alloc_arg, alloc_f, free_f)
htab_t htab;
htab_hash hash_f;
htab_eq eq_f;
htab_del del_f;
PTR alloc_arg;
htab_alloc_with_arg alloc_f;
htab_free_with_arg free_f;
htab_set_functions_ex (htab_t htab, htab_hash hash_f, htab_eq eq_f,
htab_del del_f, PTR alloc_arg,
htab_alloc_with_arg alloc_f, htab_free_with_arg free_f)
{
htab->hash_f = hash_f;
htab->eq_f = eq_f;
@ -395,21 +373,13 @@ htab_set_functions_ex (htab, hash_f, eq_f, del_f, alloc_arg, alloc_f, free_f)
#undef htab_create
htab_t
htab_create (size, hash_f, eq_f, del_f)
size_t size;
htab_hash hash_f;
htab_eq eq_f;
htab_del del_f;
htab_create (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f)
{
return htab_create_alloc (size, hash_f, eq_f, del_f, xcalloc, free);
}
htab_t
htab_try_create (size, hash_f, eq_f, del_f)
size_t size;
htab_hash hash_f;
htab_eq eq_f;
htab_del del_f;
htab_try_create (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f)
{
return htab_create_alloc (size, hash_f, eq_f, del_f, calloc, free);
}
@ -418,8 +388,7 @@ htab_try_create (size, hash_f, eq_f, del_f)
Naturally the hash table must already exist. */
void
htab_delete (htab)
htab_t htab;
htab_delete (htab_t htab)
{
size_t size = htab_size (htab);
PTR *entries = htab->entries;
@ -445,8 +414,7 @@ htab_delete (htab)
/* This function clears all entries in the given hash table. */
void
htab_empty (htab)
htab_t htab;
htab_empty (htab_t htab)
{
size_t size = htab_size (htab);
PTR *entries = htab->entries;
@ -468,9 +436,7 @@ htab_empty (htab)
HASH is the hash value for the element to be inserted. */
static PTR *
find_empty_slot_for_expand (htab, hash)
htab_t htab;
hashval_t hash;
find_empty_slot_for_expand (htab_t htab, hashval_t hash)
{
hashval_t index = htab_mod (hash, htab);
size_t size = htab_size (htab);
@ -506,8 +472,7 @@ find_empty_slot_for_expand (htab, hash)
expanded. If all goes well, it will return a non-zero value. */
static int
htab_expand (htab)
htab_t htab;
htab_expand (htab_t htab)
{
PTR *oentries;
PTR *olimit;
@ -575,10 +540,7 @@ htab_expand (htab)
element. It cannot be used to insert or delete an element. */
PTR
htab_find_with_hash (htab, element, hash)
htab_t htab;
const PTR element;
hashval_t hash;
htab_find_with_hash (htab_t htab, const PTR element, hashval_t hash)
{
hashval_t index, hash2;
size_t size;
@ -612,9 +574,7 @@ htab_find_with_hash (htab, element, hash)
element. */
PTR
htab_find (htab, element)
htab_t htab;
const PTR element;
htab_find (htab_t htab, const PTR element)
{
return htab_find_with_hash (htab, element, (*htab->hash_f) (element));
}
@ -628,11 +588,8 @@ htab_find (htab, element)
allocation fails. */
PTR *
htab_find_slot_with_hash (htab, element, hash, insert)
htab_t htab;
const PTR element;
hashval_t hash;
enum insert_option insert;
htab_find_slot_with_hash (htab_t htab, const PTR element,
hashval_t hash, enum insert_option insert)
{
PTR *first_deleted_slot;
hashval_t index, hash2;
@ -699,10 +656,7 @@ htab_find_slot_with_hash (htab, element, hash, insert)
element. */
PTR *
htab_find_slot (htab, element, insert)
htab_t htab;
const PTR element;
enum insert_option insert;
htab_find_slot (htab_t htab, const PTR element, enum insert_option insert)
{
return htab_find_slot_with_hash (htab, element, (*htab->hash_f) (element),
insert);
@ -713,9 +667,7 @@ htab_find_slot (htab, element, insert)
element in the hash table, this function does nothing. */
void
htab_remove_elt (htab, element)
htab_t htab;
PTR element;
htab_remove_elt (htab_t htab, PTR element)
{
htab_remove_elt_with_hash (htab, element, (*htab->hash_f) (element));
}
@ -726,10 +678,7 @@ htab_remove_elt (htab, element)
function does nothing. */
void
htab_remove_elt_with_hash (htab, element, hash)
htab_t htab;
PTR element;
hashval_t hash;
htab_remove_elt_with_hash (htab_t htab, PTR element, hashval_t hash)
{
PTR *slot;
@ -749,9 +698,7 @@ htab_remove_elt_with_hash (htab, element, hash)
again. */
void
htab_clear_slot (htab, slot)
htab_t htab;
PTR *slot;
htab_clear_slot (htab_t htab, PTR *slot)
{
if (slot < htab->entries || slot >= htab->entries + htab_size (htab)
|| *slot == EMPTY_ENTRY || *slot == DELETED_ENTRY)
@ -770,10 +717,7 @@ htab_clear_slot (htab, slot)
argument. */
void
htab_traverse_noresize (htab, callback, info)
htab_t htab;
htab_trav callback;
PTR info;
htab_traverse_noresize (htab_t htab, htab_trav callback, PTR info)
{
PTR *slot;
PTR *limit;
@ -796,10 +740,7 @@ htab_traverse_noresize (htab, callback, info)
too empty to improve effectivity of subsequent calls. */
void
htab_traverse (htab, callback, info)
htab_t htab;
htab_trav callback;
PTR info;
htab_traverse (htab_t htab, htab_trav callback, PTR info)
{
if (htab_elements (htab) * 8 < htab_size (htab))
htab_expand (htab);
@ -811,8 +752,7 @@ htab_traverse (htab, callback, info)
hash table. */
double
htab_collisions (htab)
htab_t htab;
htab_collisions (htab_t htab)
{
if (htab->searches == 0)
return 0.0;
@ -846,8 +786,7 @@ htab_collisions (htab)
function they just started using for Perl's hashes. */
hashval_t
htab_hash_string (p)
const PTR p;
htab_hash_string (const PTR p)
{
const unsigned char *str = (const unsigned char *) p;
hashval_t r = 0;
@ -936,10 +875,11 @@ acceptable. Do NOT use for cryptographic purposes.
--------------------------------------------------------------------
*/
hashval_t iterative_hash (k_in, length, initval)
const PTR k_in; /* the key */
register size_t length; /* the length of the key */
register hashval_t initval; /* the previous hash, or an arbitrary value */
hashval_t
iterative_hash (const PTR k_in /* the key */,
register size_t length /* the length of the key */,
register hashval_t initval /* the previous hash, or
an arbitrary value */)
{
register const unsigned char *k = (const unsigned char *)k_in;
register hashval_t a,b,c,len;

View File

@ -153,7 +153,7 @@ unsigned char _hex_value[_hex_array_size];
#endif /* not ASCII */
void
hex_init ()
hex_init (void)
{
#ifndef HEX_TABLE_INITIALIZED
int i;

View File

@ -12,12 +12,10 @@ deprecated in new programs in favor of @code{strchr}.
*/
extern char * strchr();
extern char * strchr(const char *, int);
char *
index (s, c)
char *s;
int c;
index (char *s, int c)
{
return strchr (s, c);
}

View File

@ -33,9 +33,7 @@ struct qelem {
void
insque (elem, pred)
struct qelem *elem;
struct qelem *pred;
insque (struct qelem *elem, struct qelem *pred)
{
elem -> q_forw = pred -> q_forw;
pred -> q_forw -> q_back = elem;
@ -45,8 +43,7 @@ insque (elem, pred)
void
remque (elem)
struct qelem *elem;
remque (struct qelem *elem)
{
elem -> q_forw -> q_back = elem -> q_back;
elem -> q_back -> q_forw = elem -> q_forw;

View File

@ -43,8 +43,7 @@ and a path ending in @code{/} returns the empty string after it.
#include "filenames.h"
const char *
lbasename (name)
const char *name;
lbasename (const char *name)
{
const char *base;

View File

@ -73,8 +73,7 @@ extern char *canonicalize_file_name (const char *);
#endif
char *
lrealpath (filename)
const char *filename;
lrealpath (const char *filename)
{
/* Method 1: The system has a compile time upper bound on a filename
path. Use that and realpath() to canonicalize the name. This is

View File

@ -95,14 +95,12 @@ relative prefix can be found, return @code{NULL}.
#define DIR_UP ".."
static char *save_string PARAMS ((const char *, int));
static char **split_directories PARAMS ((const char *, int *));
static void free_split_directories PARAMS ((char **));
static char *save_string (const char *, int);
static char **split_directories (const char *, int *);
static void free_split_directories (char **);
static char *
save_string (s, len)
const char *s;
int len;
save_string (const char *s, int len)
{
char *result = malloc (len + 1);
@ -114,9 +112,7 @@ save_string (s, len)
/* Split a filename into component directories. */
static char **
split_directories (name, ptr_num_dirs)
const char *name;
int *ptr_num_dirs;
split_directories (const char *name, int *ptr_num_dirs)
{
int num_dirs = 0;
char **dirs;
@ -201,8 +197,7 @@ split_directories (name, ptr_num_dirs)
/* Release storage held by split directories. */
static void
free_split_directories (dirs)
char **dirs;
free_split_directories (char **dirs)
{
int i = 0;
@ -223,10 +218,8 @@ free_split_directories (dirs)
If no relative prefix can be found, return NULL. */
char *
make_relative_prefix (progname, bin_prefix, prefix)
const char *progname;
const char *bin_prefix;
const char *prefix;
make_relative_prefix (const char *progname,
const char *bin_prefix, const char *prefix)
{
char **prog_dirs, **bin_dirs, **prefix_dirs;
int prog_num, bin_num, prefix_num;

View File

@ -43,7 +43,7 @@ Boston, MA 02111-1307, USA. */
#endif
#include "libiberty.h"
extern int mkstemps PARAMS ((char *, int));
extern int mkstemps (char *, int);
/* '/' works just fine on MS-DOS based systems. */
#ifndef DIR_SEPARATOR
@ -61,11 +61,10 @@ extern int mkstemps PARAMS ((char *, int));
If success, DIR is returned.
Otherwise NULL is returned. */
static inline const char *try PARAMS ((const char *, const char *));
static inline const char *try (const char *, const char *);
static inline const char *
try (dir, base)
const char *dir, *base;
try (const char *dir, const char *base)
{
if (base != 0)
return base;
@ -95,7 +94,7 @@ files in.
*/
char *
choose_tmpdir ()
choose_tmpdir (void)
{
const char *base = 0;
char *tmpdir;
@ -146,8 +145,7 @@ string is @code{malloc}ed, and the temporary file has been created.
*/
char *
make_temp_file (suffix)
const char *suffix;
make_temp_file (const char *suffix)
{
const char *base = choose_tmpdir ();
char *temp_filename;

View File

@ -62,8 +62,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
void
md5_init_ctx (ctx)
struct md5_ctx *ctx;
md5_init_ctx (struct md5_ctx *ctx)
{
ctx->A = (md5_uint32) 0x67452301;
ctx->B = (md5_uint32) 0xefcdab89;
@ -80,9 +79,7 @@ md5_init_ctx (ctx)
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
void *
md5_read_ctx (ctx, resbuf)
const struct md5_ctx *ctx;
void *resbuf;
md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
{
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
@ -98,9 +95,7 @@ md5_read_ctx (ctx, resbuf)
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
void *
md5_finish_ctx (ctx, resbuf)
struct md5_ctx *ctx;
void *resbuf;
md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
{
/* Take yet unprocessed bytes into account. */
md5_uint32 bytes = ctx->buflen;
@ -129,9 +124,7 @@ md5_finish_ctx (ctx, resbuf)
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
int
md5_stream (stream, resblock)
FILE *stream;
void *resblock;
md5_stream (FILE *stream, void *resblock)
{
/* Important: BLOCKSIZE must be a multiple of 64. */
#define BLOCKSIZE 4096
@ -186,10 +179,7 @@ md5_stream (stream, resblock)
output yields to the wanted ASCII representation of the message
digest. */
void *
md5_buffer (buffer, len, resblock)
const char *buffer;
size_t len;
void *resblock;
md5_buffer (const char *buffer, size_t len, void *resblock)
{
struct md5_ctx ctx;
@ -205,10 +195,7 @@ md5_buffer (buffer, len, resblock)
void
md5_process_bytes (buffer, len, ctx)
const void *buffer;
size_t len;
struct md5_ctx *ctx;
md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
{
/* When we already have some bits in our internal buffer concatenate
both inputs first. */
@ -263,10 +250,7 @@ md5_process_bytes (buffer, len, ctx)
It is assumed that LEN % 64 == 0. */
void
md5_process_block (buffer, len, ctx)
const void *buffer;
size_t len;
struct md5_ctx *ctx;
md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
{
md5_uint32 correct_words[16];
const md5_uint32 *words = (const md5_uint32 *) buffer;

View File

@ -15,17 +15,10 @@ returned.
*/
#include <ansidecl.h>
#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
#endif
PTR
memchr (src_void, c, length)
register const PTR src_void;
int c;
size_t length;
memchr (register const PTR src_void, int c, size_t length)
{
const unsigned char *src = (const unsigned char *)src_void;

View File

@ -16,17 +16,10 @@ as if comparing unsigned char arrays.
*/
#include <ansidecl.h>
#ifdef ANSI_PROTOTYPES
#include <stddef.h>
#else
#define size_t unsigned long
#endif
int
memcmp (str1, str2, count)
const PTR str1;
const PTR str2;
size_t count;
memcmp (const PTR str1, const PTR str2, size_t count)
{
register const unsigned char *s1 = (const unsigned char*)str1;
register const unsigned char *s2 = (const unsigned char*)str2;

View File

@ -19,13 +19,10 @@ Copies @var{length} bytes from memory region @var{in} to region
#define size_t unsigned long
#endif
void bcopy PARAMS((const void*, void*, size_t));
void bcopy (const void*, void*, size_t);
PTR
memcpy (out, in, length)
PTR out;
const PTR in;
size_t length;
memcpy (PTR out, const PTR in, size_t length)
{
bcopy(in, out, length);
return out;

View File

@ -19,13 +19,10 @@ Copies @var{count} bytes from memory area @var{from} to memory area
#define size_t unsigned long
#endif
void bcopy PARAMS ((const void*, void*, size_t));
void bcopy (const void*, void*, size_t);
PTR
memmove (s1, s2, n)
PTR s1;
const PTR s2;
size_t n;
memmove (PTR s1, const PTR s2, size_t n)
{
bcopy (s2, s1, n);
return s1;