diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-10-20 17:01:10 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-10-20 17:01:10 -0700 |
| commit | 693773195dcd877164314d6b4c37cbd980cbb6ab (patch) | |
| tree | 3c6014205fb75d1e39227ac505dab8964e57a815 /src/sp/protocol/pipeline0 | |
| parent | 5830408d11fb19aaf78cb47016ea1692e8f6d2ed (diff) | |
| download | nng-693773195dcd877164314d6b4c37cbd980cbb6ab.tar.gz nng-693773195dcd877164314d6b4c37cbd980cbb6ab.tar.bz2 nng-693773195dcd877164314d6b4c37cbd980cbb6ab.zip | |
Use `const` for nng_stat when possible.
This should help the compiler enforce checks, and may result
in better optimizations.
Diffstat (limited to 'src/sp/protocol/pipeline0')
| -rw-r--r-- | src/sp/protocol/pipeline0/pull_test.c | 22 | ||||
| -rw-r--r-- | src/sp/protocol/pipeline0/push_test.c | 46 |
2 files changed, 34 insertions, 34 deletions
diff --git a/src/sp/protocol/pipeline0/pull_test.c b/src/sp/protocol/pipeline0/pull_test.c index 25066093..be11a42d 100644 --- a/src/sp/protocol/pipeline0/pull_test.c +++ b/src/sp/protocol/pipeline0/pull_test.c @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -14,7 +14,7 @@ test_pull_identity(void) { nng_socket s; int p; - char * n; + char *n; NUTS_PASS(nng_pull0_open(&s)); NUTS_PASS(nng_socket_get_int(s, NNG_OPT_PROTO, &p)); @@ -104,7 +104,7 @@ test_pull_close_pending(void) nng_socket pull; nng_socket push; nng_pipe p1, p2; - char * addr; + char *addr; NUTS_ADDR(addr, "inproc"); @@ -136,10 +136,10 @@ test_pull_close_pending(void) void test_pull_validate_peer(void) { - nng_socket s1, s2; - nng_stat * stats; - nng_stat * reject; - char * addr; + nng_socket s1, s2; + nng_stat *stats; + const nng_stat *reject; + char *addr; NUTS_ADDR(addr, "inproc"); @@ -168,7 +168,7 @@ static void test_pull_recv_aio_stopped(void) { nng_socket s; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_pull0_open(&s)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -185,7 +185,7 @@ static void test_pull_close_recv(void) { nng_socket s; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_pull0_open(&s)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -202,7 +202,7 @@ static void test_pull_recv_nonblock(void) { nng_socket s; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_pull0_open(&s)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -220,7 +220,7 @@ static void test_pull_recv_cancel(void) { nng_socket s; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_pull0_open(&s)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); diff --git a/src/sp/protocol/pipeline0/push_test.c b/src/sp/protocol/pipeline0/push_test.c index 9bdd9635..15574732 100644 --- a/src/sp/protocol/pipeline0/push_test.c +++ b/src/sp/protocol/pipeline0/push_test.c @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -14,7 +14,7 @@ test_push_identity(void) { nng_socket s; int p; - char * n; + char *n; NUTS_PASS(nng_push0_open(&s)); NUTS_PASS(nng_socket_get_int(s, NNG_OPT_PROTO, &p)); @@ -34,7 +34,7 @@ static void test_push_cannot_recv(void) { nng_socket s; - nng_msg * m = NULL; + nng_msg *m = NULL; NUTS_PASS(nng_push0_open(&s)); NUTS_FAIL(nng_recvmsg(s, &m, 0), NNG_ENOTSUP); @@ -210,10 +210,10 @@ test_push_poll_truncate(void) void test_push_validate_peer(void) { - nng_socket s1, s2; - nng_stat * stats; - nng_stat * reject; - char * addr; + nng_socket s1, s2; + nng_stat *stats; + const nng_stat *reject; + char *addr; NUTS_ADDR(addr, "inproc"); @@ -242,8 +242,8 @@ static void test_push_send_aio_stopped(void) { nng_socket s; - nng_aio * aio; - nng_msg * m; + nng_aio *aio; + nng_msg *m; NUTS_PASS(nng_push0_open(&s)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -263,8 +263,8 @@ static void test_push_close_send(void) { nng_socket s; - nng_aio * aio; - nng_msg * m; + nng_aio *aio; + nng_msg *m; NUTS_PASS(nng_push0_open(&s)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -284,8 +284,8 @@ static void test_push_send_nonblock(void) { nng_socket s; - nng_aio * aio; - nng_msg * m; + nng_aio *aio; + nng_msg *m; NUTS_PASS(nng_push0_open(&s)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -306,8 +306,8 @@ static void test_push_send_timeout(void) { nng_socket s; - nng_aio * aio; - nng_msg * m; + nng_aio *aio; + nng_msg *m; NUTS_PASS(nng_push0_open(&s)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -328,8 +328,8 @@ static void test_push_send_cancel(void) { nng_socket s; - nng_aio * aio; - nng_msg * m; + nng_aio *aio; + nng_msg *m; NUTS_PASS(nng_push0_open(&s)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -352,8 +352,8 @@ test_push_send_late_unbuffered(void) { nng_socket s; nng_socket pull; - nng_aio * aio; - nng_msg * m; + nng_aio *aio; + nng_msg *m; NUTS_PASS(nng_push0_open(&s)); NUTS_PASS(nng_pull0_open(&pull)); @@ -375,14 +375,13 @@ test_push_send_late_unbuffered(void) nng_aio_free(aio); } - static void test_push_send_late_buffered(void) { nng_socket s; nng_socket pull; - nng_aio * aio; - nng_msg * m; + nng_aio *aio; + nng_msg *m; NUTS_PASS(nng_push0_open(&s)); NUTS_PASS(nng_pull0_open(&pull)); @@ -493,7 +492,8 @@ test_push_send_buffer(void) NUTS_FAIL(nng_socket_get(s, NNG_OPT_SENDBUF, &b, &sz), NNG_EINVAL); NUTS_FAIL(nng_socket_set_int(s, NNG_OPT_SENDBUF, -1), NNG_EINVAL); NUTS_FAIL(nng_socket_set_int(s, NNG_OPT_SENDBUF, 100000), NNG_EINVAL); - NUTS_FAIL(nng_socket_set_bool(s, NNG_OPT_SENDBUF, false), NNG_EBADTYPE); + NUTS_FAIL( + nng_socket_set_bool(s, NNG_OPT_SENDBUF, false), NNG_EBADTYPE); NUTS_FAIL(nng_socket_set(s, NNG_OPT_SENDBUF, &b, 1), NNG_EINVAL); NUTS_PASS(nng_socket_set_int(s, NNG_OPT_SENDBUF, 100)); NUTS_PASS(nng_socket_get_int(s, NNG_OPT_SENDBUF, &v)); |
