aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-11-24 21:56:21 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-11-24 21:56:21 +0100
commit5084bae61aac86fc6d13d48e59f5b98908de7d31 (patch)
tree2fac80427bc988024b0178788158375f0f6ce978
parentd2923b3d239d55565427533d3a9702cf1d27eb92 (diff)
downloadbusybox-w32-5084bae61aac86fc6d13d48e59f5b98908de7d31.tar.gz
busybox-w32-5084bae61aac86fc6d13d48e59f5b98908de7d31.tar.bz2
busybox-w32-5084bae61aac86fc6d13d48e59f5b98908de7d31.zip
wget: code shrink
function old new delta base64enc 53 46 -7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/wget.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 44c481a99..58a51d9ff 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -233,20 +233,19 @@ struct globals {
233 char *fname_out; /* where to direct output (-O) */ 233 char *fname_out; /* where to direct output (-O) */
234 const char *proxy_flag; /* Use proxies if env vars are set */ 234 const char *proxy_flag; /* Use proxies if env vars are set */
235 const char *user_agent; /* "User-Agent" header field */ 235 const char *user_agent; /* "User-Agent" header field */
236 int output_fd;
237 int o_flags;
236#if ENABLE_FEATURE_WGET_TIMEOUT 238#if ENABLE_FEATURE_WGET_TIMEOUT
237 unsigned timeout_seconds; 239 unsigned timeout_seconds;
238 bool die_if_timed_out; 240 smallint die_if_timed_out;
239#endif 241#endif
240 int output_fd;
241 int o_flags;
242 smallint chunked; /* chunked transfer encoding */ 242 smallint chunked; /* chunked transfer encoding */
243 smallint got_clen; /* got content-length: from server */ 243 smallint got_clen; /* got content-length: from server */
244 /* Local downloads do benefit from big buffer. 244 /* Local downloads do benefit from big buffer.
245 * With 512 byte buffer, it was measured to be 245 * With 512 byte buffer, it was measured to be
246 * an order of magnitude slower than with big one. 246 * an order of magnitude slower than with big one.
247 */ 247 */
248 uint64_t just_to_align_next_member; 248 char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024] ALIGNED(sizeof(long));
249 char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024];
250} FIX_ALIASING; 249} FIX_ALIASING;
251#define G (*ptr_to_globals) 250#define G (*ptr_to_globals)
252#define INIT_G() do { \ 251#define INIT_G() do { \
@@ -349,9 +348,8 @@ static void strip_ipv6_scope_id(char *host)
349/* Base64-encode character string. */ 348/* Base64-encode character string. */
350static char *base64enc(const char *str) 349static char *base64enc(const char *str)
351{ 350{
352 unsigned len = strlen(str); 351 /* paranoia */
353 if (len > sizeof(G.wget_buf)/4*3 - 10) /* paranoia */ 352 unsigned len = strnlen(str, sizeof(G.wget_buf)/4*3 - 10);
354 len = sizeof(G.wget_buf)/4*3 - 10;
355 bb_uuencode(G.wget_buf, str, len, bb_uuenc_tbl_base64); 353 bb_uuencode(G.wget_buf, str, len, bb_uuenc_tbl_base64);
356 return G.wget_buf; 354 return G.wget_buf;
357} 355}