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/pubsub0 | |
| 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/pubsub0')
| -rw-r--r-- | src/sp/protocol/pubsub0/pub_test.c | 22 | ||||
| -rw-r--r-- | src/sp/protocol/pubsub0/sub_test.c | 42 | ||||
| -rw-r--r-- | src/sp/protocol/pubsub0/xsub_test.c | 24 |
3 files changed, 44 insertions, 44 deletions
diff --git a/src/sp/protocol/pubsub0/pub_test.c b/src/sp/protocol/pubsub0/pub_test.c index a430b610..462decd2 100644 --- a/src/sp/protocol/pubsub0/pub_test.c +++ b/src/sp/protocol/pubsub0/pub_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_pub_identity(void) { nng_socket s; int p; - char * n; + char *n; NUTS_PASS(nng_pub0_open(&s)); NUTS_PASS(nng_socket_get_int(s, NNG_OPT_PROTO, &p)); @@ -103,10 +103,10 @@ test_pub_send_no_pipes(void) void test_pub_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"); @@ -166,7 +166,7 @@ test_sub_recv_ctx_closed(void) { nng_socket sub; nng_ctx ctx; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_ctx_open(&ctx, sub)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -183,7 +183,7 @@ test_sub_ctx_recv_aio_stopped(void) { nng_socket sub; nng_ctx ctx; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -203,7 +203,7 @@ test_sub_close_context_recv(void) { nng_socket sub; nng_ctx ctx; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_ctx_open(&ctx, sub)); @@ -223,7 +223,7 @@ test_sub_ctx_recv_nonblock(void) { nng_socket sub; nng_ctx ctx; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_ctx_open(&ctx, sub)); @@ -243,7 +243,7 @@ test_sub_ctx_recv_cancel(void) { nng_socket sub; nng_ctx ctx; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_ctx_open(&ctx, sub)); diff --git a/src/sp/protocol/pubsub0/sub_test.c b/src/sp/protocol/pubsub0/sub_test.c index b830ae80..a332a0a7 100644 --- a/src/sp/protocol/pubsub0/sub_test.c +++ b/src/sp/protocol/pubsub0/sub_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_sub_identity(void) { nng_socket s; int p; - char * n; + char *n; NUTS_PASS(nng_sub0_open(&s)); NUTS_PASS(nng_socket_get_int(s, NNG_OPT_PROTO, &p)); @@ -45,8 +45,8 @@ test_sub_context_cannot_send(void) { nng_socket sub; nng_ctx ctx; - nng_msg * m; - nng_aio * aio; + nng_msg *m; + nng_aio *aio; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_ctx_open(&ctx, sub)); @@ -121,8 +121,8 @@ test_sub_recv_late(void) int fd; nng_socket pub; nng_socket sub; - nng_aio * aio; - nng_msg * msg; + nng_aio *aio; + nng_msg *msg; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_pub0_open(&pub)); @@ -179,10 +179,10 @@ test_sub_context_no_poll(void) void test_sub_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"); @@ -212,7 +212,7 @@ test_sub_recv_ctx_closed(void) { nng_socket sub; nng_ctx ctx; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_ctx_open(&ctx, sub)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -229,7 +229,7 @@ test_sub_ctx_recv_aio_stopped(void) { nng_socket sub; nng_ctx ctx; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -249,7 +249,7 @@ test_sub_close_context_recv(void) { nng_socket sub; nng_ctx ctx; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_ctx_open(&ctx, sub)); @@ -269,7 +269,7 @@ test_sub_ctx_recv_nonblock(void) { nng_socket sub; nng_ctx ctx; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_ctx_open(&ctx, sub)); @@ -289,7 +289,7 @@ test_sub_ctx_recv_cancel(void) { nng_socket sub; nng_ctx ctx; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_ctx_open(&ctx, sub)); @@ -413,7 +413,7 @@ test_sub_drop_new(void) { nng_socket sub; nng_socket pub; - nng_msg * msg; + nng_msg *msg; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_pub0_open(&pub)); @@ -439,7 +439,7 @@ test_sub_drop_old(void) { nng_socket sub; nng_socket pub; - nng_msg * msg; + nng_msg *msg; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_pub0_open(&pub)); @@ -485,7 +485,7 @@ test_sub_filter(void) NUTS_PASS(nng_send(pub, "def", 3, 0)); NUTS_PASS(nng_send(pub, "de", 2, 0)); // will not go through NUTS_PASS(nng_send(pub, "abc123", 6, 0)); - NUTS_PASS(nng_send(pub, "xzy", 3, 0)); // does not match + NUTS_PASS(nng_send(pub, "xzy", 3, 0)); // does not match NUTS_PASS(nng_send(pub, "ghi-drop", 7, 0)); // dropped by unsub NUTS_PASS(nng_send(pub, "jkl-mno", 6, 0)); @@ -517,9 +517,9 @@ test_sub_multi_context(void) nng_socket pub; nng_ctx c1; nng_ctx c2; - nng_aio * aio1; - nng_aio * aio2; - nng_msg * m; + nng_aio *aio1; + nng_aio *aio2; + nng_msg *m; NUTS_PASS(nng_sub0_open(&sub)); NUTS_PASS(nng_pub0_open(&pub)); diff --git a/src/sp/protocol/pubsub0/xsub_test.c b/src/sp/protocol/pubsub0/xsub_test.c index 19815661..9f2be2be 100644 --- a/src/sp/protocol/pubsub0/xsub_test.c +++ b/src/sp/protocol/pubsub0/xsub_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_xsub_identity(void) { nng_socket s; int p; - char * n; + char *n; NUTS_PASS(nng_sub0_open_raw(&s)); NUTS_PASS(nng_socket_get_int(s, NNG_OPT_PROTO, &p)); @@ -93,8 +93,8 @@ test_xsub_recv_late(void) int fd; nng_socket pub; nng_socket sub; - nng_aio * aio; - nng_msg * msg; + nng_aio *aio; + nng_msg *msg; NUTS_PASS(nng_sub0_open_raw(&sub)); NUTS_PASS(nng_pub0_open(&pub)); @@ -146,10 +146,10 @@ test_xsub_no_context(void) void test_xsub_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"); @@ -178,7 +178,7 @@ static void test_xsub_recv_closed(void) { nng_socket sub; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open_raw(&sub)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); NUTS_CLOSE(sub); @@ -192,7 +192,7 @@ static void test_xsub_close_recv(void) { nng_socket sub; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open_raw(&sub)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -209,7 +209,7 @@ static void test_xsub_recv_nonblock(void) { nng_socket sub; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open_raw(&sub)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); @@ -341,7 +341,7 @@ static void test_xsub_recv_aio_stopped(void) { nng_socket sub; - nng_aio * aio; + nng_aio *aio; NUTS_PASS(nng_sub0_open_raw(&sub)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); |
