From: Denys Vlasenko Date: Sun, 4 Feb 2018 17:32:21 +0000 (+0100) Subject: ftpd: switch to mallced "globals" X-Git-Tag: 1_29_0~274 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=565af2322271984edf6eb533f90789e52e311848;p=oweals%2Fbusybox.git ftpd: switch to mallced "globals" function old new delta cmdio_write_ok 45 49 +4 cmdio_write_error 45 49 +4 handle_dir_common 360 363 +3 handle_cwd 40 43 +3 port_or_pasv_was_seen 37 39 +2 pasv_active 13 15 +2 cmdio_write_raw 34 36 +2 cmdio_write 78 80 +2 get_remote_transfer_fd 94 93 -1 port_pasv_cleanup 50 45 -5 bind_for_passive_mode 124 119 -5 cmdio_get_cmd_and_arg 237 230 -7 timeout_handler 104 93 -11 ftpd_main 2222 2152 -70 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/6 up/down: 22/-99) Total: -77 bytes Signed-off-by: Denys Vlasenko --- diff --git a/networking/ftpd.c b/networking/ftpd.c index 8af5acac2..833507ba1 100644 --- a/networking/ftpd.c +++ b/networking/ftpd.c @@ -171,9 +171,13 @@ struct globals { char msg_ok [(sizeof("NNN " MSG_OK ) + 3) & 0xfffc]; char msg_err[(sizeof("NNN " MSG_ERR) + 3) & 0xfffc]; } FIX_ALIASING; -#define G (*(struct globals*)bb_common_bufsiz1) +#define G (*ptr_to_globals) +/* ^^^ about 75 bytes smaller code than this: */ +//#define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ - setup_common_bufsiz(); \ + SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ + /*setup_common_bufsiz();*/ \ + \ /* Moved to main */ \ /*strcpy(G.msg_ok + 4, MSG_OK );*/ \ /*strcpy(G.msg_err + 4, MSG_ERR);*/ \