merge from gcc
This commit is contained in:
parent
6770045840
commit
49b1fae430
@ -1,3 +1,15 @@
|
|||||||
|
2005-03-27 Gabriel Dos Reis <gdr@integreable-solutions.net>
|
||||||
|
|
||||||
|
* ternary.h: Don't use PARAMS anymore.
|
||||||
|
|
||||||
|
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||||
|
|
||||||
|
* md5.h: Remove definition and uses of __P.
|
||||||
|
* 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>
|
2005-03-26 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||||
|
|
||||||
* demangle.h: Remove uses of PARAMS.
|
* demangle.h: Remove uses of PARAMS.
|
||||||
|
@ -40,24 +40,21 @@ typedef struct dyn_string
|
|||||||
(strcmp ((DS1)->s, (DS2)->s))
|
(strcmp ((DS1)->s, (DS2)->s))
|
||||||
|
|
||||||
|
|
||||||
extern int dyn_string_init PARAMS ((struct dyn_string *, int));
|
extern int dyn_string_init (struct dyn_string *, int);
|
||||||
extern dyn_string_t dyn_string_new PARAMS ((int));
|
extern dyn_string_t dyn_string_new (int);
|
||||||
extern void dyn_string_delete PARAMS ((dyn_string_t));
|
extern void dyn_string_delete (dyn_string_t);
|
||||||
extern char *dyn_string_release PARAMS ((dyn_string_t));
|
extern char *dyn_string_release (dyn_string_t);
|
||||||
extern dyn_string_t dyn_string_resize PARAMS ((dyn_string_t, int));
|
extern dyn_string_t dyn_string_resize (dyn_string_t, int);
|
||||||
extern void dyn_string_clear PARAMS ((dyn_string_t));
|
extern void dyn_string_clear (dyn_string_t);
|
||||||
extern int dyn_string_copy PARAMS ((dyn_string_t, dyn_string_t));
|
extern int dyn_string_copy (dyn_string_t, dyn_string_t);
|
||||||
extern int dyn_string_copy_cstr PARAMS ((dyn_string_t, const char *));
|
extern int dyn_string_copy_cstr (dyn_string_t, const char *);
|
||||||
extern int dyn_string_prepend PARAMS ((dyn_string_t, dyn_string_t));
|
extern int dyn_string_prepend (dyn_string_t, dyn_string_t);
|
||||||
extern int dyn_string_prepend_cstr PARAMS ((dyn_string_t, const char *));
|
extern int dyn_string_prepend_cstr (dyn_string_t, const char *);
|
||||||
extern int dyn_string_insert PARAMS ((dyn_string_t, int,
|
extern int dyn_string_insert (dyn_string_t, int, dyn_string_t);
|
||||||
dyn_string_t));
|
extern int dyn_string_insert_cstr (dyn_string_t, int, const char *);
|
||||||
extern int dyn_string_insert_cstr PARAMS ((dyn_string_t, int,
|
extern int dyn_string_insert_char (dyn_string_t, int, int);
|
||||||
const char *));
|
extern int dyn_string_append (dyn_string_t, dyn_string_t);
|
||||||
extern int dyn_string_insert_char PARAMS ((dyn_string_t, int, int));
|
extern int dyn_string_append_cstr (dyn_string_t, const char *);
|
||||||
extern int dyn_string_append PARAMS ((dyn_string_t, dyn_string_t));
|
extern int dyn_string_append_char (dyn_string_t, int);
|
||||||
extern int dyn_string_append_cstr PARAMS ((dyn_string_t, const char *));
|
extern int dyn_string_substring (dyn_string_t, dyn_string_t, int, int);
|
||||||
extern int dyn_string_append_char PARAMS ((dyn_string_t, int));
|
extern int dyn_string_eq (dyn_string_t, dyn_string_t);
|
||||||
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));
|
|
||||||
|
@ -68,19 +68,19 @@ typedef struct fibnode
|
|||||||
#endif
|
#endif
|
||||||
} *fibnode_t;
|
} *fibnode_t;
|
||||||
|
|
||||||
extern fibheap_t fibheap_new PARAMS ((void));
|
extern fibheap_t fibheap_new (void);
|
||||||
extern fibnode_t fibheap_insert PARAMS ((fibheap_t, fibheapkey_t, void *));
|
extern fibnode_t fibheap_insert (fibheap_t, fibheapkey_t, void *);
|
||||||
extern int fibheap_empty PARAMS ((fibheap_t));
|
extern int fibheap_empty (fibheap_t);
|
||||||
extern fibheapkey_t fibheap_min_key PARAMS ((fibheap_t));
|
extern fibheapkey_t fibheap_min_key (fibheap_t);
|
||||||
extern fibheapkey_t fibheap_replace_key PARAMS ((fibheap_t, fibnode_t,
|
extern fibheapkey_t fibheap_replace_key (fibheap_t, fibnode_t,
|
||||||
fibheapkey_t));
|
fibheapkey_t);
|
||||||
extern void *fibheap_replace_key_data PARAMS ((fibheap_t, fibnode_t,
|
extern void *fibheap_replace_key_data (fibheap_t, fibnode_t,
|
||||||
fibheapkey_t, void *));
|
fibheapkey_t, void *);
|
||||||
extern void *fibheap_extract_min PARAMS ((fibheap_t));
|
extern void *fibheap_extract_min (fibheap_t);
|
||||||
extern void *fibheap_min PARAMS ((fibheap_t));
|
extern void *fibheap_min (fibheap_t);
|
||||||
extern void *fibheap_replace_data PARAMS ((fibheap_t, fibnode_t, void *));
|
extern void *fibheap_replace_data (fibheap_t, fibnode_t, void *);
|
||||||
extern void *fibheap_delete_node PARAMS ((fibheap_t, fibnode_t));
|
extern void *fibheap_delete_node (fibheap_t, fibnode_t);
|
||||||
extern void fibheap_delete PARAMS ((fibheap_t));
|
extern void fibheap_delete (fibheap_t);
|
||||||
extern fibheap_t fibheap_union PARAMS ((fibheap_t, fibheap_t));
|
extern fibheap_t fibheap_union (fibheap_t, fibheap_t);
|
||||||
|
|
||||||
#endif /* _FIBHEAP_H_ */
|
#endif /* _FIBHEAP_H_ */
|
||||||
|
@ -82,7 +82,7 @@ struct floatformat
|
|||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
/* Validator method. */
|
/* 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. */
|
/* 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. */
|
Store the double in *TO. */
|
||||||
|
|
||||||
extern void
|
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
|
/* The converse: convert the double *FROM to FMT
|
||||||
and store where TO points. */
|
and store where TO points. */
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
floatformat_from_double PARAMS ((const struct floatformat *,
|
floatformat_from_double (const struct floatformat *, const double *, char *);
|
||||||
const double *, char *));
|
|
||||||
|
|
||||||
/* Return non-zero iff the data at FROM is a valid number in format FMT. */
|
/* Return non-zero iff the data at FROM is a valid number in format FMT. */
|
||||||
|
|
||||||
extern int
|
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) */
|
#endif /* defined (FLOATFORMAT_H) */
|
||||||
|
@ -48,38 +48,38 @@ typedef unsigned int hashval_t;
|
|||||||
/* Callback function pointer types. */
|
/* Callback function pointer types. */
|
||||||
|
|
||||||
/* Calculate hash of a table entry. */
|
/* 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
|
/* 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
|
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
|
different type (but in this case htab_find and htab_find_slot
|
||||||
cannot be used; instead the variants that accept a hash value
|
cannot be used; instead the variants that accept a hash value
|
||||||
must be used). */
|
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
|
/* Cleanup function called whenever a live element is removed from
|
||||||
the hash table. */
|
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
|
/* 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
|
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
|
if desired), the second arg is the auxiliary pointer handed to
|
||||||
htab_traverse. Return 1 to continue scan, 0 to stop. */
|
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().
|
/* Memory-allocation function, with the same functionality as calloc().
|
||||||
Iff it returns NULL, the hash table implementation will pass an error
|
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,
|
code back to the user, so if your code doesn't handle errors,
|
||||||
best if you use xcalloc instead. */
|
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. */
|
/* 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
|
/* Memory allocation and deallocation; variants which take an extra
|
||||||
argument. */
|
argument. */
|
||||||
typedef PTR (*htab_alloc_with_arg) PARAMS ((void *, size_t, size_t));
|
typedef PTR (*htab_alloc_with_arg) (void *, size_t, size_t);
|
||||||
typedef void (*htab_free_with_arg) PARAMS ((void *, void *));
|
typedef void (*htab_free_with_arg) (void *, void *);
|
||||||
|
|
||||||
/* Hash tables are of the following type. The structure
|
/* Hash tables are of the following type. The structure
|
||||||
(implementation) of this type is not needed for using the hash
|
(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. */
|
/* The prototypes of the package functions. */
|
||||||
|
|
||||||
extern htab_t htab_create_alloc PARAMS ((size_t, htab_hash,
|
extern htab_t htab_create_alloc (size_t, htab_hash,
|
||||||
htab_eq, htab_del,
|
htab_eq, htab_del,
|
||||||
htab_alloc, htab_free));
|
htab_alloc, htab_free);
|
||||||
|
|
||||||
extern htab_t htab_create_alloc_ex PARAMS ((size_t, htab_hash,
|
extern htab_t htab_create_alloc_ex (size_t, htab_hash,
|
||||||
htab_eq, htab_del,
|
htab_eq, htab_del,
|
||||||
PTR, htab_alloc_with_arg,
|
PTR, htab_alloc_with_arg,
|
||||||
htab_free_with_arg));
|
htab_free_with_arg);
|
||||||
|
|
||||||
/* Backward-compatibility functions. */
|
/* Backward-compatibility functions. */
|
||||||
extern htab_t htab_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 PARAMS ((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,
|
extern void htab_set_functions_ex (htab_t, htab_hash,
|
||||||
htab_eq, htab_del,
|
htab_eq, htab_del,
|
||||||
PTR, htab_alloc_with_arg,
|
PTR, htab_alloc_with_arg,
|
||||||
htab_free_with_arg));
|
htab_free_with_arg);
|
||||||
|
|
||||||
extern void htab_delete PARAMS ((htab_t));
|
extern void htab_delete (htab_t);
|
||||||
extern void htab_empty PARAMS ((htab_t));
|
extern void htab_empty (htab_t);
|
||||||
|
|
||||||
extern PTR htab_find PARAMS ((htab_t, const void *));
|
extern PTR htab_find (htab_t, const void *);
|
||||||
extern PTR *htab_find_slot PARAMS ((htab_t, const void *,
|
extern PTR *htab_find_slot (htab_t, const void *, enum insert_option);
|
||||||
enum insert_option));
|
extern PTR htab_find_with_hash (htab_t, const void *, hashval_t);
|
||||||
extern PTR htab_find_with_hash PARAMS ((htab_t, const void *,
|
extern PTR *htab_find_slot_with_hash (htab_t, const void *,
|
||||||
hashval_t));
|
hashval_t,
|
||||||
extern PTR *htab_find_slot_with_hash PARAMS ((htab_t, const void *,
|
enum insert_option);
|
||||||
hashval_t,
|
extern void htab_clear_slot (htab_t, void **);
|
||||||
enum insert_option));
|
extern void htab_remove_elt (htab_t, void *);
|
||||||
extern void htab_clear_slot PARAMS ((htab_t, void **));
|
extern void htab_remove_elt_with_hash (htab_t, void *, hashval_t);
|
||||||
extern void htab_remove_elt PARAMS ((htab_t, void *));
|
|
||||||
extern void htab_remove_elt_with_hash PARAMS ((htab_t, void *, hashval_t));
|
|
||||||
|
|
||||||
extern void htab_traverse PARAMS ((htab_t, htab_trav, void *));
|
extern void htab_traverse (htab_t, htab_trav, void *);
|
||||||
extern void htab_traverse_noresize PARAMS ((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_size (htab_t);
|
||||||
extern size_t htab_elements PARAMS ((htab_t));
|
extern size_t htab_elements (htab_t);
|
||||||
extern double htab_collisions PARAMS ((htab_t));
|
extern double htab_collisions (htab_t);
|
||||||
|
|
||||||
/* A hash function for pointers. */
|
/* A hash function for pointers. */
|
||||||
extern htab_hash htab_hash_pointer;
|
extern htab_hash htab_hash_pointer;
|
||||||
@ -186,10 +184,10 @@ extern htab_hash htab_hash_pointer;
|
|||||||
extern htab_eq htab_eq_pointer;
|
extern htab_eq htab_eq_pointer;
|
||||||
|
|
||||||
/* A hash function for null-terminated strings. */
|
/* 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. */
|
/* 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. */
|
/* Shorthand for hashing something with an intrinsic size. */
|
||||||
#define iterative_hash_object(OB,INIT) iterative_hash (&OB, sizeof (OB), INIT)
|
#define iterative_hash_object(OB,INIT) iterative_hash (&OB, sizeof (OB), INIT)
|
||||||
|
|
||||||
|
@ -66,13 +66,6 @@ typedef u_int32_t md5_uint32;
|
|||||||
# endif
|
# endif
|
||||||
#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. */
|
/* Structure to save state of computation between the single steps. */
|
||||||
struct md5_ctx
|
struct md5_ctx
|
||||||
{
|
{
|
||||||
@ -93,21 +86,21 @@ struct md5_ctx
|
|||||||
|
|
||||||
/* Initialize structure containing state of computation.
|
/* Initialize structure containing state of computation.
|
||||||
(RFC 1321, 3.3: Step 3) */
|
(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
|
/* Starting with the result of former calls of this function (or the
|
||||||
initialization function update the context for the next LEN bytes
|
initialization function update the context for the next LEN bytes
|
||||||
starting at BUFFER.
|
starting at BUFFER.
|
||||||
It is necessary that LEN is a multiple of 64!!! */
|
It is necessary that LEN is a multiple of 64!!! */
|
||||||
extern void md5_process_block __P ((const void *buffer, size_t len,
|
extern void md5_process_block (const void *buffer, size_t len,
|
||||||
struct md5_ctx *ctx));
|
struct md5_ctx *ctx);
|
||||||
|
|
||||||
/* Starting with the result of former calls of this function (or the
|
/* Starting with the result of former calls of this function (or the
|
||||||
initialization function update the context for the next LEN bytes
|
initialization function update the context for the next LEN bytes
|
||||||
starting at BUFFER.
|
starting at BUFFER.
|
||||||
It is NOT required that LEN is a multiple of 64. */
|
It is NOT required that LEN is a multiple of 64. */
|
||||||
extern void md5_process_bytes __P ((const void *buffer, size_t len,
|
extern void md5_process_bytes (const void *buffer, size_t len,
|
||||||
struct md5_ctx *ctx));
|
struct md5_ctx *ctx);
|
||||||
|
|
||||||
/* Process the remaining bytes in the buffer and put result from 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
|
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
|
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||||
aligned for a 32 bits value. */
|
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
|
/* 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
|
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||||
aligned for a 32 bits value. */
|
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
|
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||||
resulting message digest number will be written into the 16 bytes
|
resulting message digest number will be written into the 16 bytes
|
||||||
beginning at RESBLOCK. */
|
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
|
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
|
||||||
result is always in little endian byte order, so that a byte-wise
|
result is always in little endian byte order, so that a byte-wise
|
||||||
output yields to the wanted ASCII representation of the message
|
output yields to the wanted ASCII representation of the message
|
||||||
digest. */
|
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
|
#endif
|
||||||
|
@ -38,14 +38,14 @@ ternary_node;
|
|||||||
already there, and replace is 0.
|
already there, and replace is 0.
|
||||||
Otherwise, replaces if it it exists, inserts if it doesn't, and
|
Otherwise, replaces if it it exists, inserts if it doesn't, and
|
||||||
returns the data you passed in. */
|
returns the data you passed in. */
|
||||||
PTR ternary_insert PARAMS ((ternary_tree *p, const char *s,
|
PTR ternary_insert (ternary_tree *p, const char *s,
|
||||||
PTR data, int replace));
|
PTR data, int replace);
|
||||||
|
|
||||||
/* Delete the ternary search tree rooted at P.
|
/* Delete the ternary search tree rooted at P.
|
||||||
Does NOT delete the data you associated with the strings. */
|
Does NOT delete the data you associated with the strings. */
|
||||||
void ternary_cleanup PARAMS ((ternary_tree p));
|
void ternary_cleanup (ternary_tree p);
|
||||||
|
|
||||||
/* Search the ternary tree for string S, returning the data associated
|
/* Search the ternary tree for string S, returning the data associated
|
||||||
with it if found. */
|
with it if found. */
|
||||||
PTR ternary_search PARAMS ((const ternary_node *p, const char *s));
|
PTR ternary_search (const ternary_node *p, const char *s);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,31 +1,133 @@
|
|||||||
|
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||||
|
|
||||||
|
Convert libiberty to use ISO C prototype style 6/n.
|
||||||
|
* strerror.c (init_error_tables, errno_max, strerror, strerrno,
|
||||||
|
strtoerrno, main): Use ISO C prototype style.
|
||||||
|
* strncasecmp.c (strncasecmp): Likewise.
|
||||||
|
* strncmp.c (strncmp): Likewise.
|
||||||
|
* strndup.c (strndup): Likewise.
|
||||||
|
* strrchr.c (strrchr): Likewise.
|
||||||
|
* strsignal.c (init_signal_tables, signo_max, strsignal,
|
||||||
|
strsigno, strtosigno, psignal, main): Likewise.
|
||||||
|
* strstr.c (strstr): Likewise.
|
||||||
|
* strtod.c (strtod, atof): Likewise.
|
||||||
|
* strtol.c (strtol): Likewise.
|
||||||
|
* strtoul.c (strtoul): Likewise.
|
||||||
|
* ternary.c (ternary_insert, ternary_cleanup, ternary_search,
|
||||||
|
ternary_recursivesearch): Likewise.
|
||||||
|
* tmpnam.c (tmpnam): Likewise.
|
||||||
|
* unlink-if-ordinary.c (unlink_if_ordinary): Likewise.
|
||||||
|
* vasprintf.c (int_vasprintf, vasprintf, checkit, main): Likewise.
|
||||||
|
* vfork.c (vfork): Likewise.
|
||||||
|
* vfprintf.c (vfprintf): Likewise.
|
||||||
|
* vprintf.c (vprintf): Likewise.
|
||||||
|
* vsnprintf.c (vsnprintf, checkit, main): Likewise.
|
||||||
|
* vsprintf.c (vsprintf): Likewise.
|
||||||
|
* waitpid.c (waitpid): Likewise.
|
||||||
|
* xatexit.c (xatexit, xatexit_cleanup): Likewise.
|
||||||
|
* xexit.c (xexit): Likewise.
|
||||||
|
* xmalloc.c (xmalloc_set_program_name, xmalloc_failed, xmalloc,
|
||||||
|
xcalloc, xrealloc): Likewise.
|
||||||
|
* xmemdup.c (xmemdup): Likewise.
|
||||||
|
* xstrdup.c (xstrdup): Likewise.
|
||||||
|
* xstrerror.c (xstrerror): Likewise.
|
||||||
|
* xstrndup.c (xstrndup): Likewise.
|
||||||
|
|
||||||
|
2005-03-27 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
|
* configure.ac (ac_c_preproc_warn_flag): Remove -Wtraditional
|
||||||
|
flags.
|
||||||
|
* configure: Regenerated.
|
||||||
|
|
||||||
|
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||||
|
|
||||||
|
* getopt1.c (getopt_long_only): Fix thinko.
|
||||||
|
|
||||||
|
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>
|
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||||
|
|
||||||
Convert libiberty to use ISO C prototype style 3/n.
|
Convert libiberty to use ISO C prototype style 3/n.
|
||||||
* cplus-dem.c (set_cplus_marker_for_demangling, consume_count,
|
* cplus-dem.c (set_cplus_marker_for_demangling, consume_count,
|
||||||
consume_count_with_underscores, code_for_qualifier,
|
consume_count_with_underscores, code_for_qualifier,
|
||||||
qualifier_string, demangle_qualifier, cplus_demangle_opname,
|
qualifier_string, demangle_qualifier, cplus_demangle_opname,
|
||||||
cplus_mangle_opname, cplus_demangle_set_style,
|
cplus_mangle_opname, cplus_demangle_set_style,
|
||||||
cplus_demangle_name_to_style, cplus_demangle, grow_vect,
|
cplus_demangle_name_to_style, cplus_demangle, grow_vect,
|
||||||
ada_demangle, internal_cplus_demangle, squangle_mop_up,
|
ada_demangle, internal_cplus_demangle, squangle_mop_up,
|
||||||
work_stuff_copy_to_from, delete_non_B_K_work_stuff,
|
work_stuff_copy_to_from, delete_non_B_K_work_stuff,
|
||||||
delete_work_stuff, mop_up, demangle_signature,
|
delete_work_stuff, mop_up, demangle_signature,
|
||||||
demangle_method_args, demangle_template_template_parm,
|
demangle_method_args, demangle_template_template_parm,
|
||||||
demangle_expression, demangle_integral_value,
|
demangle_expression, demangle_integral_value,
|
||||||
demangle_real_value, demangle_template_value_parm,
|
demangle_real_value, demangle_template_value_parm,
|
||||||
demangle_template, arm_pt, demangle_arm_hp_template,
|
demangle_template, arm_pt, demangle_arm_hp_template,
|
||||||
demangle_class_name, demangle_class, iterate_demangle_function,
|
demangle_class_name, demangle_class, iterate_demangle_function,
|
||||||
demangle_prefix, gnu_special, recursively_demangle, arm_special,
|
demangle_prefix, gnu_special, recursively_demangle, arm_special,
|
||||||
demangle_qualified, get_count, do_type, demangle_fund_type,
|
demangle_qualified, get_count, do_type, demangle_fund_type,
|
||||||
do_hpacc_template_const_value, do_hpacc_template_literal,
|
do_hpacc_template_const_value, do_hpacc_template_literal,
|
||||||
snarf_numeric_literal, do_arg, remember_type, remember_Ktype,
|
snarf_numeric_literal, do_arg, remember_type, remember_Ktype,
|
||||||
register_Btype, remember_Btype, forget_B_and_K_types,
|
register_Btype, remember_Btype, forget_B_and_K_types,
|
||||||
forget_types, demangle_args, demangle_nested_args,
|
forget_types, demangle_args, demangle_nested_args,
|
||||||
demangle_function_name, string_need, string_delete, string_init,
|
demangle_function_name, string_need, string_delete, string_init,
|
||||||
string_clear, string_empty, string_append, string_appends,
|
string_clear, string_empty, string_append, string_appends,
|
||||||
string_appendn, string_prepend, string_prepends, string_prependn,
|
string_appendn, string_prepend, string_prepends, string_prependn,
|
||||||
string_append_template_idx): Use ISO C prootype style.
|
string_append_template_idx): Use ISO C prootype style.
|
||||||
* cp-demint.c (cplus_demangle_fill_component,
|
* cp-demint.c (cplus_demangle_fill_component,
|
||||||
cplus_demangle_fill_builtin_type, cplus_demangle_fill_operator,
|
cplus_demangle_fill_builtin_type, cplus_demangle_fill_operator,
|
||||||
cplus_demangle_v3_components): Likewise.
|
cplus_demangle_v3_components): Likewise.
|
||||||
|
|
||||||
2005-03-26 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
2005-03-26 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||||
@ -33,28 +135,28 @@
|
|||||||
Convert libiberty to use ISO C prototype style 2/n.
|
Convert libiberty to use ISO C prototype style 2/n.
|
||||||
* cp-demangle.h: Remove uses of PARAMS.
|
* cp-demangle.h: Remove uses of PARAMS.
|
||||||
* cp-demangle.c: Likewise.
|
* cp-demangle.c: Likewise.
|
||||||
(d_dump, cplus_demangle_fill_name,
|
(d_dump, cplus_demangle_fill_name,
|
||||||
cplus_demangle_fill_extended_operator, cplus_demangle_fill_ctor,
|
cplus_demangle_fill_extended_operator, cplus_demangle_fill_ctor,
|
||||||
cplus_demangle_fill_dtor, d_make_empty, d_make_comp, d_make_name,
|
cplus_demangle_fill_dtor, d_make_empty, d_make_comp, d_make_name,
|
||||||
d_make_builtin_type, d_make_operator, d_make_extended_operator,
|
d_make_builtin_type, d_make_operator, d_make_extended_operator,
|
||||||
d_make_ctor, d_make_dtor, d_make_template_param, d_make_sub,
|
d_make_ctor, d_make_dtor, d_make_template_param, d_make_sub,
|
||||||
cplus_demangle_mangled_name, has_return_type,
|
cplus_demangle_mangled_name, has_return_type,
|
||||||
is_ctor_dtor_or_conversion, d_encoding, d_name, d_nested_name,
|
is_ctor_dtor_or_conversion, d_encoding, d_name, d_nested_name,
|
||||||
d_prefix, d_unqualified_name, d_source_name, d_number,
|
d_prefix, d_unqualified_name, d_source_name, d_number,
|
||||||
d_identifier, d_operator_name, d_special_name, d_call_offset,
|
d_identifier, d_operator_name, d_special_name, d_call_offset,
|
||||||
d_ctor_dtor_name, cplus_demangle_type, d_cv_qualifiers,
|
d_ctor_dtor_name, cplus_demangle_type, d_cv_qualifiers,
|
||||||
d_function_type, d_bare_function_type, d_class_enum_type,
|
d_function_type, d_bare_function_type, d_class_enum_type,
|
||||||
d_array_type, d_pointer_to_member_type, d_template_param,
|
d_array_type, d_pointer_to_member_type, d_template_param,
|
||||||
d_template_args, d_template_arg, d_expression, d_expr_primary,
|
d_template_args, d_template_arg, d_expression, d_expr_primary,
|
||||||
d_local_name, d_discriminator, d_add_substitution,
|
d_local_name, d_discriminator, d_add_substitution,
|
||||||
d_substitution, d_print_resize, d_print_append_char,
|
d_substitution, d_print_resize, d_print_append_char,
|
||||||
d_print_append_buffer, d_print_error, cplus_demangle_print,
|
d_print_append_buffer, d_print_error, cplus_demangle_print,
|
||||||
d_print_comp, d_print_java_identifier, d_print_mod_list,
|
d_print_comp, d_print_java_identifier, d_print_mod_list,
|
||||||
d_print_mod, d_print_function_type, d_print_array_type,
|
d_print_mod, d_print_function_type, d_print_array_type,
|
||||||
d_print_expr_op, d_print_cast, cplus_demangle_init_info,
|
d_print_expr_op, d_print_cast, cplus_demangle_init_info,
|
||||||
d_demangle, __cxa_demangle, cplus_demangle_v3, java_demangle_v3,
|
d_demangle, __cxa_demangle, cplus_demangle_v3, java_demangle_v3,
|
||||||
is_ctor_or_dtor, is_gnu_v3_mangled_ctor, is_gnu_v3_mangled_dtor,
|
is_ctor_or_dtor, is_gnu_v3_mangled_ctor, is_gnu_v3_mangled_dtor,
|
||||||
print_usage, main):
|
print_usage, main):
|
||||||
|
|
||||||
2005-03-26 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
2005-03-26 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||||
|
|
||||||
@ -64,10 +166,10 @@
|
|||||||
(_doprnt, checkit, main): Use ISO C prototype.
|
(_doprnt, checkit, main): Use ISO C prototype.
|
||||||
* alloca.c (find_stack_direction, C_alloca): Use ISO C prototype.
|
* alloca.c (find_stack_direction, C_alloca): Use ISO C prototype.
|
||||||
* argv.c: Remove conditional #includes on ANSI_PROTOTYPES.
|
* argv.c: Remove conditional #includes on ANSI_PROTOTYPES.
|
||||||
(dupargv, freeargv, buildargv, main): Use ISO C prototype.
|
(dupargv, freeargv, buildargv, main): Use ISO C prototype.
|
||||||
* atexit.c (atexit): Likewise
|
* atexit.c (atexit): Likewise
|
||||||
* asprintf.c: Remove conditional include on ANSI_PROTOTYPES.
|
* asprintf.c: Remove conditional include on ANSI_PROTOTYPES.
|
||||||
(asprintf): Use ISO C prototype.
|
(asprintf): Use ISO C prototype.
|
||||||
* basename.c (basename): Likewise
|
* basename.c (basename): Likewise
|
||||||
* bcmp.c (bcmp): Likewise.
|
* bcmp.c (bcmp): Likewise.
|
||||||
* bcopy.c (bcopy): Likewise.
|
* bcopy.c (bcopy): Likewise.
|
||||||
@ -78,7 +180,7 @@
|
|||||||
(calloc): Use ISO C prototype.
|
(calloc): Use ISO C prototype.
|
||||||
* clock.c (clock): Likewise.
|
* clock.c (clock): Likewise.
|
||||||
* concat.c: Remove conditional #include on ANSI_PROTOTYPES.
|
* concat.c: Remove conditional #include on ANSI_PROTOTYPES.
|
||||||
(vconcat_length, vconcat_copy, concat_length, concat_copy,
|
(vconcat_length, vconcat_copy, concat_length, concat_copy,
|
||||||
concat_copy2, concat, reconcat, main): Use ISO C prototype.
|
concat_copy2, concat, reconcat, main): Use ISO C prototype.
|
||||||
* copysign.c (copysign): Likewise.
|
* copysign.c (copysign): Likewise.
|
||||||
|
|
||||||
@ -154,7 +256,7 @@
|
|||||||
* hex.c (hex_value): Group 'unsigned int' together to get correct
|
* hex.c (hex_value): Group 'unsigned int' together to get correct
|
||||||
markup.
|
markup.
|
||||||
* functions.texi: Regenerated.
|
* functions.texi: Regenerated.
|
||||||
|
|
||||||
2004-12-27 H.J. Lu <hongjiu.lu@intel.com>
|
2004-12-27 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* Makefile.in: Undo to 2004-12-17.
|
* Makefile.in: Undo to 2004-12-17.
|
||||||
@ -267,15 +369,15 @@
|
|||||||
|
|
||||||
* vasprintf.c: Accept __va_copy in addition to va_copy.
|
* vasprintf.c: Accept __va_copy in addition to va_copy.
|
||||||
|
|
||||||
2004-09-03 Paolo Bonzini <bonzini@gnu.org>
|
2004-09-03 Paolo Bonzini <bonzini@gnu.org>
|
||||||
|
|
||||||
* configure: Regenerate.
|
* configure: Regenerate.
|
||||||
|
|
||||||
2004-09-02 Paolo Bonzini <bonzini@gnu.org>
|
2004-09-02 Paolo Bonzini <bonzini@gnu.org>
|
||||||
|
|
||||||
* configure.ac: Do not enable multilibs for build-side libiberty.
|
* configure.ac: Do not enable multilibs for build-side libiberty.
|
||||||
|
|
||||||
2004-06-29 Danny Smith <dannysmith@users.sourceforge.net>
|
2004-06-29 Danny Smith <dannysmith@users.sourceforge.net>
|
||||||
|
|
||||||
* lrealpath.c (lrealpath): Add _WIN32 support.
|
* lrealpath.c (lrealpath): Add _WIN32 support.
|
||||||
|
|
||||||
|
2
libiberty/configure
vendored
2
libiberty/configure
vendored
@ -2930,7 +2930,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|||||||
ac_c_preproc_warn_flag=yes
|
ac_c_preproc_warn_flag=yes
|
||||||
|
|
||||||
if test x$GCC = xyes; then
|
if test x$GCC = xyes; then
|
||||||
ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'
|
ac_libiberty_warn_cflags='-W -Wall -pedantic'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ AC_PROG_CC
|
|||||||
AC_PROG_CPP_WERROR
|
AC_PROG_CPP_WERROR
|
||||||
|
|
||||||
if test x$GCC = xyes; then
|
if test x$GCC = xyes; then
|
||||||
ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'
|
ac_libiberty_warn_cflags='-W -Wall -pedantic'
|
||||||
fi
|
fi
|
||||||
AC_SUBST(ac_libiberty_warn_cflags)
|
AC_SUBST(ac_libiberty_warn_cflags)
|
||||||
|
|
||||||
|
@ -56,9 +56,7 @@ Boston, MA 02111-1307, USA. */
|
|||||||
fails, returns 0. Otherwise returns 1. */
|
fails, returns 0. Otherwise returns 1. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_init (ds_struct_ptr, space)
|
dyn_string_init (struct dyn_string *ds_struct_ptr, int space)
|
||||||
struct dyn_string *ds_struct_ptr;
|
|
||||||
int space;
|
|
||||||
{
|
{
|
||||||
/* We need at least one byte in which to store the terminating NUL. */
|
/* We need at least one byte in which to store the terminating NUL. */
|
||||||
if (space == 0)
|
if (space == 0)
|
||||||
@ -85,8 +83,7 @@ dyn_string_init (ds_struct_ptr, space)
|
|||||||
returns the newly allocated string. */
|
returns the newly allocated string. */
|
||||||
|
|
||||||
dyn_string_t
|
dyn_string_t
|
||||||
dyn_string_new (space)
|
dyn_string_new (int space)
|
||||||
int space;
|
|
||||||
{
|
{
|
||||||
dyn_string_t result;
|
dyn_string_t result;
|
||||||
#ifdef RETURN_ON_ALLOCATION_FAILURE
|
#ifdef RETURN_ON_ALLOCATION_FAILURE
|
||||||
@ -108,8 +105,7 @@ dyn_string_new (space)
|
|||||||
/* Free the memory used by DS. */
|
/* Free the memory used by DS. */
|
||||||
|
|
||||||
void
|
void
|
||||||
dyn_string_delete (ds)
|
dyn_string_delete (dyn_string_t ds)
|
||||||
dyn_string_t ds;
|
|
||||||
{
|
{
|
||||||
free (ds->s);
|
free (ds->s);
|
||||||
free (ds);
|
free (ds);
|
||||||
@ -120,8 +116,7 @@ dyn_string_delete (ds)
|
|||||||
DS is then set to the empty string. Deletes DS itself. */
|
DS is then set to the empty string. Deletes DS itself. */
|
||||||
|
|
||||||
char*
|
char*
|
||||||
dyn_string_release (ds)
|
dyn_string_release (dyn_string_t ds)
|
||||||
dyn_string_t ds;
|
|
||||||
{
|
{
|
||||||
/* Store the old buffer. */
|
/* Store the old buffer. */
|
||||||
char* result = ds->s;
|
char* result = ds->s;
|
||||||
@ -141,9 +136,7 @@ dyn_string_release (ds)
|
|||||||
operation fails, deletes DS and returns NULL. */
|
operation fails, deletes DS and returns NULL. */
|
||||||
|
|
||||||
dyn_string_t
|
dyn_string_t
|
||||||
dyn_string_resize (ds, space)
|
dyn_string_resize (dyn_string_t ds, int space)
|
||||||
dyn_string_t ds;
|
|
||||||
int space;
|
|
||||||
{
|
{
|
||||||
int new_allocated = ds->allocated;
|
int new_allocated = ds->allocated;
|
||||||
|
|
||||||
@ -176,8 +169,7 @@ dyn_string_resize (ds, space)
|
|||||||
/* Sets the contents of DS to the empty string. */
|
/* Sets the contents of DS to the empty string. */
|
||||||
|
|
||||||
void
|
void
|
||||||
dyn_string_clear (ds)
|
dyn_string_clear (dyn_string_t ds)
|
||||||
dyn_string_t ds;
|
|
||||||
{
|
{
|
||||||
/* A dyn_string always has room for at least the NUL terminator. */
|
/* A dyn_string always has room for at least the NUL terminator. */
|
||||||
ds->s[0] = '\0';
|
ds->s[0] = '\0';
|
||||||
@ -189,9 +181,7 @@ dyn_string_clear (ds)
|
|||||||
RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
|
RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_copy (dest, src)
|
dyn_string_copy (dyn_string_t dest, dyn_string_t src)
|
||||||
dyn_string_t dest;
|
|
||||||
dyn_string_t src;
|
|
||||||
{
|
{
|
||||||
if (dest == src)
|
if (dest == src)
|
||||||
abort ();
|
abort ();
|
||||||
@ -211,9 +201,7 @@ dyn_string_copy (dest, src)
|
|||||||
and returns 0. */
|
and returns 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_copy_cstr (dest, src)
|
dyn_string_copy_cstr (dyn_string_t dest, const char *src)
|
||||||
dyn_string_t dest;
|
|
||||||
const char *src;
|
|
||||||
{
|
{
|
||||||
int length = strlen (src);
|
int length = strlen (src);
|
||||||
/* Make room in DEST. */
|
/* Make room in DEST. */
|
||||||
@ -232,9 +220,7 @@ dyn_string_copy_cstr (dest, src)
|
|||||||
returns 0. */
|
returns 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_prepend (dest, src)
|
dyn_string_prepend (dyn_string_t dest, dyn_string_t src)
|
||||||
dyn_string_t dest;
|
|
||||||
dyn_string_t src;
|
|
||||||
{
|
{
|
||||||
return dyn_string_insert (dest, 0, 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. */
|
if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_prepend_cstr (dest, src)
|
dyn_string_prepend_cstr (dyn_string_t dest, const char *src)
|
||||||
dyn_string_t dest;
|
|
||||||
const char *src;
|
|
||||||
{
|
{
|
||||||
return dyn_string_insert_cstr (dest, 0, src);
|
return dyn_string_insert_cstr (dest, 0, src);
|
||||||
}
|
}
|
||||||
@ -257,10 +241,7 @@ dyn_string_prepend_cstr (dest, src)
|
|||||||
and returns 0. */
|
and returns 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_insert (dest, pos, src)
|
dyn_string_insert (dyn_string_t dest, int pos, dyn_string_t src)
|
||||||
dyn_string_t dest;
|
|
||||||
int pos;
|
|
||||||
dyn_string_t src;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -285,10 +266,7 @@ dyn_string_insert (dest, pos, src)
|
|||||||
and returns 0. */
|
and returns 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_insert_cstr (dest, pos, src)
|
dyn_string_insert_cstr (dyn_string_t dest, int pos, const char *src)
|
||||||
dyn_string_t dest;
|
|
||||||
int pos;
|
|
||||||
const char *src;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int length = strlen (src);
|
int length = strlen (src);
|
||||||
@ -310,10 +288,7 @@ dyn_string_insert_cstr (dest, pos, src)
|
|||||||
RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
|
RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_insert_char (dest, pos, c)
|
dyn_string_insert_char (dyn_string_t dest, int pos, int c)
|
||||||
dyn_string_t dest;
|
|
||||||
int pos;
|
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -334,9 +309,7 @@ dyn_string_insert_char (dest, pos, c)
|
|||||||
returns 0. */
|
returns 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_append (dest, s)
|
dyn_string_append (dyn_string_t dest, dyn_string_t s)
|
||||||
dyn_string_t dest;
|
|
||||||
dyn_string_t s;
|
|
||||||
{
|
{
|
||||||
if (dyn_string_resize (dest, dest->length + s->length) == 0)
|
if (dyn_string_resize (dest, dest->length + s->length) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@ -350,9 +323,7 @@ dyn_string_append (dest, s)
|
|||||||
deletes DEST and returns 0. */
|
deletes DEST and returns 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_append_cstr (dest, s)
|
dyn_string_append_cstr (dyn_string_t dest, const char *s)
|
||||||
dyn_string_t dest;
|
|
||||||
const char *s;
|
|
||||||
{
|
{
|
||||||
int len = strlen (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. */
|
if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_append_char (dest, c)
|
dyn_string_append_char (dyn_string_t dest, int c)
|
||||||
dyn_string_t dest;
|
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
/* Make room for the extra character. */
|
/* Make room for the extra character. */
|
||||||
if (dyn_string_resize (dest, dest->length + 1) == NULL)
|
if (dyn_string_resize (dest, dest->length + 1) == NULL)
|
||||||
@ -392,11 +361,8 @@ dyn_string_append_char (dest, c)
|
|||||||
deletes DEST and returns 0. */
|
deletes DEST and returns 0. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_substring (dest, src, start, end)
|
dyn_string_substring (dyn_string_t dest, dyn_string_t src,
|
||||||
dyn_string_t dest;
|
int start, int end)
|
||||||
dyn_string_t src;
|
|
||||||
int start;
|
|
||||||
int end;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int length = end - start;
|
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. */
|
/* Returns non-zero if DS1 and DS2 have the same contents. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dyn_string_eq (ds1, ds2)
|
dyn_string_eq (dyn_string_t ds1, dyn_string_t ds2)
|
||||||
dyn_string_t ds1;
|
|
||||||
dyn_string_t ds2;
|
|
||||||
{
|
{
|
||||||
/* If DS1 and DS2 have different lengths, they must not be the same. */
|
/* If DS1 and DS2 have different lengths, they must not be the same. */
|
||||||
if (ds1->length != ds2->length)
|
if (ds1->length != ds2->length)
|
||||||
|
@ -46,9 +46,7 @@ BUGS
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
int fdmatch (fd1, fd2)
|
int fdmatch (int fd1, int fd2)
|
||||||
int fd1;
|
|
||||||
int fd2;
|
|
||||||
{
|
{
|
||||||
struct stat sbuf1;
|
struct stat sbuf1;
|
||||||
struct stat sbuf2;
|
struct stat sbuf2;
|
||||||
|
@ -11,8 +11,7 @@ value 1). If @var{valu} is zero, zero is returned.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
ffs (valu)
|
ffs (register int valu)
|
||||||
register int valu;
|
|
||||||
{
|
{
|
||||||
register int bit;
|
register int bit;
|
||||||
|
|
||||||
|
@ -37,32 +37,31 @@ Boston, MA 02111-1307, USA. */
|
|||||||
|
|
||||||
#define FIBHEAPKEY_MIN LONG_MIN
|
#define FIBHEAPKEY_MIN LONG_MIN
|
||||||
|
|
||||||
static void fibheap_ins_root PARAMS ((fibheap_t, fibnode_t));
|
static void fibheap_ins_root (fibheap_t, fibnode_t);
|
||||||
static void fibheap_rem_root PARAMS ((fibheap_t, fibnode_t));
|
static void fibheap_rem_root (fibheap_t, fibnode_t);
|
||||||
static void fibheap_consolidate PARAMS ((fibheap_t));
|
static void fibheap_consolidate (fibheap_t);
|
||||||
static void fibheap_link PARAMS ((fibheap_t, fibnode_t, fibnode_t));
|
static void fibheap_link (fibheap_t, fibnode_t, fibnode_t);
|
||||||
static void fibheap_cut PARAMS ((fibheap_t, fibnode_t, fibnode_t));
|
static void fibheap_cut (fibheap_t, fibnode_t, fibnode_t);
|
||||||
static void fibheap_cascading_cut PARAMS ((fibheap_t, fibnode_t));
|
static void fibheap_cascading_cut (fibheap_t, fibnode_t);
|
||||||
static fibnode_t fibheap_extr_min_node PARAMS ((fibheap_t));
|
static fibnode_t fibheap_extr_min_node (fibheap_t);
|
||||||
static int fibheap_compare PARAMS ((fibheap_t, fibnode_t, fibnode_t));
|
static int fibheap_compare (fibheap_t, fibnode_t, fibnode_t);
|
||||||
static int fibheap_comp_data PARAMS ((fibheap_t, fibheapkey_t, void *,
|
static int fibheap_comp_data (fibheap_t, fibheapkey_t, void *, fibnode_t);
|
||||||
fibnode_t));
|
static fibnode_t fibnode_new (void);
|
||||||
static fibnode_t fibnode_new PARAMS ((void));
|
static void fibnode_insert_after (fibnode_t, fibnode_t);
|
||||||
static void fibnode_insert_after PARAMS ((fibnode_t, fibnode_t));
|
|
||||||
#define fibnode_insert_before(a, b) fibnode_insert_after (a->left, b)
|
#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. */
|
/* Create a new fibonacci heap. */
|
||||||
fibheap_t
|
fibheap_t
|
||||||
fibheap_new ()
|
fibheap_new (void)
|
||||||
{
|
{
|
||||||
return (fibheap_t) xcalloc (1, sizeof (struct fibheap));
|
return (fibheap_t) xcalloc (1, sizeof (struct fibheap));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new fibonacci heap node. */
|
/* Create a new fibonacci heap node. */
|
||||||
static fibnode_t
|
static fibnode_t
|
||||||
fibnode_new ()
|
fibnode_new (void)
|
||||||
{
|
{
|
||||||
fibnode_t node;
|
fibnode_t node;
|
||||||
|
|
||||||
@ -74,10 +73,7 @@ fibnode_new ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
fibheap_compare (heap, a, b)
|
fibheap_compare (fibheap_t heap ATTRIBUTE_UNUSED, fibnode_t a, fibnode_t b)
|
||||||
fibheap_t heap ATTRIBUTE_UNUSED;
|
|
||||||
fibnode_t a;
|
|
||||||
fibnode_t b;
|
|
||||||
{
|
{
|
||||||
if (a->key < b->key)
|
if (a->key < b->key)
|
||||||
return -1;
|
return -1;
|
||||||
@ -87,11 +83,7 @@ fibheap_compare (heap, a, b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
fibheap_comp_data (heap, key, data, b)
|
fibheap_comp_data (fibheap_t heap, fibheapkey_t key, void *data, fibnode_t b)
|
||||||
fibheap_t heap;
|
|
||||||
fibheapkey_t key;
|
|
||||||
void *data;
|
|
||||||
fibnode_t b;
|
|
||||||
{
|
{
|
||||||
struct fibnode a;
|
struct fibnode a;
|
||||||
|
|
||||||
@ -103,10 +95,7 @@ fibheap_comp_data (heap, key, data, b)
|
|||||||
|
|
||||||
/* Insert DATA, with priority KEY, into HEAP. */
|
/* Insert DATA, with priority KEY, into HEAP. */
|
||||||
fibnode_t
|
fibnode_t
|
||||||
fibheap_insert (heap, key, data)
|
fibheap_insert (fibheap_t heap, fibheapkey_t key, void *data)
|
||||||
fibheap_t heap;
|
|
||||||
fibheapkey_t key;
|
|
||||||
void *data;
|
|
||||||
{
|
{
|
||||||
fibnode_t node;
|
fibnode_t node;
|
||||||
|
|
||||||
@ -132,8 +121,7 @@ fibheap_insert (heap, key, data)
|
|||||||
|
|
||||||
/* Return the data of the minimum node (if we know it). */
|
/* Return the data of the minimum node (if we know it). */
|
||||||
void *
|
void *
|
||||||
fibheap_min (heap)
|
fibheap_min (fibheap_t heap)
|
||||||
fibheap_t heap;
|
|
||||||
{
|
{
|
||||||
/* If there is no min, we can't easily return it. */
|
/* If there is no min, we can't easily return it. */
|
||||||
if (heap->min == NULL)
|
if (heap->min == NULL)
|
||||||
@ -143,8 +131,7 @@ fibheap_min (heap)
|
|||||||
|
|
||||||
/* Return the key of the minimum node (if we know it). */
|
/* Return the key of the minimum node (if we know it). */
|
||||||
fibheapkey_t
|
fibheapkey_t
|
||||||
fibheap_min_key (heap)
|
fibheap_min_key (fibheap_t heap)
|
||||||
fibheap_t heap;
|
|
||||||
{
|
{
|
||||||
/* If there is no min, we can't easily return it. */
|
/* If there is no min, we can't easily return it. */
|
||||||
if (heap->min == NULL)
|
if (heap->min == NULL)
|
||||||
@ -154,9 +141,7 @@ fibheap_min_key (heap)
|
|||||||
|
|
||||||
/* Union HEAPA and HEAPB into a new heap. */
|
/* Union HEAPA and HEAPB into a new heap. */
|
||||||
fibheap_t
|
fibheap_t
|
||||||
fibheap_union (heapa, heapb)
|
fibheap_union (fibheap_t heapa, fibheap_t heapb)
|
||||||
fibheap_t heapa;
|
|
||||||
fibheap_t heapb;
|
|
||||||
{
|
{
|
||||||
fibnode_t a_root, b_root, temp;
|
fibnode_t a_root, b_root, temp;
|
||||||
|
|
||||||
@ -190,8 +175,7 @@ fibheap_union (heapa, heapb)
|
|||||||
|
|
||||||
/* Extract the data of the minimum node from HEAP. */
|
/* Extract the data of the minimum node from HEAP. */
|
||||||
void *
|
void *
|
||||||
fibheap_extract_min (heap)
|
fibheap_extract_min (fibheap_t heap)
|
||||||
fibheap_t heap;
|
|
||||||
{
|
{
|
||||||
fibnode_t z;
|
fibnode_t z;
|
||||||
void *ret = NULL;
|
void *ret = NULL;
|
||||||
@ -211,11 +195,8 @@ fibheap_extract_min (heap)
|
|||||||
|
|
||||||
/* Replace both the KEY and the DATA associated with NODE. */
|
/* Replace both the KEY and the DATA associated with NODE. */
|
||||||
void *
|
void *
|
||||||
fibheap_replace_key_data (heap, node, key, data)
|
fibheap_replace_key_data (fibheap_t heap, fibnode_t node,
|
||||||
fibheap_t heap;
|
fibheapkey_t key, void *data)
|
||||||
fibnode_t node;
|
|
||||||
fibheapkey_t key;
|
|
||||||
void *data;
|
|
||||||
{
|
{
|
||||||
void *odata;
|
void *odata;
|
||||||
fibheapkey_t okey;
|
fibheapkey_t okey;
|
||||||
@ -253,20 +234,14 @@ fibheap_replace_key_data (heap, node, key, data)
|
|||||||
|
|
||||||
/* Replace the DATA associated with NODE. */
|
/* Replace the DATA associated with NODE. */
|
||||||
void *
|
void *
|
||||||
fibheap_replace_data (heap, node, data)
|
fibheap_replace_data (fibheap_t heap, fibnode_t node, void *data)
|
||||||
fibheap_t heap;
|
|
||||||
fibnode_t node;
|
|
||||||
void *data;
|
|
||||||
{
|
{
|
||||||
return fibheap_replace_key_data (heap, node, node->key, data);
|
return fibheap_replace_key_data (heap, node, node->key, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Replace the KEY associated with NODE. */
|
/* Replace the KEY associated with NODE. */
|
||||||
fibheapkey_t
|
fibheapkey_t
|
||||||
fibheap_replace_key (heap, node, key)
|
fibheap_replace_key (fibheap_t heap, fibnode_t node, fibheapkey_t key)
|
||||||
fibheap_t heap;
|
|
||||||
fibnode_t node;
|
|
||||||
fibheapkey_t key;
|
|
||||||
{
|
{
|
||||||
int okey = node->key;
|
int okey = node->key;
|
||||||
fibheap_replace_key_data (heap, node, key, node->data);
|
fibheap_replace_key_data (heap, node, key, node->data);
|
||||||
@ -275,9 +250,7 @@ fibheap_replace_key (heap, node, key)
|
|||||||
|
|
||||||
/* Delete NODE from HEAP. */
|
/* Delete NODE from HEAP. */
|
||||||
void *
|
void *
|
||||||
fibheap_delete_node (heap, node)
|
fibheap_delete_node (fibheap_t heap, fibnode_t node)
|
||||||
fibheap_t heap;
|
|
||||||
fibnode_t node;
|
|
||||||
{
|
{
|
||||||
void *ret = node->data;
|
void *ret = node->data;
|
||||||
|
|
||||||
@ -290,8 +263,7 @@ fibheap_delete_node (heap, node)
|
|||||||
|
|
||||||
/* Delete HEAP. */
|
/* Delete HEAP. */
|
||||||
void
|
void
|
||||||
fibheap_delete (heap)
|
fibheap_delete (fibheap_t heap)
|
||||||
fibheap_t heap;
|
|
||||||
{
|
{
|
||||||
while (heap->min != NULL)
|
while (heap->min != NULL)
|
||||||
free (fibheap_extr_min_node (heap));
|
free (fibheap_extr_min_node (heap));
|
||||||
@ -301,16 +273,14 @@ fibheap_delete (heap)
|
|||||||
|
|
||||||
/* Determine if HEAP is empty. */
|
/* Determine if HEAP is empty. */
|
||||||
int
|
int
|
||||||
fibheap_empty (heap)
|
fibheap_empty (fibheap_t heap)
|
||||||
fibheap_t heap;
|
|
||||||
{
|
{
|
||||||
return heap->nodes == 0;
|
return heap->nodes == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract the minimum node of the heap. */
|
/* Extract the minimum node of the heap. */
|
||||||
static fibnode_t
|
static fibnode_t
|
||||||
fibheap_extr_min_node (heap)
|
fibheap_extr_min_node (fibheap_t heap)
|
||||||
fibheap_t heap;
|
|
||||||
{
|
{
|
||||||
fibnode_t ret = heap->min;
|
fibnode_t ret = heap->min;
|
||||||
fibnode_t x, y, orig;
|
fibnode_t x, y, orig;
|
||||||
@ -346,9 +316,7 @@ fibheap_extr_min_node (heap)
|
|||||||
|
|
||||||
/* Insert NODE into the root list of HEAP. */
|
/* Insert NODE into the root list of HEAP. */
|
||||||
static void
|
static void
|
||||||
fibheap_ins_root (heap, node)
|
fibheap_ins_root (fibheap_t heap, fibnode_t node)
|
||||||
fibheap_t heap;
|
|
||||||
fibnode_t node;
|
|
||||||
{
|
{
|
||||||
/* If the heap is currently empty, the new node becomes the singleton
|
/* If the heap is currently empty, the new node becomes the singleton
|
||||||
circular root list. */
|
circular root list. */
|
||||||
@ -367,9 +335,7 @@ fibheap_ins_root (heap, node)
|
|||||||
|
|
||||||
/* Remove NODE from the rootlist of HEAP. */
|
/* Remove NODE from the rootlist of HEAP. */
|
||||||
static void
|
static void
|
||||||
fibheap_rem_root (heap, node)
|
fibheap_rem_root (fibheap_t heap, fibnode_t node)
|
||||||
fibheap_t heap;
|
|
||||||
fibnode_t node;
|
|
||||||
{
|
{
|
||||||
if (node->left == node)
|
if (node->left == node)
|
||||||
heap->root = NULL;
|
heap->root = NULL;
|
||||||
@ -379,8 +345,7 @@ fibheap_rem_root (heap, node)
|
|||||||
|
|
||||||
/* Consolidate the heap. */
|
/* Consolidate the heap. */
|
||||||
static void
|
static void
|
||||||
fibheap_consolidate (heap)
|
fibheap_consolidate (fibheap_t heap)
|
||||||
fibheap_t heap;
|
|
||||||
{
|
{
|
||||||
fibnode_t a[1 + 8 * sizeof (long)];
|
fibnode_t a[1 + 8 * sizeof (long)];
|
||||||
fibnode_t w;
|
fibnode_t w;
|
||||||
@ -427,10 +392,8 @@ fibheap_consolidate (heap)
|
|||||||
|
|
||||||
/* Make NODE a child of PARENT. */
|
/* Make NODE a child of PARENT. */
|
||||||
static void
|
static void
|
||||||
fibheap_link (heap, node, parent)
|
fibheap_link (fibheap_t heap ATTRIBUTE_UNUSED,
|
||||||
fibheap_t heap ATTRIBUTE_UNUSED;
|
fibnode_t node, fibnode_t parent)
|
||||||
fibnode_t node;
|
|
||||||
fibnode_t parent;
|
|
||||||
{
|
{
|
||||||
if (parent->child == NULL)
|
if (parent->child == NULL)
|
||||||
parent->child = node;
|
parent->child = node;
|
||||||
@ -443,10 +406,7 @@ fibheap_link (heap, node, parent)
|
|||||||
|
|
||||||
/* Remove NODE from PARENT's child list. */
|
/* Remove NODE from PARENT's child list. */
|
||||||
static void
|
static void
|
||||||
fibheap_cut (heap, node, parent)
|
fibheap_cut (fibheap_t heap, fibnode_t node, fibnode_t parent)
|
||||||
fibheap_t heap;
|
|
||||||
fibnode_t node;
|
|
||||||
fibnode_t parent;
|
|
||||||
{
|
{
|
||||||
fibnode_remove (node);
|
fibnode_remove (node);
|
||||||
parent->degree--;
|
parent->degree--;
|
||||||
@ -456,9 +416,7 @@ fibheap_cut (heap, node, parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fibheap_cascading_cut (heap, y)
|
fibheap_cascading_cut (fibheap_t heap, fibnode_t y)
|
||||||
fibheap_t heap;
|
|
||||||
fibnode_t y;
|
|
||||||
{
|
{
|
||||||
fibnode_t z;
|
fibnode_t z;
|
||||||
|
|
||||||
@ -478,9 +436,7 @@ fibheap_cascading_cut (heap, y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fibnode_insert_after (a, b)
|
fibnode_insert_after (fibnode_t a, fibnode_t b)
|
||||||
fibnode_t a;
|
|
||||||
fibnode_t b;
|
|
||||||
{
|
{
|
||||||
if (a == a->right)
|
if (a == a->right)
|
||||||
{
|
{
|
||||||
@ -499,8 +455,7 @@ fibnode_insert_after (a, b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static fibnode_t
|
static fibnode_t
|
||||||
fibnode_remove (node)
|
fibnode_remove (fibnode_t node)
|
||||||
fibnode_t node;
|
|
||||||
{
|
{
|
||||||
fibnode_t ret;
|
fibnode_t ret;
|
||||||
|
|
||||||
|
@ -46,18 +46,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
#define NAN (0.0 / 0.0)
|
#define NAN (0.0 / 0.0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static unsigned long get_field PARAMS ((const unsigned char *,
|
static unsigned long get_field (const unsigned char *,
|
||||||
enum floatformat_byteorders,
|
enum floatformat_byteorders,
|
||||||
unsigned int,
|
unsigned int,
|
||||||
unsigned int,
|
unsigned int,
|
||||||
unsigned int));
|
unsigned int);
|
||||||
static int floatformat_always_valid PARAMS ((const struct floatformat *fmt,
|
static int floatformat_always_valid (const struct floatformat *fmt,
|
||||||
const char *from));
|
const char *from);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
floatformat_always_valid (fmt, from)
|
floatformat_always_valid (const struct floatformat *fmt ATTRIBUTE_UNUSED,
|
||||||
const struct floatformat *fmt ATTRIBUTE_UNUSED;
|
const char *from ATTRIBUTE_UNUSED)
|
||||||
const char *from ATTRIBUTE_UNUSED;
|
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -108,12 +107,10 @@ const struct floatformat floatformat_ieee_double_littlebyte_bigword =
|
|||||||
floatformat_always_valid
|
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
|
static int
|
||||||
floatformat_i387_ext_is_valid (fmt, from)
|
floatformat_i387_ext_is_valid (const struct floatformat *fmt, const char *from)
|
||||||
const struct floatformat *fmt;
|
|
||||||
const char *from;
|
|
||||||
{
|
{
|
||||||
/* In the i387 double-extended format, if the exponent is all ones,
|
/* 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
|
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
|
/* 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. */
|
TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
|
||||||
static unsigned long
|
static unsigned long
|
||||||
get_field (data, order, total_len, start, len)
|
get_field (const unsigned char *data, enum floatformat_byteorders order,
|
||||||
const unsigned char *data;
|
unsigned int total_len, unsigned int start, unsigned int len)
|
||||||
enum floatformat_byteorders order;
|
|
||||||
unsigned int total_len;
|
|
||||||
unsigned int start;
|
|
||||||
unsigned int len;
|
|
||||||
{
|
{
|
||||||
unsigned long result;
|
unsigned long result;
|
||||||
unsigned int cur_byte;
|
unsigned int cur_byte;
|
||||||
@ -273,10 +266,8 @@ get_field (data, order, total_len, start, len)
|
|||||||
Store the double in *TO. */
|
Store the double in *TO. */
|
||||||
|
|
||||||
void
|
void
|
||||||
floatformat_to_double (fmt, from, to)
|
floatformat_to_double (const struct floatformat *fmt,
|
||||||
const struct floatformat *fmt;
|
const char *from, double *to)
|
||||||
const char *from;
|
|
||||||
double *to;
|
|
||||||
{
|
{
|
||||||
const unsigned char *ufrom = (const unsigned char *)from;
|
const unsigned char *ufrom = (const unsigned char *)from;
|
||||||
double dto;
|
double dto;
|
||||||
@ -381,22 +372,18 @@ floatformat_to_double (fmt, from, to)
|
|||||||
*to = dto;
|
*to = dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void put_field PARAMS ((unsigned char *, enum floatformat_byteorders,
|
static void put_field (unsigned char *, enum floatformat_byteorders,
|
||||||
unsigned int,
|
unsigned int,
|
||||||
unsigned int,
|
unsigned int,
|
||||||
unsigned int,
|
unsigned int,
|
||||||
unsigned long));
|
unsigned long);
|
||||||
|
|
||||||
/* Set a field which starts at START and is LEN bits long. DATA and
|
/* 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. */
|
TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
|
||||||
static void
|
static void
|
||||||
put_field (data, order, total_len, start, len, stuff_to_put)
|
put_field (unsigned char *data, enum floatformat_byteorders order,
|
||||||
unsigned char *data;
|
unsigned int total_len, unsigned int start, unsigned int len,
|
||||||
enum floatformat_byteorders order;
|
unsigned long stuff_to_put)
|
||||||
unsigned int total_len;
|
|
||||||
unsigned int start;
|
|
||||||
unsigned int len;
|
|
||||||
unsigned long stuff_to_put;
|
|
||||||
{
|
{
|
||||||
unsigned int cur_byte;
|
unsigned int cur_byte;
|
||||||
int cur_bitshift;
|
int cur_bitshift;
|
||||||
@ -443,10 +430,8 @@ put_field (data, order, total_len, start, len, stuff_to_put)
|
|||||||
restrictions. */
|
restrictions. */
|
||||||
|
|
||||||
void
|
void
|
||||||
floatformat_from_double (fmt, from, to)
|
floatformat_from_double (const struct floatformat *fmt,
|
||||||
const struct floatformat *fmt;
|
const double *from, char *to)
|
||||||
const double *from;
|
|
||||||
char *to;
|
|
||||||
{
|
{
|
||||||
double dfrom;
|
double dfrom;
|
||||||
int exponent;
|
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. */
|
/* Return non-zero iff the data at FROM is a valid number in format FMT. */
|
||||||
|
|
||||||
int
|
int
|
||||||
floatformat_is_valid (fmt, from)
|
floatformat_is_valid (const struct floatformat *fmt, const char *from)
|
||||||
const struct floatformat *fmt;
|
|
||||||
const char *from;
|
|
||||||
{
|
{
|
||||||
return fmt->is_valid (fmt, 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. */
|
/* This is to be run on a host which uses IEEE floating point. */
|
||||||
|
|
||||||
void
|
void
|
||||||
ieee_test (n)
|
ieee_test (double n)
|
||||||
double n;
|
|
||||||
{
|
{
|
||||||
double result;
|
double result;
|
||||||
|
|
||||||
@ -597,7 +579,7 @@ ieee_test (n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
ieee_test (0.0);
|
ieee_test (0.0);
|
||||||
ieee_test (0.5);
|
ieee_test (0.5);
|
||||||
|
@ -65,10 +65,7 @@ extern int errno;
|
|||||||
/* Match STRING against the filename pattern PATTERN, returning zero if
|
/* Match STRING against the filename pattern PATTERN, returning zero if
|
||||||
it matches, nonzero if not. */
|
it matches, nonzero if not. */
|
||||||
int
|
int
|
||||||
fnmatch (pattern, string, flags)
|
fnmatch (const char *pattern, const char *string, int flags)
|
||||||
const char *pattern;
|
|
||||||
const char *string;
|
|
||||||
int flags;
|
|
||||||
{
|
{
|
||||||
register const char *p = pattern, *n = string;
|
register const char *p = pattern, *n = string;
|
||||||
register unsigned char c;
|
register unsigned char c;
|
||||||
|
@ -38,9 +38,7 @@ extern int errno;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getcwd (buf, len)
|
getcwd (char *buf, size_t len)
|
||||||
char *buf;
|
|
||||||
size_t len;
|
|
||||||
{
|
{
|
||||||
char ourbuf[MAXPATHLEN];
|
char ourbuf[MAXPATHLEN];
|
||||||
char *result;
|
char *result;
|
||||||
|
@ -217,9 +217,7 @@ extern char *getenv ();
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
my_index (str, chr)
|
my_index (const char *str, int chr)
|
||||||
const char *str;
|
|
||||||
int chr;
|
|
||||||
{
|
{
|
||||||
while (*str)
|
while (*str)
|
||||||
{
|
{
|
||||||
@ -307,8 +305,7 @@ static void exchange (char **);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exchange (argv)
|
exchange (char **argv)
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int bottom = first_nonopt;
|
int bottom = first_nonopt;
|
||||||
int middle = last_nonopt;
|
int middle = last_nonopt;
|
||||||
@ -392,10 +389,7 @@ exchange (argv)
|
|||||||
static const char *_getopt_initialize (int, char *const *, const char *);
|
static const char *_getopt_initialize (int, char *const *, const char *);
|
||||||
#endif
|
#endif
|
||||||
static const char *
|
static const char *
|
||||||
_getopt_initialize (argc, argv, optstring)
|
_getopt_initialize (int argc, char *const *argv, const char *optstring)
|
||||||
int argc;
|
|
||||||
char *const *argv;
|
|
||||||
const char *optstring;
|
|
||||||
{
|
{
|
||||||
/* Start processing options with ARGV-element 1 (since ARGV-element 0
|
/* Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||||
is the program name); the sequence of previously skipped
|
is the program name); the sequence of previously skipped
|
||||||
@ -514,13 +508,9 @@ _getopt_initialize (argc, argv, optstring)
|
|||||||
long-named options. */
|
long-named options. */
|
||||||
|
|
||||||
int
|
int
|
||||||
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
_getopt_internal (int argc, char *const *argv, const char *optstring,
|
||||||
int argc;
|
const struct option *longopts,
|
||||||
char *const *argv;
|
int *longind, int long_only)
|
||||||
const char *optstring;
|
|
||||||
const struct option *longopts;
|
|
||||||
int *longind;
|
|
||||||
int long_only;
|
|
||||||
{
|
{
|
||||||
optarg = NULL;
|
optarg = NULL;
|
||||||
|
|
||||||
@ -970,10 +960,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
getopt (argc, argv, optstring)
|
getopt (int argc, char *const *argv, const char *optstring)
|
||||||
int argc;
|
|
||||||
char *const *argv;
|
|
||||||
const char *optstring;
|
|
||||||
{
|
{
|
||||||
return _getopt_internal (argc, argv, optstring,
|
return _getopt_internal (argc, argv, optstring,
|
||||||
(const struct option *) 0,
|
(const struct option *) 0,
|
||||||
@ -989,9 +976,7 @@ getopt (argc, argv, optstring)
|
|||||||
the above definition of `getopt'. */
|
the above definition of `getopt'. */
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int digit_optind = 0;
|
int digit_optind = 0;
|
||||||
|
@ -66,12 +66,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
getopt_long (argc, argv, options, long_options, opt_index)
|
getopt_long (int argc, char *const *argv, const char *options,
|
||||||
int argc;
|
const struct option *long_options, int *opt_index)
|
||||||
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);
|
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. */
|
instead. */
|
||||||
|
|
||||||
int
|
int
|
||||||
getopt_long_only (argc, argv, options, long_options, opt_index)
|
getopt_long_only (int argc, char *const *argv, const char *options,
|
||||||
int argc;
|
const struct option *long_options, int *opt_index)
|
||||||
char *const *argv;
|
|
||||||
const char *options;
|
|
||||||
const struct option *long_options;
|
|
||||||
int *opt_index;
|
|
||||||
{
|
{
|
||||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
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>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int digit_optind = 0;
|
int digit_optind = 0;
|
||||||
|
@ -61,7 +61,7 @@ BUGS
|
|||||||
#endif /* GNU_OUR_PAGESIZE */
|
#endif /* GNU_OUR_PAGESIZE */
|
||||||
|
|
||||||
int
|
int
|
||||||
getpagesize ()
|
getpagesize (void)
|
||||||
{
|
{
|
||||||
return (GNU_OUR_PAGESIZE);
|
return (GNU_OUR_PAGESIZE);
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ getpagesize ()
|
|||||||
#endif
|
#endif
|
||||||
extern unsigned long lib$getsyi(const unsigned short *,...);
|
extern unsigned long lib$getsyi(const unsigned short *,...);
|
||||||
|
|
||||||
int getpagesize ()
|
int getpagesize (void)
|
||||||
{
|
{
|
||||||
long pagsiz = 0L;
|
long pagsiz = 0L;
|
||||||
unsigned short itmcod = SYI$_PAGE_SIZE;
|
unsigned short itmcod = SYI$_PAGE_SIZE;
|
||||||
|
@ -67,7 +67,7 @@ extern char *getwd ();
|
|||||||
yield 0 and set errno. */
|
yield 0 and set errno. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getpwd ()
|
getpwd (void)
|
||||||
{
|
{
|
||||||
static char *pwd;
|
static char *pwd;
|
||||||
static int failure_errno;
|
static int failure_errno;
|
||||||
@ -114,7 +114,7 @@ getpwd ()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getpwd ()
|
getpwd (void)
|
||||||
{
|
{
|
||||||
static char *pwd = 0;
|
static char *pwd = 0;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ process started.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
long
|
long
|
||||||
get_run_time ()
|
get_run_time (void)
|
||||||
{
|
{
|
||||||
#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
|
#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
|
||||||
struct rusage rusage;
|
struct rusage rusage;
|
||||||
|
@ -19,9 +19,7 @@ that @var{tz} be NULL. Returns 0 on success, -1 on failure.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
gettimeofday (tp, tz)
|
gettimeofday (struct timeval *tp, void *tz)
|
||||||
struct timeval *tp;
|
|
||||||
void *tz;
|
|
||||||
{
|
{
|
||||||
if (tz)
|
if (tz)
|
||||||
abort ();
|
abort ();
|
||||||
|
@ -73,14 +73,14 @@ Boston, MA 02111-1307, USA. */
|
|||||||
|
|
||||||
#define DELETED_ENTRY ((PTR) 1)
|
#define DELETED_ENTRY ((PTR) 1)
|
||||||
|
|
||||||
static unsigned int higher_prime_index PARAMS ((unsigned long));
|
static unsigned int higher_prime_index (unsigned long);
|
||||||
static hashval_t htab_mod_1 PARAMS ((hashval_t, hashval_t, hashval_t, int));
|
static hashval_t htab_mod_1 (hashval_t, hashval_t, hashval_t, int);
|
||||||
static hashval_t htab_mod PARAMS ((hashval_t, htab_t));
|
static hashval_t htab_mod (hashval_t, htab_t);
|
||||||
static hashval_t htab_mod_m2 PARAMS ((hashval_t, htab_t));
|
static hashval_t htab_mod_m2 (hashval_t, htab_t);
|
||||||
static hashval_t hash_pointer PARAMS ((const void *));
|
static hashval_t hash_pointer (const void *);
|
||||||
static int eq_pointer PARAMS ((const void *, const void *));
|
static int eq_pointer (const void *, const void *);
|
||||||
static int htab_expand PARAMS ((htab_t));
|
static int htab_expand (htab_t);
|
||||||
static PTR *find_empty_slot_for_expand PARAMS ((htab_t, hashval_t));
|
static PTR *find_empty_slot_for_expand (htab_t, hashval_t);
|
||||||
|
|
||||||
/* At some point, we could make these be NULL, and modify the
|
/* At some point, we could make these be NULL, and modify the
|
||||||
hash-table routines to handle NULL specially; that would avoid
|
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. */
|
nearest prime number which is greater than N, and near a power of two. */
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
higher_prime_index (n)
|
higher_prime_index (unsigned long n)
|
||||||
unsigned long n;
|
|
||||||
{
|
{
|
||||||
unsigned int low = 0;
|
unsigned int low = 0;
|
||||||
unsigned int high = sizeof(prime_tab) / sizeof(prime_tab[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. */
|
/* Returns a hash code for P. */
|
||||||
|
|
||||||
static hashval_t
|
static hashval_t
|
||||||
hash_pointer (p)
|
hash_pointer (const PTR p)
|
||||||
const PTR p;
|
|
||||||
{
|
{
|
||||||
return (hashval_t) ((long)p >> 3);
|
return (hashval_t) ((long)p >> 3);
|
||||||
}
|
}
|
||||||
@ -213,9 +211,7 @@ hash_pointer (p)
|
|||||||
/* Returns non-zero if P1 and P2 are equal. */
|
/* Returns non-zero if P1 and P2 are equal. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
eq_pointer (p1, p2)
|
eq_pointer (const PTR p1, const PTR p2)
|
||||||
const PTR p1;
|
|
||||||
const PTR p2;
|
|
||||||
{
|
{
|
||||||
return p1 == p2;
|
return p1 == p2;
|
||||||
}
|
}
|
||||||
@ -223,8 +219,7 @@ eq_pointer (p1, p2)
|
|||||||
/* Return the current size of given hash table. */
|
/* Return the current size of given hash table. */
|
||||||
|
|
||||||
inline size_t
|
inline size_t
|
||||||
htab_size (htab)
|
htab_size (htab_t htab)
|
||||||
htab_t htab;
|
|
||||||
{
|
{
|
||||||
return htab->size;
|
return htab->size;
|
||||||
}
|
}
|
||||||
@ -232,8 +227,7 @@ htab_size (htab)
|
|||||||
/* Return the current number of elements in given hash table. */
|
/* Return the current number of elements in given hash table. */
|
||||||
|
|
||||||
inline size_t
|
inline size_t
|
||||||
htab_elements (htab)
|
htab_elements (htab_t htab)
|
||||||
htab_t htab;
|
|
||||||
{
|
{
|
||||||
return htab->n_elements - htab->n_deleted;
|
return htab->n_elements - htab->n_deleted;
|
||||||
}
|
}
|
||||||
@ -241,9 +235,7 @@ htab_elements (htab)
|
|||||||
/* Return X % Y. */
|
/* Return X % Y. */
|
||||||
|
|
||||||
static inline hashval_t
|
static inline hashval_t
|
||||||
htab_mod_1 (x, y, inv, shift)
|
htab_mod_1 (hashval_t x, hashval_t y, hashval_t inv, int shift)
|
||||||
hashval_t x, y, inv;
|
|
||||||
int shift;
|
|
||||||
{
|
{
|
||||||
/* The multiplicative inverses computed above are for 32-bit types, and
|
/* The multiplicative inverses computed above are for 32-bit types, and
|
||||||
requires that we be able to compute a highpart multiply. */
|
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. */
|
/* Compute the primary hash for HASH given HTAB's current size. */
|
||||||
|
|
||||||
static inline hashval_t
|
static inline hashval_t
|
||||||
htab_mod (hash, htab)
|
htab_mod (hashval_t hash, htab_t htab)
|
||||||
hashval_t hash;
|
|
||||||
htab_t htab;
|
|
||||||
{
|
{
|
||||||
const struct prime_ent *p = &prime_tab[htab->size_prime_index];
|
const struct prime_ent *p = &prime_tab[htab->size_prime_index];
|
||||||
return htab_mod_1 (hash, p->prime, p->inv, p->shift);
|
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. */
|
/* Compute the secondary hash for HASH given HTAB's current size. */
|
||||||
|
|
||||||
static inline hashval_t
|
static inline hashval_t
|
||||||
htab_mod_m2 (hash, htab)
|
htab_mod_m2 (hashval_t hash, htab_t htab)
|
||||||
hashval_t hash;
|
|
||||||
htab_t htab;
|
|
||||||
{
|
{
|
||||||
const struct prime_ent *p = &prime_tab[htab->size_prime_index];
|
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);
|
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. */
|
created hash table, or NULL if memory allocation fails. */
|
||||||
|
|
||||||
htab_t
|
htab_t
|
||||||
htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f)
|
htab_create_alloc (size_t size, htab_hash hash_f, htab_eq eq_f,
|
||||||
size_t size;
|
htab_del del_f, htab_alloc alloc_f, htab_free free_f)
|
||||||
htab_hash hash_f;
|
|
||||||
htab_eq eq_f;
|
|
||||||
htab_del del_f;
|
|
||||||
htab_alloc alloc_f;
|
|
||||||
htab_free free_f;
|
|
||||||
{
|
{
|
||||||
htab_t result;
|
htab_t result;
|
||||||
unsigned int size_prime_index;
|
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. */
|
/* Update the function pointers and allocation parameter in the htab_t. */
|
||||||
|
|
||||||
void
|
void
|
||||||
htab_set_functions_ex (htab, hash_f, eq_f, del_f, alloc_arg, alloc_f, free_f)
|
htab_set_functions_ex (htab_t htab, htab_hash hash_f, htab_eq eq_f,
|
||||||
htab_t htab;
|
htab_del del_f, PTR alloc_arg,
|
||||||
htab_hash hash_f;
|
htab_alloc_with_arg alloc_f, htab_free_with_arg free_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->hash_f = hash_f;
|
||||||
htab->eq_f = eq_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
|
#undef htab_create
|
||||||
htab_t
|
htab_t
|
||||||
htab_create (size, hash_f, eq_f, del_f)
|
htab_create (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f)
|
||||||
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);
|
return htab_create_alloc (size, hash_f, eq_f, del_f, xcalloc, free);
|
||||||
}
|
}
|
||||||
|
|
||||||
htab_t
|
htab_t
|
||||||
htab_try_create (size, hash_f, eq_f, del_f)
|
htab_try_create (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f)
|
||||||
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);
|
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. */
|
Naturally the hash table must already exist. */
|
||||||
|
|
||||||
void
|
void
|
||||||
htab_delete (htab)
|
htab_delete (htab_t htab)
|
||||||
htab_t htab;
|
|
||||||
{
|
{
|
||||||
size_t size = htab_size (htab);
|
size_t size = htab_size (htab);
|
||||||
PTR *entries = htab->entries;
|
PTR *entries = htab->entries;
|
||||||
@ -445,8 +414,7 @@ htab_delete (htab)
|
|||||||
/* This function clears all entries in the given hash table. */
|
/* This function clears all entries in the given hash table. */
|
||||||
|
|
||||||
void
|
void
|
||||||
htab_empty (htab)
|
htab_empty (htab_t htab)
|
||||||
htab_t htab;
|
|
||||||
{
|
{
|
||||||
size_t size = htab_size (htab);
|
size_t size = htab_size (htab);
|
||||||
PTR *entries = htab->entries;
|
PTR *entries = htab->entries;
|
||||||
@ -468,9 +436,7 @@ htab_empty (htab)
|
|||||||
HASH is the hash value for the element to be inserted. */
|
HASH is the hash value for the element to be inserted. */
|
||||||
|
|
||||||
static PTR *
|
static PTR *
|
||||||
find_empty_slot_for_expand (htab, hash)
|
find_empty_slot_for_expand (htab_t htab, hashval_t hash)
|
||||||
htab_t htab;
|
|
||||||
hashval_t hash;
|
|
||||||
{
|
{
|
||||||
hashval_t index = htab_mod (hash, htab);
|
hashval_t index = htab_mod (hash, htab);
|
||||||
size_t size = htab_size (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. */
|
expanded. If all goes well, it will return a non-zero value. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
htab_expand (htab)
|
htab_expand (htab_t htab)
|
||||||
htab_t htab;
|
|
||||||
{
|
{
|
||||||
PTR *oentries;
|
PTR *oentries;
|
||||||
PTR *olimit;
|
PTR *olimit;
|
||||||
@ -575,10 +540,7 @@ htab_expand (htab)
|
|||||||
element. It cannot be used to insert or delete an element. */
|
element. It cannot be used to insert or delete an element. */
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
htab_find_with_hash (htab, element, hash)
|
htab_find_with_hash (htab_t htab, const PTR element, hashval_t hash)
|
||||||
htab_t htab;
|
|
||||||
const PTR element;
|
|
||||||
hashval_t hash;
|
|
||||||
{
|
{
|
||||||
hashval_t index, hash2;
|
hashval_t index, hash2;
|
||||||
size_t size;
|
size_t size;
|
||||||
@ -612,9 +574,7 @@ htab_find_with_hash (htab, element, hash)
|
|||||||
element. */
|
element. */
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
htab_find (htab, element)
|
htab_find (htab_t htab, const PTR element)
|
||||||
htab_t htab;
|
|
||||||
const PTR element;
|
|
||||||
{
|
{
|
||||||
return htab_find_with_hash (htab, element, (*htab->hash_f) (element));
|
return htab_find_with_hash (htab, element, (*htab->hash_f) (element));
|
||||||
}
|
}
|
||||||
@ -628,11 +588,8 @@ htab_find (htab, element)
|
|||||||
allocation fails. */
|
allocation fails. */
|
||||||
|
|
||||||
PTR *
|
PTR *
|
||||||
htab_find_slot_with_hash (htab, element, hash, insert)
|
htab_find_slot_with_hash (htab_t htab, const PTR element,
|
||||||
htab_t htab;
|
hashval_t hash, enum insert_option insert)
|
||||||
const PTR element;
|
|
||||||
hashval_t hash;
|
|
||||||
enum insert_option insert;
|
|
||||||
{
|
{
|
||||||
PTR *first_deleted_slot;
|
PTR *first_deleted_slot;
|
||||||
hashval_t index, hash2;
|
hashval_t index, hash2;
|
||||||
@ -699,10 +656,7 @@ htab_find_slot_with_hash (htab, element, hash, insert)
|
|||||||
element. */
|
element. */
|
||||||
|
|
||||||
PTR *
|
PTR *
|
||||||
htab_find_slot (htab, element, insert)
|
htab_find_slot (htab_t htab, const PTR element, enum insert_option insert)
|
||||||
htab_t htab;
|
|
||||||
const PTR element;
|
|
||||||
enum insert_option insert;
|
|
||||||
{
|
{
|
||||||
return htab_find_slot_with_hash (htab, element, (*htab->hash_f) (element),
|
return htab_find_slot_with_hash (htab, element, (*htab->hash_f) (element),
|
||||||
insert);
|
insert);
|
||||||
@ -713,9 +667,7 @@ htab_find_slot (htab, element, insert)
|
|||||||
element in the hash table, this function does nothing. */
|
element in the hash table, this function does nothing. */
|
||||||
|
|
||||||
void
|
void
|
||||||
htab_remove_elt (htab, element)
|
htab_remove_elt (htab_t htab, PTR element)
|
||||||
htab_t htab;
|
|
||||||
PTR element;
|
|
||||||
{
|
{
|
||||||
htab_remove_elt_with_hash (htab, element, (*htab->hash_f) (element));
|
htab_remove_elt_with_hash (htab, element, (*htab->hash_f) (element));
|
||||||
}
|
}
|
||||||
@ -726,10 +678,7 @@ htab_remove_elt (htab, element)
|
|||||||
function does nothing. */
|
function does nothing. */
|
||||||
|
|
||||||
void
|
void
|
||||||
htab_remove_elt_with_hash (htab, element, hash)
|
htab_remove_elt_with_hash (htab_t htab, PTR element, hashval_t hash)
|
||||||
htab_t htab;
|
|
||||||
PTR element;
|
|
||||||
hashval_t hash;
|
|
||||||
{
|
{
|
||||||
PTR *slot;
|
PTR *slot;
|
||||||
|
|
||||||
@ -749,9 +698,7 @@ htab_remove_elt_with_hash (htab, element, hash)
|
|||||||
again. */
|
again. */
|
||||||
|
|
||||||
void
|
void
|
||||||
htab_clear_slot (htab, slot)
|
htab_clear_slot (htab_t htab, PTR *slot)
|
||||||
htab_t htab;
|
|
||||||
PTR *slot;
|
|
||||||
{
|
{
|
||||||
if (slot < htab->entries || slot >= htab->entries + htab_size (htab)
|
if (slot < htab->entries || slot >= htab->entries + htab_size (htab)
|
||||||
|| *slot == EMPTY_ENTRY || *slot == DELETED_ENTRY)
|
|| *slot == EMPTY_ENTRY || *slot == DELETED_ENTRY)
|
||||||
@ -770,10 +717,7 @@ htab_clear_slot (htab, slot)
|
|||||||
argument. */
|
argument. */
|
||||||
|
|
||||||
void
|
void
|
||||||
htab_traverse_noresize (htab, callback, info)
|
htab_traverse_noresize (htab_t htab, htab_trav callback, PTR info)
|
||||||
htab_t htab;
|
|
||||||
htab_trav callback;
|
|
||||||
PTR info;
|
|
||||||
{
|
{
|
||||||
PTR *slot;
|
PTR *slot;
|
||||||
PTR *limit;
|
PTR *limit;
|
||||||
@ -796,10 +740,7 @@ htab_traverse_noresize (htab, callback, info)
|
|||||||
too empty to improve effectivity of subsequent calls. */
|
too empty to improve effectivity of subsequent calls. */
|
||||||
|
|
||||||
void
|
void
|
||||||
htab_traverse (htab, callback, info)
|
htab_traverse (htab_t htab, htab_trav callback, PTR info)
|
||||||
htab_t htab;
|
|
||||||
htab_trav callback;
|
|
||||||
PTR info;
|
|
||||||
{
|
{
|
||||||
if (htab_elements (htab) * 8 < htab_size (htab))
|
if (htab_elements (htab) * 8 < htab_size (htab))
|
||||||
htab_expand (htab);
|
htab_expand (htab);
|
||||||
@ -811,8 +752,7 @@ htab_traverse (htab, callback, info)
|
|||||||
hash table. */
|
hash table. */
|
||||||
|
|
||||||
double
|
double
|
||||||
htab_collisions (htab)
|
htab_collisions (htab_t htab)
|
||||||
htab_t htab;
|
|
||||||
{
|
{
|
||||||
if (htab->searches == 0)
|
if (htab->searches == 0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
@ -846,8 +786,7 @@ htab_collisions (htab)
|
|||||||
function they just started using for Perl's hashes. */
|
function they just started using for Perl's hashes. */
|
||||||
|
|
||||||
hashval_t
|
hashval_t
|
||||||
htab_hash_string (p)
|
htab_hash_string (const PTR p)
|
||||||
const PTR p;
|
|
||||||
{
|
{
|
||||||
const unsigned char *str = (const unsigned char *) p;
|
const unsigned char *str = (const unsigned char *) p;
|
||||||
hashval_t r = 0;
|
hashval_t r = 0;
|
||||||
@ -936,10 +875,11 @@ acceptable. Do NOT use for cryptographic purposes.
|
|||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hashval_t iterative_hash (k_in, length, initval)
|
hashval_t
|
||||||
const PTR k_in; /* the key */
|
iterative_hash (const PTR k_in /* the key */,
|
||||||
register size_t length; /* the length of the key */
|
register size_t length /* the length of the key */,
|
||||||
register hashval_t initval; /* the previous hash, or an arbitrary value */
|
register hashval_t initval /* the previous hash, or
|
||||||
|
an arbitrary value */)
|
||||||
{
|
{
|
||||||
register const unsigned char *k = (const unsigned char *)k_in;
|
register const unsigned char *k = (const unsigned char *)k_in;
|
||||||
register hashval_t a,b,c,len;
|
register hashval_t a,b,c,len;
|
||||||
|
@ -153,7 +153,7 @@ unsigned char _hex_value[_hex_array_size];
|
|||||||
#endif /* not ASCII */
|
#endif /* not ASCII */
|
||||||
|
|
||||||
void
|
void
|
||||||
hex_init ()
|
hex_init (void)
|
||||||
{
|
{
|
||||||
#ifndef HEX_TABLE_INITIALIZED
|
#ifndef HEX_TABLE_INITIALIZED
|
||||||
int i;
|
int i;
|
||||||
|
@ -12,12 +12,10 @@ deprecated in new programs in favor of @code{strchr}.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern char * strchr();
|
extern char * strchr(const char *, int);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
index (s, c)
|
index (char *s, int c)
|
||||||
char *s;
|
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
return strchr (s, c);
|
return strchr (s, c);
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,7 @@ struct qelem {
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
insque (elem, pred)
|
insque (struct qelem *elem, struct qelem *pred)
|
||||||
struct qelem *elem;
|
|
||||||
struct qelem *pred;
|
|
||||||
{
|
{
|
||||||
elem -> q_forw = pred -> q_forw;
|
elem -> q_forw = pred -> q_forw;
|
||||||
pred -> q_forw -> q_back = elem;
|
pred -> q_forw -> q_back = elem;
|
||||||
@ -45,8 +43,7 @@ insque (elem, pred)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
remque (elem)
|
remque (struct qelem *elem)
|
||||||
struct qelem *elem;
|
|
||||||
{
|
{
|
||||||
elem -> q_forw -> q_back = elem -> q_back;
|
elem -> q_forw -> q_back = elem -> q_back;
|
||||||
elem -> q_back -> q_forw = elem -> q_forw;
|
elem -> q_back -> q_forw = elem -> q_forw;
|
||||||
|
@ -43,8 +43,7 @@ and a path ending in @code{/} returns the empty string after it.
|
|||||||
#include "filenames.h"
|
#include "filenames.h"
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
lbasename (name)
|
lbasename (const char *name)
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
const char *base;
|
const char *base;
|
||||||
|
|
||||||
|
@ -73,8 +73,7 @@ extern char *canonicalize_file_name (const char *);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *
|
char *
|
||||||
lrealpath (filename)
|
lrealpath (const char *filename)
|
||||||
const char *filename;
|
|
||||||
{
|
{
|
||||||
/* Method 1: The system has a compile time upper bound on a 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
|
path. Use that and realpath() to canonicalize the name. This is
|
||||||
|
@ -95,14 +95,12 @@ relative prefix can be found, return @code{NULL}.
|
|||||||
|
|
||||||
#define DIR_UP ".."
|
#define DIR_UP ".."
|
||||||
|
|
||||||
static char *save_string PARAMS ((const char *, int));
|
static char *save_string (const char *, int);
|
||||||
static char **split_directories PARAMS ((const char *, int *));
|
static char **split_directories (const char *, int *);
|
||||||
static void free_split_directories PARAMS ((char **));
|
static void free_split_directories (char **);
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
save_string (s, len)
|
save_string (const char *s, int len)
|
||||||
const char *s;
|
|
||||||
int len;
|
|
||||||
{
|
{
|
||||||
char *result = malloc (len + 1);
|
char *result = malloc (len + 1);
|
||||||
|
|
||||||
@ -114,9 +112,7 @@ save_string (s, len)
|
|||||||
/* Split a filename into component directories. */
|
/* Split a filename into component directories. */
|
||||||
|
|
||||||
static char **
|
static char **
|
||||||
split_directories (name, ptr_num_dirs)
|
split_directories (const char *name, int *ptr_num_dirs)
|
||||||
const char *name;
|
|
||||||
int *ptr_num_dirs;
|
|
||||||
{
|
{
|
||||||
int num_dirs = 0;
|
int num_dirs = 0;
|
||||||
char **dirs;
|
char **dirs;
|
||||||
@ -201,8 +197,7 @@ split_directories (name, ptr_num_dirs)
|
|||||||
/* Release storage held by split directories. */
|
/* Release storage held by split directories. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_split_directories (dirs)
|
free_split_directories (char **dirs)
|
||||||
char **dirs;
|
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@ -223,10 +218,8 @@ free_split_directories (dirs)
|
|||||||
If no relative prefix can be found, return NULL. */
|
If no relative prefix can be found, return NULL. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
make_relative_prefix (progname, bin_prefix, prefix)
|
make_relative_prefix (const char *progname,
|
||||||
const char *progname;
|
const char *bin_prefix, const char *prefix)
|
||||||
const char *bin_prefix;
|
|
||||||
const char *prefix;
|
|
||||||
{
|
{
|
||||||
char **prog_dirs, **bin_dirs, **prefix_dirs;
|
char **prog_dirs, **bin_dirs, **prefix_dirs;
|
||||||
int prog_num, bin_num, prefix_num;
|
int prog_num, bin_num, prefix_num;
|
||||||
|
@ -43,7 +43,7 @@ Boston, MA 02111-1307, USA. */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
extern int mkstemps PARAMS ((char *, int));
|
extern int mkstemps (char *, int);
|
||||||
|
|
||||||
/* '/' works just fine on MS-DOS based systems. */
|
/* '/' works just fine on MS-DOS based systems. */
|
||||||
#ifndef DIR_SEPARATOR
|
#ifndef DIR_SEPARATOR
|
||||||
@ -61,11 +61,10 @@ extern int mkstemps PARAMS ((char *, int));
|
|||||||
If success, DIR is returned.
|
If success, DIR is returned.
|
||||||
Otherwise NULL 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 *
|
static inline const char *
|
||||||
try (dir, base)
|
try (const char *dir, const char *base)
|
||||||
const char *dir, *base;
|
|
||||||
{
|
{
|
||||||
if (base != 0)
|
if (base != 0)
|
||||||
return base;
|
return base;
|
||||||
@ -95,7 +94,7 @@ files in.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
choose_tmpdir ()
|
choose_tmpdir (void)
|
||||||
{
|
{
|
||||||
const char *base = 0;
|
const char *base = 0;
|
||||||
char *tmpdir;
|
char *tmpdir;
|
||||||
@ -146,8 +145,7 @@ string is @code{malloc}ed, and the temporary file has been created.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
make_temp_file (suffix)
|
make_temp_file (const char *suffix)
|
||||||
const char *suffix;
|
|
||||||
{
|
{
|
||||||
const char *base = choose_tmpdir ();
|
const char *base = choose_tmpdir ();
|
||||||
char *temp_filename;
|
char *temp_filename;
|
||||||
|
@ -62,8 +62,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
|
|||||||
/* Initialize structure containing state of computation.
|
/* Initialize structure containing state of computation.
|
||||||
(RFC 1321, 3.3: Step 3) */
|
(RFC 1321, 3.3: Step 3) */
|
||||||
void
|
void
|
||||||
md5_init_ctx (ctx)
|
md5_init_ctx (struct md5_ctx *ctx)
|
||||||
struct md5_ctx *ctx;
|
|
||||||
{
|
{
|
||||||
ctx->A = (md5_uint32) 0x67452301;
|
ctx->A = (md5_uint32) 0x67452301;
|
||||||
ctx->B = (md5_uint32) 0xefcdab89;
|
ctx->B = (md5_uint32) 0xefcdab89;
|
||||||
@ -80,9 +79,7 @@ md5_init_ctx (ctx)
|
|||||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||||
aligned for a 32 bits value. */
|
aligned for a 32 bits value. */
|
||||||
void *
|
void *
|
||||||
md5_read_ctx (ctx, resbuf)
|
md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
|
||||||
const struct md5_ctx *ctx;
|
|
||||||
void *resbuf;
|
|
||||||
{
|
{
|
||||||
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
|
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
|
||||||
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
|
((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
|
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||||
aligned for a 32 bits value. */
|
aligned for a 32 bits value. */
|
||||||
void *
|
void *
|
||||||
md5_finish_ctx (ctx, resbuf)
|
md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
|
||||||
struct md5_ctx *ctx;
|
|
||||||
void *resbuf;
|
|
||||||
{
|
{
|
||||||
/* Take yet unprocessed bytes into account. */
|
/* Take yet unprocessed bytes into account. */
|
||||||
md5_uint32 bytes = ctx->buflen;
|
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
|
resulting message digest number will be written into the 16 bytes
|
||||||
beginning at RESBLOCK. */
|
beginning at RESBLOCK. */
|
||||||
int
|
int
|
||||||
md5_stream (stream, resblock)
|
md5_stream (FILE *stream, void *resblock)
|
||||||
FILE *stream;
|
|
||||||
void *resblock;
|
|
||||||
{
|
{
|
||||||
/* Important: BLOCKSIZE must be a multiple of 64. */
|
/* Important: BLOCKSIZE must be a multiple of 64. */
|
||||||
#define BLOCKSIZE 4096
|
#define BLOCKSIZE 4096
|
||||||
@ -186,10 +179,7 @@ md5_stream (stream, resblock)
|
|||||||
output yields to the wanted ASCII representation of the message
|
output yields to the wanted ASCII representation of the message
|
||||||
digest. */
|
digest. */
|
||||||
void *
|
void *
|
||||||
md5_buffer (buffer, len, resblock)
|
md5_buffer (const char *buffer, size_t len, void *resblock)
|
||||||
const char *buffer;
|
|
||||||
size_t len;
|
|
||||||
void *resblock;
|
|
||||||
{
|
{
|
||||||
struct md5_ctx ctx;
|
struct md5_ctx ctx;
|
||||||
|
|
||||||
@ -205,10 +195,7 @@ md5_buffer (buffer, len, resblock)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
md5_process_bytes (buffer, len, ctx)
|
md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||||
const void *buffer;
|
|
||||||
size_t len;
|
|
||||||
struct md5_ctx *ctx;
|
|
||||||
{
|
{
|
||||||
/* When we already have some bits in our internal buffer concatenate
|
/* When we already have some bits in our internal buffer concatenate
|
||||||
both inputs first. */
|
both inputs first. */
|
||||||
@ -263,10 +250,7 @@ md5_process_bytes (buffer, len, ctx)
|
|||||||
It is assumed that LEN % 64 == 0. */
|
It is assumed that LEN % 64 == 0. */
|
||||||
|
|
||||||
void
|
void
|
||||||
md5_process_block (buffer, len, ctx)
|
md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||||
const void *buffer;
|
|
||||||
size_t len;
|
|
||||||
struct md5_ctx *ctx;
|
|
||||||
{
|
{
|
||||||
md5_uint32 correct_words[16];
|
md5_uint32 correct_words[16];
|
||||||
const md5_uint32 *words = (const md5_uint32 *) buffer;
|
const md5_uint32 *words = (const md5_uint32 *) buffer;
|
||||||
|
@ -15,17 +15,10 @@ returned.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
memchr (src_void, c, length)
|
memchr (register const PTR src_void, int c, size_t length)
|
||||||
register const PTR src_void;
|
|
||||||
int c;
|
|
||||||
size_t length;
|
|
||||||
{
|
{
|
||||||
const unsigned char *src = (const unsigned char *)src_void;
|
const unsigned char *src = (const unsigned char *)src_void;
|
||||||
|
|
||||||
|
@ -16,17 +16,10 @@ as if comparing unsigned char arrays.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
memcmp (str1, str2, count)
|
memcmp (const PTR str1, const PTR str2, size_t count)
|
||||||
const PTR str1;
|
|
||||||
const PTR str2;
|
|
||||||
size_t count;
|
|
||||||
{
|
{
|
||||||
register const unsigned char *s1 = (const unsigned char*)str1;
|
register const unsigned char *s1 = (const unsigned char*)str1;
|
||||||
register const unsigned char *s2 = (const unsigned char*)str2;
|
register const unsigned char *s2 = (const unsigned char*)str2;
|
||||||
|
@ -19,13 +19,10 @@ Copies @var{length} bytes from memory region @var{in} to region
|
|||||||
#define size_t unsigned long
|
#define size_t unsigned long
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void bcopy PARAMS((const void*, void*, size_t));
|
void bcopy (const void*, void*, size_t);
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
memcpy (out, in, length)
|
memcpy (PTR out, const PTR in, size_t length)
|
||||||
PTR out;
|
|
||||||
const PTR in;
|
|
||||||
size_t length;
|
|
||||||
{
|
{
|
||||||
bcopy(in, out, length);
|
bcopy(in, out, length);
|
||||||
return out;
|
return out;
|
||||||
|
@ -19,13 +19,10 @@ Copies @var{count} bytes from memory area @var{from} to memory area
|
|||||||
#define size_t unsigned long
|
#define size_t unsigned long
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void bcopy PARAMS ((const void*, void*, size_t));
|
void bcopy (const void*, void*, size_t);
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
memmove (s1, s2, n)
|
memmove (PTR s1, const PTR s2, size_t n)
|
||||||
PTR s1;
|
|
||||||
const PTR s2;
|
|
||||||
size_t n;
|
|
||||||
{
|
{
|
||||||
bcopy (s2, s1, n);
|
bcopy (s2, s1, n);
|
||||||
return s1;
|
return s1;
|
||||||
|
@ -43,7 +43,7 @@ extern PTR memset ();
|
|||||||
# define MAX(a,b) ((a) > (b) ? (a) : (b))
|
# define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void init_error_tables PARAMS ((void));
|
static void init_error_tables (void);
|
||||||
|
|
||||||
/* Translation table for errno values. See intro(2) in most UNIX systems
|
/* Translation table for errno values. See intro(2) in most UNIX systems
|
||||||
Programmers Reference Manuals.
|
Programmers Reference Manuals.
|
||||||
@ -503,7 +503,7 @@ BUGS
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_error_tables ()
|
init_error_tables (void)
|
||||||
{
|
{
|
||||||
const struct error_info *eip;
|
const struct error_info *eip;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
@ -584,7 +584,7 @@ symbolic name or message.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
errno_max ()
|
errno_max (void)
|
||||||
{
|
{
|
||||||
int maxsize;
|
int maxsize;
|
||||||
|
|
||||||
@ -623,8 +623,7 @@ next call to @code{strerror}.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strerror (errnoval)
|
strerror (int errnoval)
|
||||||
int errnoval;
|
|
||||||
{
|
{
|
||||||
const char *msg;
|
const char *msg;
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
@ -690,8 +689,7 @@ valid until the next call to @code{strerrno}.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
strerrno (errnoval)
|
strerrno (int errnoval)
|
||||||
int errnoval;
|
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
@ -738,8 +736,7 @@ to an errno value. If no translation is found, returns 0.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
strtoerrno (name)
|
strtoerrno (const char *name)
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
int errnoval = 0;
|
int errnoval = 0;
|
||||||
|
|
||||||
@ -779,7 +776,7 @@ strtoerrno (name)
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
int errn;
|
int errn;
|
||||||
int errnmax;
|
int errnmax;
|
||||||
|
@ -25,11 +25,7 @@ static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
|
|||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This array is designed for mapping upper and lower case letter
|
* This array is designed for mapping upper and lower case letter
|
||||||
@ -72,9 +68,7 @@ static const unsigned char charmap[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
strncasecmp(s1, s2, n)
|
strncasecmp(const char *s1, const char *s2, register size_t n)
|
||||||
const char *s1, *s2;
|
|
||||||
register size_t n;
|
|
||||||
{
|
{
|
||||||
register unsigned char u1, u2;
|
register unsigned char u1, u2;
|
||||||
|
|
||||||
|
@ -13,16 +13,10 @@ Compares the first @var{n} bytes of two strings, returning a value as
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
strncmp(s1, s2, n)
|
strncmp(const char *s1, const char *s2, register size_t n)
|
||||||
const char *s1, *s2;
|
|
||||||
register size_t n;
|
|
||||||
{
|
{
|
||||||
register unsigned char u1, u2;
|
register unsigned char u1, u2;
|
||||||
|
|
||||||
|
@ -31,20 +31,14 @@ memory was available. The result is always NUL terminated.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern size_t strlen PARAMS ((const char*));
|
extern size_t strlen (const char*);
|
||||||
extern PTR malloc PARAMS ((size_t));
|
extern PTR malloc (size_t);
|
||||||
extern PTR memcpy PARAMS ((PTR, const PTR, size_t));
|
extern PTR memcpy (PTR, const PTR, size_t);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strndup(s, n)
|
strndup (const char *s, size_t n)
|
||||||
const char *s;
|
|
||||||
size_t n;
|
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
size_t len = strlen (s);
|
size_t len = strlen (s);
|
||||||
|
@ -16,9 +16,7 @@ null character, the results are undefined.
|
|||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strrchr (s, c)
|
strrchr (register const char *s, int c)
|
||||||
register const char *s;
|
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
char *rtnval = 0;
|
char *rtnval = 0;
|
||||||
|
|
||||||
|
@ -41,18 +41,14 @@ extern PTR memset ();
|
|||||||
#undef sys_nsig
|
#undef sys_nsig
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
# ifdef ANSI_PROTOTYPES
|
# define NULL (void *) 0
|
||||||
# define NULL (void *) 0
|
|
||||||
# else
|
|
||||||
# define NULL 0
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MAX
|
#ifndef MAX
|
||||||
# define MAX(a,b) ((a) > (b) ? (a) : (b))
|
# define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void init_signal_tables PARAMS ((void));
|
static void init_signal_tables (void);
|
||||||
|
|
||||||
/* Translation table for signal values.
|
/* Translation table for signal values.
|
||||||
|
|
||||||
@ -288,7 +284,7 @@ BUGS
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_signal_tables ()
|
init_signal_tables (void)
|
||||||
{
|
{
|
||||||
const struct signal_info *eip;
|
const struct signal_info *eip;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
@ -369,7 +365,7 @@ symbolic name or message.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
signo_max ()
|
signo_max (void)
|
||||||
{
|
{
|
||||||
int maxsize;
|
int maxsize;
|
||||||
|
|
||||||
@ -409,8 +405,7 @@ call to @code{strsignal}.
|
|||||||
#ifndef HAVE_STRSIGNAL
|
#ifndef HAVE_STRSIGNAL
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
strsignal (signo)
|
strsignal (int signo)
|
||||||
int signo;
|
|
||||||
{
|
{
|
||||||
const char *msg;
|
const char *msg;
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
@ -469,8 +464,7 @@ valid until the next call to @code{strsigno}.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
strsigno (signo)
|
strsigno (int signo)
|
||||||
int signo;
|
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
@ -513,8 +507,7 @@ translation is found, returns 0.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
strtosigno (name)
|
strtosigno (const char *name)
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
int signo = 0;
|
int signo = 0;
|
||||||
|
|
||||||
@ -556,9 +549,7 @@ followed by a newline.
|
|||||||
#ifndef HAVE_PSIGNAL
|
#ifndef HAVE_PSIGNAL
|
||||||
|
|
||||||
void
|
void
|
||||||
psignal (signo, message)
|
psignal (unsigned signo, char *message)
|
||||||
unsigned signo;
|
|
||||||
char *message;
|
|
||||||
{
|
{
|
||||||
if (signal_names == NULL)
|
if (signal_names == NULL)
|
||||||
{
|
{
|
||||||
@ -585,7 +576,7 @@ psignal (signo, message)
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
int signo;
|
int signo;
|
||||||
int maxsigno;
|
int maxsigno;
|
||||||
|
@ -21,8 +21,7 @@ length, the function returns @var{string}.
|
|||||||
been validated to comply with it. -fnf */
|
been validated to comply with it. -fnf */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strstr (s1, s2)
|
strstr (char *s1, char *s2)
|
||||||
char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
register char *p = s1;
|
register char *p = s1;
|
||||||
extern char *strchr ();
|
extern char *strchr ();
|
||||||
|
@ -40,16 +40,14 @@ the location referenced by @var{endptr}.
|
|||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
#include "safe-ctype.h"
|
#include "safe-ctype.h"
|
||||||
|
|
||||||
extern double atof ();
|
extern double atof (const char *);
|
||||||
|
|
||||||
/* Disclaimer: this is currently just used by CHILL in GDB and therefore
|
/* Disclaimer: this is currently just used by CHILL in GDB and therefore
|
||||||
has not been tested well. It may have been tested for nothing except
|
has not been tested well. It may have been tested for nothing except
|
||||||
that it compiles. */
|
that it compiles. */
|
||||||
|
|
||||||
double
|
double
|
||||||
strtod (str, ptr)
|
strtod (char *str, char **ptr)
|
||||||
char *str;
|
|
||||||
char **ptr;
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
@ -85,10 +85,7 @@ extern int errno;
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
long
|
long
|
||||||
strtol(nptr, endptr, base)
|
strtol(const char *nptr, char **endptr, register int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
register int base;
|
|
||||||
{
|
{
|
||||||
register const char *s = nptr;
|
register const char *s = nptr;
|
||||||
register unsigned long acc;
|
register unsigned long acc;
|
||||||
|
@ -58,10 +58,7 @@ extern int errno;
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
unsigned long
|
unsigned long
|
||||||
strtoul(nptr, endptr, base)
|
strtoul(const char *nptr, char **endptr, register int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
register int base;
|
|
||||||
{
|
{
|
||||||
register const char *s = nptr;
|
register const char *s = nptr;
|
||||||
register unsigned long acc;
|
register unsigned long acc;
|
||||||
|
@ -34,11 +34,7 @@
|
|||||||
insertions. */
|
insertions. */
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
ternary_insert (root, s, data, replace)
|
ternary_insert (ternary_tree *root, const char *s, PTR data, int replace)
|
||||||
ternary_tree *root;
|
|
||||||
const char *s;
|
|
||||||
PTR data;
|
|
||||||
int replace;
|
|
||||||
{
|
{
|
||||||
int diff;
|
int diff;
|
||||||
ternary_tree curr, *pcurr;
|
ternary_tree curr, *pcurr;
|
||||||
@ -98,8 +94,7 @@ ternary_insert (root, s, data, replace)
|
|||||||
|
|
||||||
/* Free the ternary search tree rooted at p. */
|
/* Free the ternary search tree rooted at p. */
|
||||||
void
|
void
|
||||||
ternary_cleanup (p)
|
ternary_cleanup (ternary_tree p)
|
||||||
ternary_tree p;
|
|
||||||
{
|
{
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
@ -113,9 +108,7 @@ ternary_cleanup (p)
|
|||||||
|
|
||||||
/* Non-recursive find of a string in the ternary tree */
|
/* Non-recursive find of a string in the ternary tree */
|
||||||
PTR
|
PTR
|
||||||
ternary_search (p, s)
|
ternary_search (const ternary_node *p, const char *s)
|
||||||
const ternary_node *p;
|
|
||||||
const char *s;
|
|
||||||
{
|
{
|
||||||
const ternary_node *curr;
|
const ternary_node *curr;
|
||||||
int diff, spchar;
|
int diff, spchar;
|
||||||
@ -147,9 +140,7 @@ ternary_search (p, s)
|
|||||||
/* For those who care, the recursive version of the search. Useful if
|
/* For those who care, the recursive version of the search. Useful if
|
||||||
you want a starting point for pmsearch or nearsearch. */
|
you want a starting point for pmsearch or nearsearch. */
|
||||||
static PTR
|
static PTR
|
||||||
ternary_recursivesearch (p, s)
|
ternary_recursivesearch (const ternary_node *p, const char *s)
|
||||||
const ternary_node *p;
|
|
||||||
const char *s;
|
|
||||||
{
|
{
|
||||||
if (!p)
|
if (!p)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -24,11 +24,10 @@ not be used in new projects. Use @code{mkstemp} instead.
|
|||||||
static char tmpnam_buffer[L_tmpnam];
|
static char tmpnam_buffer[L_tmpnam];
|
||||||
static int tmpnam_counter;
|
static int tmpnam_counter;
|
||||||
|
|
||||||
extern int getpid ();
|
extern int getpid (void);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
tmpnam (s)
|
tmpnam (char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
int pid = getpid ();
|
int pid = getpid ();
|
||||||
|
|
||||||
|
@ -58,8 +58,7 @@ was made to unlink the file because it is special.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
unlink_if_ordinary (name)
|
unlink_if_ordinary (const char *name)
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
@ -22,11 +22,7 @@ Boston, MA 02111-1307, USA. */
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
#if !defined (va_copy) && defined (__va_copy)
|
#if !defined (va_copy) && defined (__va_copy)
|
||||||
# define va_copy(d,s) __va_copy((d),(s))
|
# define va_copy(d,s) __va_copy((d),(s))
|
||||||
#endif
|
#endif
|
||||||
@ -62,13 +58,10 @@ not be allocated, minus one is returned and @code{NULL} is stored in
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int int_vasprintf PARAMS ((char **, const char *, va_list));
|
static int int_vasprintf (char **, const char *, va_list);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
int_vasprintf (result, format, args)
|
int_vasprintf (char **result, const char *format, va_list args)
|
||||||
char **result;
|
|
||||||
const char *format;
|
|
||||||
va_list args;
|
|
||||||
{
|
{
|
||||||
const char *p = format;
|
const char *p = format;
|
||||||
/* Add one to make sure that it is never zero, which might cause malloc
|
/* Add one to make sure that it is never zero, which might cause malloc
|
||||||
@ -156,13 +149,11 @@ int_vasprintf (result, format, args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vasprintf (result, format, args)
|
vasprintf (char **result, const char *format,
|
||||||
char **result;
|
|
||||||
const char *format;
|
|
||||||
#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
|
#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
|
||||||
_BSD_VA_LIST_ args;
|
_BSD_VA_LIST_ args)
|
||||||
#else
|
#else
|
||||||
va_list args;
|
va_list args)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
return int_vasprintf (result, format, args);
|
return int_vasprintf (result, format, args);
|
||||||
@ -170,7 +161,7 @@ vasprintf (result, format, args)
|
|||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
static void ATTRIBUTE_PRINTF_1
|
static void ATTRIBUTE_PRINTF_1
|
||||||
checkit VPARAMS ((const char *format, ...))
|
checkit (const char *format, ...)
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
VA_OPEN (args, format);
|
VA_OPEN (args, format);
|
||||||
@ -187,10 +178,10 @@ checkit VPARAMS ((const char *format, ...))
|
|||||||
free (result);
|
free (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int main PARAMS ((void));
|
extern int main (void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
checkit ("%d", 0x12345678);
|
checkit ("%d", 0x12345678);
|
||||||
checkit ("%200d", 5);
|
checkit ("%200d", 5);
|
||||||
|
@ -13,10 +13,10 @@ Emulates @code{vfork} by calling @code{fork} and returning its value.
|
|||||||
|
|
||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
|
|
||||||
extern int fork PARAMS ((void));
|
extern int fork (void);
|
||||||
|
|
||||||
int
|
int
|
||||||
vfork ()
|
vfork (void)
|
||||||
{
|
{
|
||||||
return (fork ());
|
return (fork ());
|
||||||
}
|
}
|
||||||
|
@ -4,19 +4,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#undef vfprintf
|
#undef vfprintf
|
||||||
|
|
||||||
int
|
int
|
||||||
vfprintf (stream, format, ap)
|
vfprintf (FILE *stream, const char *format, va_list ap)
|
||||||
FILE * stream;
|
|
||||||
const char * format;
|
|
||||||
va_list ap;
|
|
||||||
{
|
{
|
||||||
return _doprnt (format, ap, stream);
|
return _doprnt (format, ap, stream);
|
||||||
}
|
}
|
||||||
|
@ -16,17 +16,11 @@ nonstandard but common function @code{_doprnt}.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#undef vprintf
|
#undef vprintf
|
||||||
int
|
int
|
||||||
vprintf (format, ap)
|
vprintf (const char *format, va_list ap)
|
||||||
const char *format;
|
|
||||||
va_list ap;
|
|
||||||
{
|
{
|
||||||
return vfprintf (stdout, format, ap);
|
return vfprintf (stdout, format, ap);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Implement the vsnprintf function.
|
/* Implement the vsnprintf function.
|
||||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
|
Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
|
||||||
|
|
||||||
This file is part of the libiberty library. This library is free
|
This file is part of the libiberty library. This library is free
|
||||||
@ -42,11 +42,7 @@ system version of this function is used.
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
|
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STRING_H
|
#ifdef HAVE_STRING_H
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
@ -58,11 +54,7 @@ system version of this function is used.
|
|||||||
|
|
||||||
/* This implementation relies on a working vasprintf. */
|
/* This implementation relies on a working vasprintf. */
|
||||||
int
|
int
|
||||||
vsnprintf (s, n, format, ap)
|
vsnprintf (char *s, size_t n, const char *format, va_list ap)
|
||||||
char * s;
|
|
||||||
size_t n;
|
|
||||||
const char *format;
|
|
||||||
va_list ap;
|
|
||||||
{
|
{
|
||||||
char *buf = 0;
|
char *buf = 0;
|
||||||
int result = vasprintf (&buf, format, ap);
|
int result = vasprintf (&buf, format, ap);
|
||||||
@ -97,7 +89,7 @@ vsnprintf (s, n, format, ap)
|
|||||||
#define VERIFY(P) do { if (!(P)) abort(); } while (0)
|
#define VERIFY(P) do { if (!(P)) abort(); } while (0)
|
||||||
|
|
||||||
static int ATTRIBUTE_PRINTF_3
|
static int ATTRIBUTE_PRINTF_3
|
||||||
checkit VPARAMS ((char *s, size_t n, const char *format, ...))
|
checkit (char *s, size_t n, const char *format, ...)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
VA_OPEN (ap, format);
|
VA_OPEN (ap, format);
|
||||||
@ -109,9 +101,9 @@ checkit VPARAMS ((char *s, size_t n, const char *format, ...))
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int main PARAMS ((void));
|
extern int main (void);
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
int status;
|
int status;
|
||||||
|
@ -27,21 +27,14 @@ This exception does not however invalidate any other reasons why
|
|||||||
the executable file might be covered by the GNU General Public License. */
|
the executable file might be covered by the GNU General Public License. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#undef vsprintf
|
#undef vsprintf
|
||||||
|
|
||||||
#if defined _IOSTRG && defined _IOWRT
|
#if defined _IOSTRG && defined _IOWRT
|
||||||
|
|
||||||
int
|
int
|
||||||
vsprintf (buf, format, ap)
|
vsprintf (char *buf, const char *format, va_list ap)
|
||||||
char *buf;
|
|
||||||
const char *format;
|
|
||||||
va_list ap;
|
|
||||||
{
|
{
|
||||||
FILE b;
|
FILE b;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -23,9 +23,7 @@ does the return value. The third argument is unused in @libib{}.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
waitpid (pid, stat_loc, options)
|
waitpid (pid_t pid, int *stat_loc, int options)
|
||||||
pid_t pid;
|
|
||||||
int *stat_loc, options;
|
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -27,31 +27,27 @@ failure. If you use @code{xatexit} to register functions, you must use
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if VMS
|
#if VMS
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unixlib.h>
|
#include <unixlib.h>
|
||||||
#else
|
#else
|
||||||
/* For systems with larger pointers than ints, this must be declared. */
|
/* For systems with larger pointers than ints, this must be declared. */
|
||||||
PTR malloc PARAMS ((size_t));
|
PTR malloc (size_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void xatexit_cleanup PARAMS ((void));
|
static void xatexit_cleanup (void);
|
||||||
|
|
||||||
/* Pointer to function run by xexit. */
|
/* Pointer to function run by xexit. */
|
||||||
extern void (*_xexit_cleanup) PARAMS ((void));
|
extern void (*_xexit_cleanup) (void);
|
||||||
|
|
||||||
#define XATEXIT_SIZE 32
|
#define XATEXIT_SIZE 32
|
||||||
|
|
||||||
struct xatexit {
|
struct xatexit {
|
||||||
struct xatexit *next; /* next in list */
|
struct xatexit *next; /* next in list */
|
||||||
int ind; /* next index in this table */
|
int ind; /* next index in this table */
|
||||||
void (*fns[XATEXIT_SIZE]) PARAMS ((void)); /* the table itself */
|
void (*fns[XATEXIT_SIZE]) (void); /* the table itself */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Allocate one struct statically to guarantee that we can register
|
/* Allocate one struct statically to guarantee that we can register
|
||||||
@ -65,8 +61,7 @@ static struct xatexit *xatexit_head = &xatexit_first;
|
|||||||
Return 0 if successful, -1 if not. */
|
Return 0 if successful, -1 if not. */
|
||||||
|
|
||||||
int
|
int
|
||||||
xatexit (fn)
|
xatexit (void (*fn) (void))
|
||||||
void (*fn) PARAMS ((void));
|
|
||||||
{
|
{
|
||||||
register struct xatexit *p;
|
register struct xatexit *p;
|
||||||
|
|
||||||
@ -90,7 +85,7 @@ xatexit (fn)
|
|||||||
/* Call any cleanup functions. */
|
/* Call any cleanup functions. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xatexit_cleanup ()
|
xatexit_cleanup (void)
|
||||||
{
|
{
|
||||||
register struct xatexit *p;
|
register struct xatexit *p;
|
||||||
register int n;
|
register int n;
|
||||||
|
@ -41,11 +41,10 @@ Termination is handled via the system's normal @code{exit} call.
|
|||||||
|
|
||||||
/* This variable is set by xatexit if it is called. This way, xmalloc
|
/* This variable is set by xatexit if it is called. This way, xmalloc
|
||||||
doesn't drag xatexit into the link. */
|
doesn't drag xatexit into the link. */
|
||||||
void (*_xexit_cleanup) PARAMS ((void));
|
void (*_xexit_cleanup) (void);
|
||||||
|
|
||||||
void
|
void
|
||||||
xexit (code)
|
xexit (int code)
|
||||||
int code;
|
|
||||||
{
|
{
|
||||||
if (_xexit_cleanup != NULL)
|
if (_xexit_cleanup != NULL)
|
||||||
(*_xexit_cleanup) ();
|
(*_xexit_cleanup) ();
|
||||||
|
@ -68,22 +68,17 @@ function will be called to print an error message and terminate execution.
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef ANSI_PROTOTYPES
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#else
|
|
||||||
#define size_t unsigned long
|
|
||||||
#define ptrdiff_t long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if VMS
|
#if VMS
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unixlib.h>
|
#include <unixlib.h>
|
||||||
#else
|
#else
|
||||||
/* For systems with larger pointers than ints, these must be declared. */
|
/* For systems with larger pointers than ints, these must be declared. */
|
||||||
PTR malloc PARAMS ((size_t));
|
PTR malloc (size_t);
|
||||||
PTR realloc PARAMS ((PTR, size_t));
|
PTR realloc (PTR, size_t);
|
||||||
PTR calloc PARAMS ((size_t, size_t));
|
PTR calloc (size_t, size_t);
|
||||||
PTR sbrk PARAMS ((ptrdiff_t));
|
PTR sbrk (ptrdiff_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The program name if set. */
|
/* The program name if set. */
|
||||||
@ -96,8 +91,7 @@ static char *first_break = NULL;
|
|||||||
#endif /* HAVE_SBRK */
|
#endif /* HAVE_SBRK */
|
||||||
|
|
||||||
void
|
void
|
||||||
xmalloc_set_program_name (s)
|
xmalloc_set_program_name (const char *s)
|
||||||
const char *s;
|
|
||||||
{
|
{
|
||||||
name = s;
|
name = s;
|
||||||
#ifdef HAVE_SBRK
|
#ifdef HAVE_SBRK
|
||||||
@ -108,8 +102,7 @@ xmalloc_set_program_name (s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xmalloc_failed (size)
|
xmalloc_failed (size_t size)
|
||||||
size_t size;
|
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SBRK
|
#ifdef HAVE_SBRK
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
@ -133,8 +126,7 @@ xmalloc_failed (size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
xmalloc (size)
|
xmalloc (size_t size)
|
||||||
size_t size;
|
|
||||||
{
|
{
|
||||||
PTR newmem;
|
PTR newmem;
|
||||||
|
|
||||||
@ -148,8 +140,7 @@ xmalloc (size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
xcalloc (nelem, elsize)
|
xcalloc (size_t nelem, size_t elsize)
|
||||||
size_t nelem, elsize;
|
|
||||||
{
|
{
|
||||||
PTR newmem;
|
PTR newmem;
|
||||||
|
|
||||||
@ -164,9 +155,7 @@ xcalloc (nelem, elsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
xrealloc (oldmem, size)
|
xrealloc (PTR oldmem, size_t size)
|
||||||
PTR oldmem;
|
|
||||||
size_t size;
|
|
||||||
{
|
{
|
||||||
PTR newmem;
|
PTR newmem;
|
||||||
|
|
||||||
|
@ -31,10 +31,7 @@ allocated, the remaining memory is zeroed.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
xmemdup (input, copy_size, alloc_size)
|
xmemdup (const PTR input, size_t copy_size, size_t alloc_size)
|
||||||
const PTR input;
|
|
||||||
size_t copy_size;
|
|
||||||
size_t alloc_size;
|
|
||||||
{
|
{
|
||||||
PTR output = xcalloc (1, alloc_size);
|
PTR output = xcalloc (1, alloc_size);
|
||||||
return (PTR) memcpy (output, input, copy_size);
|
return (PTR) memcpy (output, input, copy_size);
|
||||||
|
@ -28,8 +28,7 @@ obtain memory.
|
|||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xstrdup (s)
|
xstrdup (const char *s)
|
||||||
const char *s;
|
|
||||||
{
|
{
|
||||||
register size_t len = strlen (s) + 1;
|
register size_t len = strlen (s) + 1;
|
||||||
register char *ret = xmalloc (len);
|
register char *ret = xmalloc (len);
|
||||||
|
@ -21,13 +21,13 @@ will never return a @code{NULL} pointer.
|
|||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES)
|
#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES)
|
||||||
extern char *strerror PARAMS ((int,...));
|
extern char *strerror (int,...);
|
||||||
#define DONT_DECLARE_STRERROR
|
#define DONT_DECLARE_STRERROR
|
||||||
#endif
|
#endif
|
||||||
#endif /* VMS */
|
#endif /* VMS */
|
||||||
|
|
||||||
#ifndef DONT_DECLARE_STRERROR
|
#ifndef DONT_DECLARE_STRERROR
|
||||||
extern char *strerror PARAMS ((int));
|
extern char *strerror (int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If strerror returns NULL, we'll format the number into a static buffer. */
|
/* If strerror returns NULL, we'll format the number into a static buffer. */
|
||||||
@ -38,15 +38,14 @@ static char xstrerror_buf[sizeof ERRSTR_FMT + 20];
|
|||||||
/* Like strerror, but result is never a null pointer. */
|
/* Like strerror, but result is never a null pointer. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xstrerror (errnum)
|
xstrerror (int errnum)
|
||||||
int errnum;
|
|
||||||
{
|
{
|
||||||
char *errstr;
|
char *errstr;
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
char *(*vmslib_strerror) PARAMS ((int,...));
|
char *(*vmslib_strerror) (int,...);
|
||||||
|
|
||||||
/* Override any possibly-conflicting declaration from system header. */
|
/* Override any possibly-conflicting declaration from system header. */
|
||||||
vmslib_strerror = (char *(*) PARAMS ((int,...))) strerror;
|
vmslib_strerror = (char *(*) (int,...)) strerror;
|
||||||
/* Second argument matters iff first is EVMSERR, but it's simpler to
|
/* Second argument matters iff first is EVMSERR, but it's simpler to
|
||||||
pass it unconditionally. `vaxc$errno' is declared in <errno.h>
|
pass it unconditionally. `vaxc$errno' is declared in <errno.h>
|
||||||
and maintained by the run-time library in parallel to `errno'.
|
and maintained by the run-time library in parallel to `errno'.
|
||||||
|
@ -45,9 +45,7 @@ always NUL terminated.
|
|||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xstrndup (s, n)
|
xstrndup (const char *s, size_t n)
|
||||||
const char *s;
|
|
||||||
size_t n;
|
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
size_t len = strlen (s);
|
size_t len = strlen (s);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user