[svn] Allow Wget to be compiled with a K&R compiler.

Published in <sxszo0af9k6.fsf@florida.arsdigita.de>.
This commit is contained in:
hniksic 2002-04-11 10:49:32 -07:00
parent 485673c3a8
commit 1375a89141
7 changed files with 54 additions and 22 deletions

View File

@ -1,3 +1,29 @@
2002-04-11 Hrvoje Niksic <hniksic@arsdigita.com>
* progress.c (struct progress_implementation): Use PARAMS when
declaring the parameters of *create, *update, *finish, and
*set_params.
* netrc.c: Ditto.
* http.c: Reformat some function definitions so that ansi2knr can
read them.
* hash.c (struct hash_table): Use the PARAMS macro around
parameters in the declaration of hash_function and test_function.
(prime_size): Spell 2580823717UL and 3355070839UL as (unsigned
long)0x99d43ea5 and (unsigned long)0xc7fa5177 respectively, so
that pre-ANSI compilers can read them.
(find_mapping): Use PARAMS when declaring EQUALS.
(hash_table_put): Ditto.
* ftp.h: Wrap the parameters of ftp_index declaration in PARAMS.
* cookies.c (cookie_new): Use (unsigned long)0 instead of 0UL,
which was unsupported by pre-ANSI compilers.
From Nelson H. F. Beebe <beebe@math.utah.edu>, for the most part.
2002-04-11 Hrvoje Niksic <hniksic@arsdigita.com>
* url.c (url_filename): Use compose_file_name regardless of

View File

@ -84,7 +84,7 @@ cookie_new (void)
/* If we don't know better, assume cookie is non-permanent and valid
for the entire session. */
cookie->expiry_time = ~0UL;
cookie->expiry_time = ~(unsigned long)0;
/* Assume default port. */
cookie->port = 80;

View File

@ -107,7 +107,7 @@ enum wget_ftp_fstatus
struct fileinfo *ftp_parse_ls PARAMS ((const char *, const enum stype));
uerr_t ftp_loop PARAMS ((struct url *, int *));
uerr_t ftp_index (const char *, struct url *, struct fileinfo *);
uerr_t ftp_index PARAMS ((const char *, struct url *, struct fileinfo *));
char ftp_process_type PARAMS ((const char *));

View File

@ -136,8 +136,8 @@ struct mapping {
};
struct hash_table {
unsigned long (*hash_function) (const void *);
int (*test_function) (const void *, const void *);
unsigned long (*hash_function) PARAMS ((const void *));
int (*test_function) PARAMS ((const void *, const void *));
int size; /* size of the array */
int count; /* number of non-empty, non-deleted
@ -177,7 +177,8 @@ prime_size (int size)
10445899, 13579681, 17653589, 22949669, 29834603, 38784989,
50420551, 65546729, 85210757, 110774011, 144006217, 187208107,
243370577, 316381771, 411296309, 534685237, 695090819, 903618083,
1174703521, 1527114613, 1985248999, 2580823717UL, 3355070839UL
1174703521, 1527114613, 1985248999,
(unsigned long)0x99d43ea5, (unsigned long)0xc7fa5177
};
int i;
for (i = 0; i < ARRAY_SIZE (primes); i++)
@ -236,7 +237,7 @@ find_mapping (struct hash_table *ht, const void *key)
struct mapping *mappings = ht->mappings;
int size = ht->size;
struct mapping *mp = mappings + HASH_POSITION (ht, key);
int (*equals) (const void *, const void *) = ht->test_function;
int (*equals) PARAMS ((const void *, const void *)) = ht->test_function;
LOOP_NON_EMPTY (mp, mappings, size)
if (equals (key, mp->key))
@ -336,7 +337,7 @@ hash_table_put (struct hash_table *ht, const void *key, void *value)
{
struct mapping *mappings = ht->mappings;
int size = ht->size;
int (*equals) (const void *, const void *) = ht->test_function;
int (*equals) PARAMS ((const void *, const void *)) = ht->test_function;
struct mapping *mp = mappings + HASH_POSITION (ht, key);

View File

@ -313,13 +313,15 @@ invalidate_persistent (void)
If a previous connection was persistent, it is closed. */
static void
register_persistent (const char *host, unsigned short port, int fd
#ifdef HAVE_SSL
, SSL *ssl
#endif
)
static void
register_persistent (const char *host, unsigned short port, int fd, SSL *ssl)
{
#else
static void
register_persistent (const char *host, unsigned short port, int fd)
{
#endif
if (pc_active_p)
{
if (pc_last_fd == fd)
@ -375,13 +377,15 @@ register_persistent (const char *host, unsigned short port, int fd
/* Return non-zero if a persistent connection is available for
connecting to HOST:PORT. */
static int
persistent_available_p (const char *host, unsigned short port
#ifdef HAVE_SSL
, int ssl
#endif
)
static int
persistent_available_p (const char *host, unsigned short port, int ssl)
{
#else
static int
persistent_available_p (const char *host, unsigned short port)
{
#endif
int success;
struct address_list *this_host_ip;

View File

@ -235,7 +235,8 @@ maybe_add_to_list (acc_t **newentry, acc_t **list)
null-terminated string once character to the left.
Used in processing \ and " constructs in the netrc file */
static void
shift_left(char *string){
shift_left(char *string)
{
char *p;
for (p=string; *p; ++p)

View File

@ -41,10 +41,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
struct progress_implementation {
char *name;
void *(*create) (long, long);
void (*update) (void *, long, long);
void (*finish) (void *, long);
void (*set_params) (const char *);
void *(*create) PARAMS ((long, long));
void (*update) PARAMS ((void *, long, long));
void (*finish) PARAMS ((void *, long));
void (*set_params) PARAMS ((const char *));
};
/* Necessary forward declarations. */