From b9256054419582dc35917b1cb39c7e09f489dfad Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Fri, 28 Sep 2007 10:29:17 +0000 Subject: assorted static vars removal function old new delta tcpudpsvd_main 1829 1839 +10 update_status 567 569 +2 sigterm 1 - -1 ......... dhcprelay_signal_handler 8 - -8 nfs_strerror 60 49 -11 singlemount 4579 4564 -15 static.p 16 - -16 svstatus 20 - -20 dhcprelay_xid_list 32 - -32 runsv_main 1785 1746 -39 static.buf 74 28 -46 svd 56 - -56 dhcprelay_main 1141 1080 -61 ------------------------------------------------------------------------------ (add/remove: 0/20 grow/shrink: 2/10 up/down: 12/-386) Total: -374 bytes --- ipsvd/tcpudp.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'ipsvd') diff --git a/ipsvd/tcpudp.c b/ipsvd/tcpudp.c index 6a11539c7..537a5240f 100644 --- a/ipsvd/tcpudp.c +++ b/ipsvd/tcpudp.c @@ -40,11 +40,24 @@ #include "ssl_io.h" #endif -static unsigned verbose; -static unsigned max_per_host; -static unsigned cur_per_host; -static unsigned cnum; -static unsigned cmax = 30; +struct globals { + unsigned verbose; + unsigned max_per_host; + unsigned cur_per_host; + unsigned cnum; + unsigned cmax; +}; +#define G (*(struct globals*)&bb_common_bufsiz1) +#define verbose (G.verbose ) +#define max_per_host (G.max_per_host) +#define cur_per_host (G.cur_per_host) +#define cnum (G.cnum ) +#define cmax (G.cmax ) +#define INIT_G() \ + do { \ + cmax = 30; \ + } while (0) + static void xsetenv_proto(const char *proto, const char *n, const char *v) { @@ -147,6 +160,8 @@ int tcpudpsvd_main(int argc, char **argv) int conn; unsigned backlog = 20; + INIT_G(); + tcp = (applet_name[0] == 't'); /* 3+ args, -i at most once, -p implies -h, -v is counter */ -- cgit v1.2.3