From 0bb35e19a73ecbb9694172300a5530dbb8156bb4 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 21 Oct 2010 12:33:10 +0200 Subject: udhcpd: reduce stack usage by ~700 bytes. +28 bytes code size Signed-off-by: Denys Vlasenko --- networking/udhcp/dhcpd.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'networking/udhcp/dhcpd.c') diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c index 043220de9..f0878652c 100644 --- a/networking/udhcp/dhcpd.c +++ b/networking/udhcp/dhcpd.c @@ -132,7 +132,8 @@ static uint32_t select_lease_time(struct dhcp_packet *packet) } /* We got a DHCP DISCOVER. Send an OFFER. */ -static void send_offer(struct dhcp_packet *oldpacket, uint32_t static_lease_nip, struct dyn_lease *lease) +/* NOINLINE: limit stack usage in caller */ +static NOINLINE void send_offer(struct dhcp_packet *oldpacket, uint32_t static_lease_nip, struct dyn_lease *lease) { struct dhcp_packet packet; uint32_t lease_time_sec; @@ -202,7 +203,8 @@ static void send_offer(struct dhcp_packet *oldpacket, uint32_t static_lease_nip, send_packet(&packet, /*force_bcast:*/ 0); } -static void send_NAK(struct dhcp_packet *oldpacket) +/* NOINLINE: limit stack usage in caller */ +static NOINLINE void send_NAK(struct dhcp_packet *oldpacket) { struct dhcp_packet packet; @@ -212,7 +214,8 @@ static void send_NAK(struct dhcp_packet *oldpacket) send_packet(&packet, /*force_bcast:*/ 1); } -static void send_ACK(struct dhcp_packet *oldpacket, uint32_t yiaddr) +/* NOINLINE: limit stack usage in caller */ +static NOINLINE void send_ACK(struct dhcp_packet *oldpacket, uint32_t yiaddr) { struct dhcp_packet packet; uint32_t lease_time_sec; @@ -243,7 +246,8 @@ static void send_ACK(struct dhcp_packet *oldpacket, uint32_t yiaddr) } } -static void send_inform(struct dhcp_packet *oldpacket) +/* NOINLINE: limit stack usage in caller */ +static NOINLINE void send_inform(struct dhcp_packet *oldpacket) { struct dhcp_packet packet; -- cgit v1.2.3