diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-10-07 20:03:32 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-10-07 20:03:32 -0700 |
| commit | 3971d119c129bf5685f9fd14d0f1f785581c3565 (patch) | |
| tree | 12b08c053d07fab5af699229ef52e311b8182d56 /src/supplemental | |
| parent | 07191755f3a38cbac48d15523095136f69d8f772 (diff) | |
| download | nng-3971d119c129bf5685f9fd14d0f1f785581c3565.tar.gz nng-3971d119c129bf5685f9fd14d0f1f785581c3565.tar.bz2 nng-3971d119c129bf5685f9fd14d0f1f785581c3565.zip | |
options: string options are passed by reference
This avoids needless allocations, and we offer for pipes (which need
this because they might be ephemeral) the get_strdup, get_strcpy,
and get_strlen forms. (Those do the copying or allocations while holding
the pipe reference.)
Diffstat (limited to 'src/supplemental')
| -rw-r--r-- | src/supplemental/websocket/websocket_test.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/supplemental/websocket/websocket_test.c b/src/supplemental/websocket/websocket_test.c index 98bcf658..cb502ef4 100644 --- a/src/supplemental/websocket/websocket_test.c +++ b/src/supplemental/websocket/websocket_test.c @@ -13,7 +13,7 @@ #include "sha1.h" -#include <nuts.h> +#include "../../testing/nuts.h" void test_websocket_wildcard(void) @@ -138,7 +138,7 @@ test_websocket_conn_props(void) nng_stream *c2 = NULL; char uri[64]; bool on; - char *str; + const char *str; uint16_t port; int rv; @@ -208,18 +208,14 @@ test_websocket_conn_props(void) NUTS_PASS( nng_stream_get_string(c1, NNG_OPT_WS_HEADER "NNG-Req", &str)); NUTS_MATCH(str, "True"); - nng_strfree(str); NUTS_PASS( nng_stream_get_string(c2, NNG_OPT_WS_HEADER "NNG-Rep", &str)); NUTS_MATCH(str, "True"); - nng_strfree(str); NUTS_PASS(nng_stream_get_string( c1, NNG_OPT_WS_HEADER "Sec-WebSocket-Version", &str)); - NUTS_TRUE(str != NULL); - NUTS_TRUE(strcmp(str, "13") == 0); - nng_strfree(str); + NUTS_MATCH(str, "13"); nng_stream_close(c1); nng_stream_close(c2); |
