aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-02-01 10:41:14 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-02-01 10:41:14 +0100
commit06076494da41755893a6e072bbd9889581a9e9d1 (patch)
tree4215da092df73687aa1790de3125064a3f0d1a45
parentd15d7a0a4b07a55268546f0d32b6a3ed78a2ac77 (diff)
downloadbusybox-w32-06076494da41755893a6e072bbd9889581a9e9d1.tar.gz
busybox-w32-06076494da41755893a6e072bbd9889581a9e9d1.tar.bz2
busybox-w32-06076494da41755893a6e072bbd9889581a9e9d1.zip
udhcpd: use ptr_to_globals for its lone global data (g_leases)
function old new delta udhcpd_main 1461 1463 +2 add_lease 320 318 -2 g_leases 4 - -4 write_leases 223 214 -9 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/2 up/down: 2/-15) Total: -13 bytes text data bss dec hex filename 933232 481 6856 940569 e5a19 busybox_old 933223 481 6852 940556 e5a0c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/dhcpd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index 238542bb0..ff7450739 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -45,7 +45,7 @@
45#include "dhcpd.h" 45#include "dhcpd.h"
46 46
47/* globals */ 47/* globals */
48struct dyn_lease *g_leases; 48#define g_leases ((struct dyn_lease*)ptr_to_globals)
49/* struct server_config_t server_config is in bb_common_bufsiz1 */ 49/* struct server_config_t server_config is in bb_common_bufsiz1 */
50 50
51/* Takes the address of the pointer to the static_leases linked list, 51/* Takes the address of the pointer to the static_leases linked list,
@@ -880,7 +880,9 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
880 server_config.max_leases = num_ips; 880 server_config.max_leases = num_ips;
881 } 881 }
882 882
883 g_leases = xzalloc(server_config.max_leases * sizeof(g_leases[0])); 883 /* this sets g_leases */
884 SET_PTR_TO_GLOBALS(xzalloc(server_config.max_leases * sizeof(g_leases[0])));
885
884 read_leases(server_config.lease_file); 886 read_leases(server_config.lease_file);
885 887
886 if (udhcp_read_interface(server_config.interface, 888 if (udhcp_read_interface(server_config.interface,