From: hniksic Date: Sun, 9 Dec 2001 01:24:41 +0000 (-0800) Subject: [svn] Minor fixes prompted by `lint'. X-Git-Tag: v1.13~1919 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=dd84231c6a02cfc885b796bea6ad8cb2fc184e9b [svn] Minor fixes prompted by `lint'. Published in . --- diff --git a/src/ChangeLog b/src/ChangeLog index b5780ba1..bc0a1a46 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,32 @@ +2001-12-09 Hrvoje Niksic + + * url.c (reencode_string): Declare static. + + * res.c (registered_specs): Declare static. + + * progress.c (current_impl_locked): Declare static. + + * log.c (flush_log_p): Declare static. + (needs_flushing): Ditto. + + * http.c (digest_authentication_encode): Declare static. + + * html-url.c (init_interesting): Declare static. + + * host.c (host_name_addresses_map): Declare static. + + * cookies.c (find_matching_chains): Declare static. + + * ftp-ls.c (ftp_parse_vms_ls): Warn about the memory leak + indicated by lint. + + * utils.c (path_simplify): Remove unused variable STUB_CHAR. + + * host.c (address_list_set_faulty): Document that INDEX is + currently unused. + + * url.c (rewrite_shorthand_url): Remove unused variable PATH. + 2001-12-08 Hrvoje Niksic * version.c: Wget 1.8-pre2 is released. diff --git a/src/cookies.c b/src/cookies.c index f1458594..b4559600 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -825,7 +825,7 @@ set_cookie_header_cb (const char *hdr, void *closure) SIZE matches are written; if more matches are present, return the number of chains that would have been written. */ -int +static int find_matching_chains (const char *host, int port, struct cookie *store[], int size) { diff --git a/src/ftp-ls.c b/src/ftp-ls.c index 91c572e7..4279c494 100644 --- a/src/ftp-ls.c +++ b/src/ftp-ls.c @@ -577,6 +577,10 @@ ftp_parse_vms_ls (const char *file) } dir = l = NULL; + /* #### The next three lines are a memory leak because they don't + bother to free the pointer that read_whole_line() returns! + FIXME! */ + /* Empty line */ read_whole_line (fp); /* "Directory PUB$DEVICE[PUB]" */ diff --git a/src/host.c b/src/host.c index 9fecb5d4..e27383d6 100644 --- a/src/host.c +++ b/src/host.c @@ -69,7 +69,7 @@ extern int h_errno; /* Mapping between known hosts and to lists of their addresses. */ -struct hash_table *host_name_addresses_map; +static struct hash_table *host_name_addresses_map; /* Lists of addresses. This should eventually be extended to handle IPv6. */ @@ -124,6 +124,13 @@ address_list_match_all (struct address_list *al1, struct address_list *al2) void address_list_set_faulty (struct address_list *al, int index) { +#if 0 + /* Warning: INDEX is unused, so this assumes that the address list + is traversed in order. In the next release, either enable this + assert, or use INDEX. */ + assert (index == al->faulty); +#endif + ++al->faulty; if (al->faulty >= al->count) /* All addresses have been proven faulty. Since there's not much diff --git a/src/html-url.c b/src/html-url.c index cac61ae3..12d4334d 100644 --- a/src/html-url.c +++ b/src/html-url.c @@ -140,7 +140,7 @@ static const char *additional_attributes[] = { static const char **interesting_tags; static const char **interesting_attributes; -void +static void init_interesting (void) { /* Init the variables interesting_tags and interesting_attributes diff --git a/src/http.c b/src/http.c index 16f5dc2d..95bb31ea 100644 --- a/src/http.c +++ b/src/http.c @@ -2164,7 +2164,7 @@ dump_hash (unsigned char *buf, const unsigned char *hash) /* Take the line apart to find the challenge, and compose a digest authorization header. See RFC2069 section 2.1.2. */ -char * +static char * digest_authentication_encode (const char *au, const char *user, const char *passwd, const char *method, const char *path) diff --git a/src/log.c b/src/log.c index a8ecebd4..f79c5eb4 100644 --- a/src/log.c +++ b/src/log.c @@ -53,8 +53,8 @@ static FILE *logfp; int save_log_p; /* Whether the log is flushed after each command. */ -int flush_log_p = 1; -int needs_flushing; +static int flush_log_p = 1; +static int needs_flushing; /* In the event of a hang-up, and if its output was on a TTY, Wget redirects its output to `wget-log'. diff --git a/src/progress.c b/src/progress.c index 9b42c47b..c4dd737e 100644 --- a/src/progress.c +++ b/src/progress.c @@ -64,7 +64,7 @@ static struct progress_implementation implementations[] = { { "bar", bar_create, bar_update, bar_finish, bar_set_params } }; static struct progress_implementation *current_impl; -int current_impl_locked; +static int current_impl_locked; /* Progress implementation used by default. Can be overriden in wgetrc or by the fallback one. */ diff --git a/src/res.c b/src/res.c index 32b53b1b..c2f383c2 100644 --- a/src/res.c +++ b/src/res.c @@ -470,7 +470,7 @@ res_match_path (const struct robot_specs *specs, const char *path) /* Registering the specs. */ -struct hash_table *registered_specs; +static struct hash_table *registered_specs; /* Stolen from cookies.c. */ #define SET_HOSTPORT(host, port, result) do { \ diff --git a/src/url.c b/src/url.c index 5be58fcb..ecf94417 100644 --- a/src/url.c +++ b/src/url.c @@ -334,7 +334,7 @@ decide_copy_method (const char *p) "foo+bar" -> "foo+bar" (plus is reserved!) "foo%2b+bar" -> "foo%2b+bar" */ -char * +static char * reencode_string (const char *s) { const char *p1; @@ -559,19 +559,17 @@ rewrite_shorthand_url (const char *url) if (*p == ':') { - const char *pp, *path; + const char *pp; char *res; /* If the characters after the colon and before the next slash or end of string are all digits, it's HTTP. */ int digits = 0; for (pp = p + 1; ISDIGIT (*pp); pp++) ++digits; - if (digits > 0 - && (*pp == '/' || *pp == '\0')) + if (digits > 0 && (*pp == '/' || *pp == '\0')) goto http; /* Prepend "ftp://" to the entire URL... */ - path = p + 1; res = xmalloc (6 + strlen (url) + 1); sprintf (res, "ftp://%s", url); /* ...and replace ':' with '/'. */ diff --git a/src/utils.c b/src/utils.c index 60d8bb9f..32c17b4b 100644 --- a/src/utils.c +++ b/src/utils.c @@ -512,13 +512,10 @@ path_simplify (char *path) { register int i, start; int changes = 0; - char stub_char; if (!*path) return 0; - stub_char = '/'; - if (path[0] == '/') /* Preserve initial '/'. */ ++path;