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/reqrep0 | |
| 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/reqrep0')
| -rw-r--r-- | src/sp/protocol/reqrep0/rep_test.c | 10 | ||||
| -rw-r--r-- | src/sp/protocol/reqrep0/req_test.c | 14 | ||||
| -rw-r--r-- | src/sp/protocol/reqrep0/xrep_test.c | 32 | ||||
| -rw-r--r-- | src/sp/protocol/reqrep0/xreq_test.c | 26 |
4 files changed, 41 insertions, 41 deletions
diff --git a/src/sp/protocol/reqrep0/rep_test.c b/src/sp/protocol/reqrep0/rep_test.c index 57da9cac..1a535998 100644 --- a/src/sp/protocol/reqrep0/rep_test.c +++ b/src/sp/protocol/reqrep0/rep_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 @@ -137,10 +137,10 @@ test_rep_context_no_poll(void) void test_rep_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"); NUTS_PASS(nng_rep0_open(&s1)); diff --git a/src/sp/protocol/reqrep0/req_test.c b/src/sp/protocol/reqrep0/req_test.c index c115c8e7..31175cfd 100644 --- a/src/sp/protocol/reqrep0/req_test.c +++ b/src/sp/protocol/reqrep0/req_test.c @@ -1,5 +1,5 @@ // -// Copyright 2023 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2024 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 @@ -233,7 +233,7 @@ test_req_resend_reconnect(void) // the retry from loss of our original peer. NUTS_PASS(nng_socket_set_ms(req, NNG_OPT_REQ_RESENDTIME, 60 * SECOND)); // And make sure the tick runs faster than our timeout! - NUTS_PASS(nng_socket_set_ms(req, NNG_OPT_REQ_RESENDTICK, SECOND/10)); + NUTS_PASS(nng_socket_set_ms(req, NNG_OPT_REQ_RESENDTICK, SECOND / 10)); NUTS_MARRY(rep1, req); @@ -272,7 +272,7 @@ test_req_resend_disconnect(void) // the retry from loss of our original peer. NUTS_PASS(nng_socket_set_ms(req, NNG_OPT_REQ_RESENDTIME, 60 * SECOND)); // And make sure the tick runs faster than our timeout! - NUTS_PASS(nng_socket_set_ms(req, NNG_OPT_REQ_RESENDTICK, SECOND/10)); + NUTS_PASS(nng_socket_set_ms(req, NNG_OPT_REQ_RESENDTICK, SECOND / 10)); NUTS_MARRY(rep1, req); NUTS_SEND(req, "ping"); @@ -974,10 +974,10 @@ test_req_ctx_recv_close_socket(void) static void test_req_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"); diff --git a/src/sp/protocol/reqrep0/xrep_test.c b/src/sp/protocol/reqrep0/xrep_test.c index 6f1564eb..cee5952f 100644 --- a/src/sp/protocol/reqrep0/xrep_test.c +++ b/src/sp/protocol/reqrep0/xrep_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,8 +14,8 @@ test_xrep_identity(void) { nng_socket s; int p1, p2; - char * n1; - char * n2; + char *n1; + char *n2; NUTS_PASS(nng_rep0_open_raw(&s)); NUTS_PASS(nng_socket_get_int(s, NNG_OPT_PROTO, &p1)); @@ -87,7 +87,7 @@ test_xrep_poll_readable(void) int fd; nng_socket req; nng_socket rep; - nng_msg * msg; + nng_msg *msg; NUTS_PASS(nng_req0_open(&req)); NUTS_PASS(nng_rep0_open_raw(&rep)); @@ -120,10 +120,10 @@ test_xrep_poll_readable(void) static void test_xrep_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"); @@ -154,8 +154,8 @@ test_xrep_close_pipe_before_send(void) nng_socket rep; nng_socket req; nng_pipe p; - nng_aio * aio1; - nng_msg * m; + nng_aio *aio1; + nng_msg *m; NUTS_PASS(nng_rep0_open_raw(&rep)); NUTS_PASS(nng_req0_open(&req)); @@ -186,7 +186,7 @@ test_xrep_close_pipe_during_send(void) nng_socket rep; nng_socket req; nng_pipe p; - nng_msg * m; + nng_msg *m; NUTS_PASS(nng_rep0_open_raw(&rep)); NUTS_PASS(nng_req0_open_raw(&req)); @@ -226,7 +226,7 @@ test_xrep_close_during_recv(void) { nng_socket rep; nng_socket req; - nng_msg * m; + nng_msg *m; NUTS_PASS(nng_rep0_open_raw(&rep)); NUTS_PASS(nng_req0_open_raw(&req)); @@ -255,7 +255,7 @@ static void test_xrep_recv_aio_stopped(void) { nng_socket rep; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_rep0_open_raw(&rep)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -273,7 +273,7 @@ test_xrep_send_no_header(void) { nng_socket rep; nng_socket req; - nng_msg * m; + nng_msg *m; NUTS_PASS(nng_req0_open_raw(&req)); NUTS_PASS(nng_rep0_open_raw(&rep)); @@ -297,7 +297,7 @@ test_xrep_recv_garbage(void) { nng_socket rep; nng_socket req; - nng_msg * m; + nng_msg *m; NUTS_PASS(nng_rep0_open_raw(&rep)); NUTS_PASS(nng_req0_open_raw(&req)); @@ -355,7 +355,7 @@ test_xrep_ttl_drop(void) { nng_socket rep; nng_socket req; - nng_msg * m; + nng_msg *m; NUTS_PASS(nng_rep0_open_raw(&rep)); NUTS_PASS(nng_req0_open_raw(&req)); diff --git a/src/sp/protocol/reqrep0/xreq_test.c b/src/sp/protocol/reqrep0/xreq_test.c index 8c850cba..c2d6c9ed 100644 --- a/src/sp/protocol/reqrep0/xreq_test.c +++ b/src/sp/protocol/reqrep0/xreq_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,8 +14,8 @@ test_xreq_identity(void) { nng_socket s; int p1, p2; - char * n1; - char * n2; + char *n1; + char *n2; NUTS_PASS(nng_req0_open_raw(&s)); NUTS_PASS(nng_socket_get_int(s, NNG_OPT_PROTO, &p1)); @@ -84,7 +84,7 @@ test_xreq_poll_readable(void) int fd; nng_socket req; nng_socket rep; - nng_msg * msg; + nng_msg *msg; NUTS_PASS(nng_req0_open_raw(&req)); NUTS_PASS(nng_rep0_open(&rep)); @@ -129,10 +129,10 @@ test_xreq_poll_readable(void) static void test_xreq_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"); @@ -161,7 +161,7 @@ static void test_xreq_recv_aio_stopped(void) { nng_socket req; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_req0_open_raw(&req)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -179,7 +179,7 @@ test_xreq_recv_garbage(void) { nng_socket rep; nng_socket req; - nng_msg * m; + nng_msg *m; uint32_t req_id; NUTS_PASS(nng_rep0_open_raw(&rep)); @@ -216,7 +216,7 @@ test_xreq_recv_header(void) { nng_socket rep; nng_socket req; - nng_msg * m; + nng_msg *m; nng_pipe p1, p2; uint32_t id; @@ -258,7 +258,7 @@ test_xreq_close_during_recv(void) { nng_socket rep; nng_socket req; - nng_msg * m; + nng_msg *m; nng_pipe p1; nng_pipe p2; @@ -289,7 +289,7 @@ test_xreq_close_pipe_during_send(void) { nng_socket rep; nng_socket req; - nng_msg * m; + nng_msg *m; nng_pipe p1; nng_pipe p2; |
