From 43982ed49962526f7f042bcd9c5eb05ab4e586de Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 24 Jan 2026 05:21:10 +0100 Subject: httpd: code shrink via "split-globals" trick function old new delta httpd_main 957 968 +11 log_and_exit 25 26 +1 send_headers 712 708 -4 handle_incoming_and_exit 2292 2285 -7 sigalrm_handler 102 93 -9 parse_conf 1332 1323 -9 send_cgi_and_exit 803 790 -13 cgi_io_loop_and_exit 656 635 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/6 up/down: 12/-63) Total: -51 bytes Signed-off-by: Denys Vlasenko --- networking/httpd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'networking') diff --git a/networking/httpd.c b/networking/httpd.c index ce557c1bf..176eb244b 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -484,7 +484,6 @@ static const struct { }; struct globals { - int verbose; /* must be int (used by getopt32) */ smallint flg_deny_all; #if ENABLE_FEATURE_HTTPD_GZIP /* client can handle gzip / we are going to send gzip */ @@ -494,6 +493,7 @@ struct globals { #if ENABLE_FEATURE_HTTPD_CGI smallint cgi_output; #endif + int verbose; /* must be int (used by getopt32) */ time_t last_mod; #if ENABLE_FEATURE_HTTPD_ETAG char *if_none_match; @@ -555,7 +555,7 @@ struct globals { #endif char iobuf[IOBUF_SIZE] ALIGN8; }; -#define G (*ptr_to_globals) +#define G (*OFFSET_PTR_TO_GLOBALS) #define verbose (G.verbose ) #define flg_deny_all (G.flg_deny_all ) #if ENABLE_FEATURE_HTTPD_GZIP @@ -598,7 +598,7 @@ enum { #define iobuf (G.iobuf ) #define INIT_G() do { \ setup_common_bufsiz(); \ - SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ + SET_OFFSET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ IF_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \ IF_FEATURE_HTTPD_RANGES(range_start = -1;) \ bind_addr_or_port = STR(CONFIG_FEATURE_HTTPD_PORT_DEFAULT); \ -- cgit v1.2.3-55-g6feb