diff options
| author | Garrett D'Amore <garrett@damore.org> | 2019-12-11 05:12:36 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2019-12-11 05:12:36 -0800 |
| commit | 5c0f08087429e7a89c97742e4a4b146688442a04 (patch) | |
| tree | b09dd481be3389d7321d3198a86efc9919216f3f /src/platform/posix/posix_udp.c | |
| parent | 52f5eb316f826c5c5be13c35f24f809d6d5efce4 (diff) | |
| download | nng-5c0f08087429e7a89c97742e4a4b146688442a04.tar.gz nng-5c0f08087429e7a89c97742e4a4b146688442a04.tar.bz2 nng-5c0f08087429e7a89c97742e4a4b146688442a04.zip | |
Address complaints found by lgtm.com.
Diffstat (limited to 'src/platform/posix/posix_udp.c')
| -rw-r--r-- | src/platform/posix/posix_udp.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/src/platform/posix/posix_udp.c b/src/platform/posix/posix_udp.c index 6b1ef399..015fb4ad 100644 --- a/src/platform/posix/posix_udp.c +++ b/src/platform/posix/posix_udp.c @@ -1,5 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2019 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -23,9 +23,6 @@ #include <sys/types.h> #include <sys/uio.h> #include <unistd.h> -#ifdef NNG_HAVE_ALLOCA -#include <alloca.h> -#endif // UDP support. @@ -123,26 +120,14 @@ nni_posix_udp_dosend(nni_plat_udp *udp) if (len < 1) { rv = NNG_EADDRINVAL; } else { - unsigned niov; - nni_iov *aiov; -#ifdef NNG_HAVE_ALLOCA - struct iovec *iov; -#else + unsigned niov; + nni_iov * aiov; struct iovec iov[16]; -#endif nni_aio_get_iov(aio, &niov, &aiov); -#ifdef NNG_HAVE_ALLOCA - if (niov > 64) { - rv = NNG_EINVAL; - } else { - iov = alloca(niov * sizeof(*iov)); - } -#else if (niov > NNI_NUM_ELEMENTS(iov)) { rv = NNG_EINVAL; } -#endif if (rv == 0) { struct msghdr hdr = { .msg_name = NULL }; for (unsigned i = 0; i < niov; i++) { |
