From 0e2b74ce3bcd1fd03cee2737e37e4a27ebaaf9d1 Mon Sep 17 00:00:00 2001 From: hniksic Date: Mon, 6 Nov 2000 13:24:57 -0800 Subject: [PATCH] [svn] Commit "minor fixes". --- src/ChangeLog | 17 +++++++++++++++++ src/config.h.in | 16 ++++++++++++++++ src/http.c | 9 ++++++++- src/log.c | 2 +- src/url.c | 3 ++- src/utils.c | 2 +- src/wget.h | 40 +++++++++++++++++++++------------------- 7 files changed, 66 insertions(+), 23 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index bf98dca8..97be722e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2000-11-05 Hrvoje Niksic + + * wget.h (DO_REALLOC_FROM_ALLOCA): Use braces to disambiguate + `if'. + +2000-11-05 Hrvoje Niksic + + * url.c (construct): Insert unneeded initialization for the + compiler to shut up. + + * config.h.in: Define _XOPEN_SOURCE to 500 to get the prototype + for strptime() (*duh*). Define _SVID_SOURCE to get S_IFLNK which + otherwise gets lost when you define _XOPEN_SOURCE. + + * utils.c (touch): Include the file name in the error message. + From Debian. + 2000-11-05 Hrvoje Niksic * log.c (logvprintf): Use vsnprintf() in all cases. If necessary, diff --git a/src/config.h.in b/src/config.h.in index 0e8b2b4c..709b979b 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -194,4 +194,20 @@ char *alloca (); /* Define to 1 if ANSI function prototypes are usable. */ #undef PROTOTYPES +/* Debian says: + + to get prototype for strptime, we need this (taken from lftp) + #ifdef __linux__ + #define __USE_XOPEN 1 + #endif + + But I don't think that's right. The __USE_XOPEN thing is an + internal glibc2 thing that gets defined in features.h. From + reading that file carefully, I think we need something like this + incantation. Without testing it, I can only hope that this won't + screw things up on other, non-glibc2 systems. */ + +#define _XOPEN_SOURCE 500 +#define _SVID_SOURCE + #endif /* CONFIG_H */ diff --git a/src/http.c b/src/http.c index 5f373ab2..48c1bc5e 100644 --- a/src/http.c +++ b/src/http.c @@ -960,7 +960,14 @@ File `%s' already there, will not retrieve.\n"), u->local); _wasn't_ specified last time, or the server contains files called *.orig, -N will be back to not operating correctly with -k. */ { - /* Would a single s[n]printf() call be faster? */ + /* Would a single s[n]printf() call be faster? --dan + + It wouldn't. sprintf() is horribly slow. At one point I + profiled Wget, and found that a measurable and + non-negligible amount of time was lost calling sprintf() + in url.c. Replacing sprintf with inline calls to + strcpy() and long_to_string() made a difference. + --hniksic */ strcpy(filename_plus_orig_suffix, u->local); strcpy(filename_plus_orig_suffix + filename_len, ".orig"); diff --git a/src/log.c b/src/log.c index d7bc7244..a71edf3b 100644 --- a/src/log.c +++ b/src/log.c @@ -1,5 +1,5 @@ /* Messages logging. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2000 Free Software Foundation, Inc. This file is part of Wget. diff --git a/src/url.c b/src/url.c index 2b6573a9..5095c444 100644 --- a/src/url.c +++ b/src/url.c @@ -1395,7 +1395,8 @@ construct (const char *url, const char *sub, int subsize, int no_proto) "/qux/xyzzy", our result should be "http://host/qux/xyzzy". */ int span; - const char *slash, *start_insert; + const char *slash; + const char *start_insert = NULL; /* for gcc to shut up. */ const char *pos = url; int seen_slash_slash = 0; /* We're looking for the first slash, but want to ignore diff --git a/src/utils.c b/src/utils.c index 633d7b61..371afd6d 100644 --- a/src/utils.c +++ b/src/utils.c @@ -411,7 +411,7 @@ touch (const char *file, time_t tm) #endif if (utime (file, ×) == -1) - logprintf (LOG_NOTQUIET, "utime: %s\n", strerror (errno)); + logprintf (LOG_NOTQUIET, "utime(%s): %s\n", file, strerror (errno)); } /* Checks if FILE is a symbolic link, and removes it if it is. Does diff --git a/src/wget.h b/src/wget.h index fd97f097..196f913c 100644 --- a/src/wget.h +++ b/src/wget.h @@ -173,25 +173,27 @@ char *xstrdup PARAMS ((const char *)); DO_REALLOC. */ #define DO_REALLOC_FROM_ALLOCA(basevar, sizevar, needed_size, allocap, type) do \ { \ - /* Avoid side-effectualness. */ \ - long do_realloc_needed_size = (needed_size); \ - long do_realloc_newsize = 0; \ - while ((sizevar) < (do_realloc_needed_size)) { \ - do_realloc_newsize = 2*(sizevar); \ - if (do_realloc_newsize < 16) \ - do_realloc_newsize = 16; \ - (sizevar) = do_realloc_newsize; \ - } \ - if (do_realloc_newsize) \ - if (!allocap) \ - XREALLOC_ARRAY (basevar, type, do_realloc_newsize); \ - else \ - { \ - void *drfa_new_basevar = xmalloc (do_realloc_newsize); \ - memcpy (drfa_new_basevar, basevar, sizevar); \ - (basevar) = drfa_new_basevar; \ - allocap = 0; \ - } \ + /* Avoid side-effectualness. */ \ + long do_realloc_needed_size = (needed_size); \ + long do_realloc_newsize = 0; \ + while ((sizevar) < (do_realloc_needed_size)) { \ + do_realloc_newsize = 2*(sizevar); \ + if (do_realloc_newsize < 16) \ + do_realloc_newsize = 16; \ + (sizevar) = do_realloc_newsize; \ + } \ + if (do_realloc_newsize) \ + { \ + if (!allocap) \ + XREALLOC_ARRAY (basevar, type, do_realloc_newsize); \ + else \ + { \ + void *drfa_new_basevar = xmalloc (do_realloc_newsize); \ + memcpy (drfa_new_basevar, basevar, sizevar); \ + (basevar) = drfa_new_basevar; \ + allocap = 0; \ + } \ + } \ } while (0) /* Free FOO if it is non-NULL. */ -- 2.39.2