From 50a91aa9fb3ccc50dd002535ffeb622eb9dff00a Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 1 Aug 2023 10:42:55 -0400 Subject: [PATCH] MT#55283 refactor to inline __ip_recvfrom_options This makes it possible for the compiler to omit unneeded code from __ip_recvfrom(). Change-Id: I06aca0c4b88b42a29d21ebde0be031d45f5a5955 --- lib/socket.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/socket.c b/lib/socket.c index fb11199f0..380fecbd0 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -300,7 +300,7 @@ static int __ip_accept(socket_t *s, socket_t *newsock) { return 0; } -static ssize_t __ip_recvfrom_ts(socket_t *s, void *buf, size_t len, endpoint_t *ep, struct timeval *tv) { +INLINE ssize_t __ip_recvfrom_options(socket_t *s, void *buf, size_t len, endpoint_t *ep, struct timeval *tv) { ssize_t ret; struct sockaddr_storage sin; struct msghdr msg; @@ -344,8 +344,11 @@ static ssize_t __ip_recvfrom_ts(socket_t *s, void *buf, size_t len, endpoint_t * return ret; } +static ssize_t __ip_recvfrom_ts(socket_t *s, void *buf, size_t len, endpoint_t *ep, struct timeval *tv) { + return __ip_recvfrom_options(s, buf, len, ep, tv); +} static ssize_t __ip_recvfrom(socket_t *s, void *buf, size_t len, endpoint_t *ep) { - return __ip_recvfrom_ts(s, buf, len, ep, NULL); + return __ip_recvfrom_options(s, buf, len, ep, NULL); } static ssize_t __ip_sendmsg(socket_t *s, struct msghdr *mh, const endpoint_t *ep) { struct sockaddr_storage sin;