diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-24 08:53:12 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-24 08:58:30 -0800 |
| commit | cc3b5fe459d277ee46277bc26301249f57855470 (patch) | |
| tree | 6a8b55a5a3b5cc4328f605965950446fb46695fa | |
| parent | 895ea654581ef9928e554366fbd93f613a049017 (diff) | |
| download | nng-cc3b5fe459d277ee46277bc26301249f57855470.tar.gz nng-cc3b5fe459d277ee46277bc26301249f57855470.tar.bz2 nng-cc3b5fe459d277ee46277bc26301249f57855470.zip | |
socket: remove unused nng_socket_get_ptr and nng_socket_set_ptr.
We will be removing these pointer based functions more generally
as we we have type-specific accessors instead.
We also removed the context versions of these functions, which were
not previously documented.
| -rw-r--r-- | docs/man/nng_socket_get.3.adoc | 13 | ||||
| -rw-r--r-- | docs/man/nng_socket_set.3.adoc | 17 | ||||
| -rw-r--r-- | docs/ref/migrate/nng1.md | 8 | ||||
| -rw-r--r-- | include/nng/nng.h | 3 | ||||
| -rw-r--r-- | src/nng.c | 24 |
5 files changed, 8 insertions, 57 deletions
diff --git a/docs/man/nng_socket_get.3.adoc b/docs/man/nng_socket_get.3.adoc index cca1dc5a..f510eb39 100644 --- a/docs/man/nng_socket_get.3.adoc +++ b/docs/man/nng_socket_get.3.adoc @@ -29,8 +29,6 @@ int nng_socket_get_uint64(nng_socket s, const char *opt, uint64_t *u64p); int nng_socket_get_string(nng_socket s, const char *opt, char **strp); -int nng_socket_get_ptr(nng_socket s, const char *opt, void **ptr); - int nng_socket_get_ms(nng_socket s, const char *opt, nng_duration *durp); int nng_socket_get_addr(nng_socket s, const char *opt, nng_sockaddr *addrp); @@ -47,11 +45,6 @@ A number of them are documented in xref:nng_options.5.adoc[nng_options(5)]. Additionally protocol-specific options are documented with the protocols themselves. -IMPORTANT: Access to transport options via this function is deprecated, and may be -removed from a future release. Applications should instead make use of -xref:nng_dialer_get.3.adoc[nng_dialer_get] or -xref:nng_listener_get.3.adoc[nng_listener_get] for specific dialers or listeners. - === Forms In all of these forms, the option _opt_ is retrieved from the socket _s_. @@ -74,12 +67,6 @@ This function is used to retrieve time xref:nng_duration.5.adoc[durations] (The special value ((`NNG_DURATION_INFINITE`)) means an infinite amount of time, and the special value ((`NNG_DURATION_DEFAULT`)) means a context-specific default.) -`nng_socket_get_ptr()`:: -This function is used to retrieve a pointer, _ptr_, to structured data. -The data referenced by _ptr_ is generally managed using other functions. -Note that this form is somewhat special in that the object is generally -not copied, but instead the *pointer* to the object is copied. - `nng_socket_get_size()`:: This function is used to retrieve a size into the pointer _zp_, typically for buffer sizes, message maximum sizes, and similar options. diff --git a/docs/man/nng_socket_set.3.adoc b/docs/man/nng_socket_set.3.adoc index bd3f7f47..b787436f 100644 --- a/docs/man/nng_socket_set.3.adoc +++ b/docs/man/nng_socket_set.3.adoc @@ -25,8 +25,6 @@ int nng_socket_set_int(nng_socket s, const char *opt, int ival); int nng_socket_set_ms(nng_socket s, const char *opt, nng_duration dur); -int nng_socket_set_ptr(nng_socket s, const char *opt, void *ptr); - int nng_socket_set_size(nng_socket s, const char *opt, size_t z); int nng_socket_set_string(nng_socket s, const char *opt, const char *str); @@ -44,11 +42,6 @@ A number of them are documented in xref:nng_options.5.adoc[nng_options(5)]. Protocol-specific options are documented with the protocol in question. -IMPORTANT: Access to transport options via this function is deprecated, and may be -removed from a future release. Applications should instead make use of -xref:nng_dialer_set.3.adoc[nng_dialer_get] or -xref:nng_listener_set.3.adoc[nng_listener_get] for specific dialers or listeners. - === Forms The details of the type, size, and semantics of the option will depend @@ -67,16 +60,6 @@ This function is used to configure time durations (such as timeouts) using type xref:nng_duration.5.adoc[`nng_duration`]. The duration _dur_ is an integer number of milliseconds. -`nng_socket_set_ptr()`:: -This function is used to pass a pointer, _ptr_, to structured data. -The data referenced by _ptr_ is generally managed by other functions. -For example, TLS configuration objects created with -(xref:nng_tls_config_alloc.3tls.adoc[`nng_tls_config_alloc()`]) -can be passed this way. - -NOTE: This form is somewhat special in that the object is generally -not copied, but instead the *pointer* to the object is copied. - `nng_socket_set_size()`:: This function is used to configure a size, _z_, typically for buffer sizes, message maximum sizes, and similar options. diff --git a/docs/ref/migrate/nng1.md b/docs/ref/migrate/nng1.md index cb7bc539..f704c1f6 100644 --- a/docs/ref/migrate/nng1.md +++ b/docs/ref/migrate/nng1.md @@ -87,6 +87,14 @@ The `_getopt` and `_setopt` functions for contexts, listeners, and dialers are n present. Simply changing `_getopt` to `_get` or `_setopt` to `_set` in the function name should be sufficient in most cases. +The following functions served no useful purpose (after other changes described in this document), +and are thus removed: + +- `nng_socket_get_ptr` +- `nng_socket_set_ptr` +- `nng_ctx_get_ptr` (not documented) +- `nng_ctx_set_ptr` (not documented) + ## Untyped Option Functions Removed The following functions are removed. To access options, use a proper typed access function, diff --git a/include/nng/nng.h b/include/nng/nng.h index 020a3add..88b4e390 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -231,7 +231,6 @@ NNG_DECL int nng_socket_set_int(nng_socket, const char *, int); NNG_DECL int nng_socket_set_size(nng_socket, const char *, size_t); NNG_DECL int nng_socket_set_uint64(nng_socket, const char *, uint64_t); NNG_DECL int nng_socket_set_string(nng_socket, const char *, const char *); -NNG_DECL int nng_socket_set_ptr(nng_socket, const char *, void *); NNG_DECL int nng_socket_set_ms(nng_socket, const char *, nng_duration); NNG_DECL int nng_socket_get_bool(nng_socket, const char *, bool *); @@ -239,7 +238,6 @@ NNG_DECL int nng_socket_get_int(nng_socket, const char *, int *); NNG_DECL int nng_socket_get_size(nng_socket, const char *, size_t *); NNG_DECL int nng_socket_get_uint64(nng_socket, const char *, uint64_t *); NNG_DECL int nng_socket_get_string(nng_socket, const char *, char **); -NNG_DECL int nng_socket_get_ptr(nng_socket, const char *, void **); NNG_DECL int nng_socket_get_ms(nng_socket, const char *, nng_duration *); // These functions are used to obtain a file descriptor that will poll @@ -488,7 +486,6 @@ NNG_DECL int nng_ctx_get_int(nng_ctx, const char *, int *); NNG_DECL int nng_ctx_get_size(nng_ctx, const char *, size_t *); NNG_DECL int nng_ctx_get_uint64(nng_ctx, const char *, uint64_t *); NNG_DECL int nng_ctx_get_string(nng_ctx, const char *, char **); -NNG_DECL int nng_ctx_get_ptr(nng_ctx, const char *, void **); NNG_DECL int nng_ctx_get_ms(nng_ctx, const char *, nng_duration *); NNG_DECL int nng_ctx_set(nng_ctx, const char *, const void *, size_t); @@ -442,12 +442,6 @@ nng_ctx_get_string(nng_ctx id, const char *n, char **v) } int -nng_ctx_get_ptr(nng_ctx id, const char *n, void **v) -{ - return (ctx_get(id, n, v, NULL, NNI_TYPE_POINTER)); -} - -int nng_ctx_get_ms(nng_ctx id, const char *n, nng_duration *v) { return (ctx_get(id, n, v, NULL, NNI_TYPE_DURATION)); @@ -498,12 +492,6 @@ nng_ctx_set_ms(nng_ctx id, const char *n, nng_duration v) } int -nng_ctx_set_ptr(nng_ctx id, const char *n, void *v) -{ - return (ctx_set(id, n, &v, sizeof(v), NNI_TYPE_POINTER)); -} - -int nng_ctx_set_string(nng_ctx id, const char *n, const char *v) { return ( @@ -1146,12 +1134,6 @@ nng_socket_set_ms(nng_socket id, const char *n, nng_duration v) } int -nng_socket_set_ptr(nng_socket id, const char *n, void *v) -{ - return (socket_set(id, n, &v, sizeof(v), NNI_TYPE_POINTER)); -} - -int nng_socket_set_string(nng_socket id, const char *n, const char *v) { return (socket_set( @@ -1203,12 +1185,6 @@ nng_socket_get_string(nng_socket id, const char *n, char **v) } int -nng_socket_get_ptr(nng_socket id, const char *n, void **v) -{ - return (socket_get(id, n, v, NULL, NNI_TYPE_POINTER)); -} - -int nng_socket_get_ms(nng_socket id, const char *n, nng_duration *v) { return (socket_get(id, n, v, NULL, NNI_TYPE_DURATION)); |
