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/core/stream.c | |
| 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/core/stream.c')
| -rw-r--r-- | src/core/stream.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/stream.c b/src/core/stream.c index 61a8a3ba..572f28d1 100644 --- a/src/core/stream.c +++ b/src/core/stream.c @@ -368,7 +368,7 @@ nng_stream_get_size(nng_stream *s, const char *n, size_t *v) } nng_err -nng_stream_get_string(nng_stream *s, const char *n, char **v) +nng_stream_get_string(nng_stream *s, const char *n, const char **v) { return (nni_stream_get(s, n, v, NULL, NNI_TYPE_STRING)); } @@ -413,7 +413,8 @@ nng_stream_dialer_get_size(nng_stream_dialer *d, const char *n, size_t *v) } nng_err -nng_stream_dialer_get_string(nng_stream_dialer *d, const char *n, char **v) +nng_stream_dialer_get_string( + nng_stream_dialer *d, const char *n, const char **v) { return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_STRING)); } @@ -456,7 +457,8 @@ nng_stream_listener_get_size(nng_stream_listener *l, const char *n, size_t *v) } nng_err -nng_stream_listener_get_string(nng_stream_listener *l, const char *n, char **v) +nng_stream_listener_get_string( + nng_stream_listener *l, const char *n, const char **v) { return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_STRING)); } |
