zephyr/subsys/net/lib/sockets/socket_offload.c
Pisit Sawangvonganan af4527e131 style: subsys: adjust return usage in void functions
For code clarity, this commit adjusts the use of `return` statements
in functions with a void return type as follows:
- Transform `return foo();` into separate statements:
  `foo();`
  `return;`
- Remove unnecessary `return` statements when
  they don't affect control flow.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-20 11:06:55 +02:00

42 lines
972 B
C

/*
* Copyright (c) 2018 Linaro Limited.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(net_socket_offload, CONFIG_NET_SOCKETS_LOG_LEVEL);
#include <zephyr/net/socket_offload.h>
#include <zephyr/net/socket.h>
#include "sockets_internal.h"
const struct socket_dns_offload *dns_offload;
void socket_offload_dns_register(const struct socket_dns_offload *ops)
{
__ASSERT_NO_MSG(ops);
__ASSERT_NO_MSG(dns_offload == NULL);
dns_offload = ops;
}
int socket_offload_getaddrinfo(const char *node, const char *service,
const struct zsock_addrinfo *hints,
struct zsock_addrinfo **res)
{
__ASSERT_NO_MSG(dns_offload);
__ASSERT_NO_MSG(dns_offload->getaddrinfo);
return dns_offload->getaddrinfo(node, service, hints, res);
}
void socket_offload_freeaddrinfo(struct zsock_addrinfo *res)
{
__ASSERT_NO_MSG(dns_offload);
__ASSERT_NO_MSG(dns_offload->freeaddrinfo);
dns_offload->freeaddrinfo(res);
}