net: sockets: Simplify if logic in sendto(), fix warning
send()/sendto() aren't "front facing" functions, so when user calls them, context type hopefully should be already validated by other functions. They are also on critical path of app/network performance, so getting rid of extra check helps a little bit too. This also fixes a warning of "err" possibly being used non-initialized. Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commit is contained in:
parent
990bf16206
commit
82a03936a4
|
@ -266,10 +266,8 @@ ssize_t zsock_sendto(int sock, const void *buf, size_t len, int flags,
|
|||
if (sock_type == SOCK_DGRAM) {
|
||||
err = net_context_sendto(send_pkt, dest_addr, addrlen, NULL,
|
||||
timeout, NULL, NULL);
|
||||
} else if (sock_type == SOCK_STREAM) {
|
||||
err = net_context_send(send_pkt, NULL, timeout, NULL, NULL);
|
||||
} else {
|
||||
__ASSERT(0, "Unknown socket type");
|
||||
err = net_context_send(send_pkt, NULL, timeout, NULL, NULL);
|
||||
}
|
||||
|
||||
if (err < 0) {
|
||||
|
|
Loading…
Reference in a new issue