Browse Source

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
pull/1759/head
Richard Fuchs 2 years ago
parent
commit
50a91aa9fb
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      lib/socket.c

+ 5
- 2
lib/socket.c View File

@ -300,7 +300,7 @@ static int __ip_accept(socket_t *s, socket_t *newsock) {
return 0; 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; ssize_t ret;
struct sockaddr_storage sin; struct sockaddr_storage sin;
struct msghdr msg; 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; 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) { 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) { static ssize_t __ip_sendmsg(socket_t *s, struct msghdr *mh, const endpoint_t *ep) {
struct sockaddr_storage sin; struct sockaddr_storage sin;


Loading…
Cancel
Save