From 1375a891411e22a82030d3597b4fa66a0097fd9d Mon Sep 17 00:00:00 2001 From: hniksic Date: Thu, 11 Apr 2002 10:49:32 -0700 Subject: [PATCH] [svn] Allow Wget to be compiled with a K&R compiler. Published in . --- src/ChangeLog | 26 ++++++++++++++++++++++++++ src/cookies.c | 2 +- src/ftp.h | 2 +- src/hash.c | 11 ++++++----- src/http.c | 24 ++++++++++++++---------- src/netrc.c | 3 ++- src/progress.c | 8 ++++---- 7 files changed, 54 insertions(+), 22 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 24227f99..f84d5294 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,29 @@ +2002-04-11 Hrvoje Niksic + + * 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 , for the most part. + 2002-04-11 Hrvoje Niksic * url.c (url_filename): Use compose_file_name regardless of diff --git a/src/cookies.c b/src/cookies.c index 411160ee..18e6c8f9 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -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; diff --git a/src/ftp.h b/src/ftp.h index 7e17f29c..b13a3192 100644 --- a/src/ftp.h +++ b/src/ftp.h @@ -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 *)); diff --git a/src/hash.c b/src/hash.c index ecfc96dd..0a7c2408 100644 --- a/src/hash.c +++ b/src/hash.c @@ -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); diff --git a/src/http.c b/src/http.c index 0e5168a1..6dacacab 100644 --- a/src/http.c +++ b/src/http.c @@ -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; diff --git a/src/netrc.c b/src/netrc.c index b358936a..9535472c 100644 --- a/src/netrc.c +++ b/src/netrc.c @@ -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) diff --git a/src/progress.c b/src/progress.c index fe6727da..de5d16a3 100644 --- a/src/progress.c +++ b/src/progress.c @@ -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. */ -- 2.39.2