diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2026-01-24 05:21:10 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2026-01-24 05:22:33 +0100 |
| commit | 43982ed49962526f7f042bcd9c5eb05ab4e586de (patch) | |
| tree | f4ae8a35c49117808a833cd1ddc1a6280e71ed5c /networking/httpd.c | |
| parent | 1a64fe3594b80dabcc7ccb7dce5b3391b27b0d24 (diff) | |
| download | busybox-w32-43982ed49962526f7f042bcd9c5eb05ab4e586de.tar.gz busybox-w32-43982ed49962526f7f042bcd9c5eb05ab4e586de.tar.bz2 busybox-w32-43982ed49962526f7f042bcd9c5eb05ab4e586de.zip | |
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 <vda.linux@googlemail.com>
Diffstat (limited to 'networking/httpd.c')
| -rw-r--r-- | networking/httpd.c | 6 |
1 files changed, 3 insertions, 3 deletions
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 { | |||
| 484 | }; | 484 | }; |
| 485 | 485 | ||
| 486 | struct globals { | 486 | struct globals { |
| 487 | int verbose; /* must be int (used by getopt32) */ | ||
| 488 | smallint flg_deny_all; | 487 | smallint flg_deny_all; |
| 489 | #if ENABLE_FEATURE_HTTPD_GZIP | 488 | #if ENABLE_FEATURE_HTTPD_GZIP |
| 490 | /* client can handle gzip / we are going to send gzip */ | 489 | /* client can handle gzip / we are going to send gzip */ |
| @@ -494,6 +493,7 @@ struct globals { | |||
| 494 | #if ENABLE_FEATURE_HTTPD_CGI | 493 | #if ENABLE_FEATURE_HTTPD_CGI |
| 495 | smallint cgi_output; | 494 | smallint cgi_output; |
| 496 | #endif | 495 | #endif |
| 496 | int verbose; /* must be int (used by getopt32) */ | ||
| 497 | time_t last_mod; | 497 | time_t last_mod; |
| 498 | #if ENABLE_FEATURE_HTTPD_ETAG | 498 | #if ENABLE_FEATURE_HTTPD_ETAG |
| 499 | char *if_none_match; | 499 | char *if_none_match; |
| @@ -555,7 +555,7 @@ struct globals { | |||
| 555 | #endif | 555 | #endif |
| 556 | char iobuf[IOBUF_SIZE] ALIGN8; | 556 | char iobuf[IOBUF_SIZE] ALIGN8; |
| 557 | }; | 557 | }; |
| 558 | #define G (*ptr_to_globals) | 558 | #define G (*OFFSET_PTR_TO_GLOBALS) |
| 559 | #define verbose (G.verbose ) | 559 | #define verbose (G.verbose ) |
| 560 | #define flg_deny_all (G.flg_deny_all ) | 560 | #define flg_deny_all (G.flg_deny_all ) |
| 561 | #if ENABLE_FEATURE_HTTPD_GZIP | 561 | #if ENABLE_FEATURE_HTTPD_GZIP |
| @@ -598,7 +598,7 @@ enum { | |||
| 598 | #define iobuf (G.iobuf ) | 598 | #define iobuf (G.iobuf ) |
| 599 | #define INIT_G() do { \ | 599 | #define INIT_G() do { \ |
| 600 | setup_common_bufsiz(); \ | 600 | setup_common_bufsiz(); \ |
| 601 | SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ | 601 | SET_OFFSET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ |
| 602 | IF_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \ | 602 | IF_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \ |
| 603 | IF_FEATURE_HTTPD_RANGES(range_start = -1;) \ | 603 | IF_FEATURE_HTTPD_RANGES(range_start = -1;) \ |
| 604 | bind_addr_or_port = STR(CONFIG_FEATURE_HTTPD_PORT_DEFAULT); \ | 604 | bind_addr_or_port = STR(CONFIG_FEATURE_HTTPD_PORT_DEFAULT); \ |
