From e954df67036a21e591c44ad0524216e6f1070404 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Wed, 30 Oct 2024 13:21:35 +0100 Subject: [PATCH] rename loaned_take -> take_loaned --- docs/api.rst | 26 ++++----- include/zenoh-pico/api/macros.h | 88 ++++++++++++++--------------- include/zenoh-pico/api/primitives.h | 2 +- src/api/api.c | 2 +- 4 files changed, 59 insertions(+), 59 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 48b6bf9b7..63c037bb2 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -62,7 +62,7 @@ See details at :ref:`owned_types_concept` .. c:function:: z_loaned_slice_t * z_view_slice_loan_mut(z_view_slice_t * slice) .. c:function:: const z_loaned_slice_t * z_slice_loan(const z_owned_slice_t * slice) .. c:function:: z_loaned_slice_t * z_slice_loan_mut(z_owned_slice_t * slice) -.. c:function:: z_result_t z_slice_loaned_take(z_owned_slice_t *dst, z_loaned_slice_t *src) +.. c:function:: z_result_t z_slice_take_loaned(z_owned_slice_t *dst, z_loaned_slice_t *src) String ------ @@ -108,7 +108,7 @@ See details at :ref:`owned_types_concept` .. c:function:: z_loaned_string_t * z_view_string_loan_mut(z_view_string_t * string) .. c:function:: const z_loaned_string_t * z_string_loan(const z_owned_string_t * string) .. c:function:: z_loaned_string_t * z_string_loan_mut(z_owned_string_t * string) -.. c:function:: z_result_t z_string_loaned_take(z_owned_string_t *dst, z_loaned_string_t *src) +.. c:function:: z_result_t z_string_take_loaned(z_owned_string_t *dst, z_loaned_string_t *src) String Array ------------ @@ -142,7 +142,7 @@ See details at :ref:`owned_types_concept` .. c:function:: void z_string_array_clone(z_owned_string_array_t * dst, const z_loaned_string_array_t * string_array) .. c:function:: const z_loaned_string_array_t * z_string_array_loan(const z_owned_string_array_t * string_array) .. c:function:: z_loaned_string_array_t * z_string_array_loan_mut(z_owned_string_array_t * string_array) -.. c:function:: z_result_t z_string_array_loaned_take(z_owned_string_array_t *dst, z_loaned_string_array_t *src) +.. c:function:: z_result_t z_string_array_take_loaned(z_owned_string_array_t *dst, z_loaned_string_array_t *src) Common @@ -206,7 +206,7 @@ See details at :ref:`owned_types_concept` .. c:function:: z_loaned_keyexpr_t * z_view_keyexpr_loan_mut(z_view_keyexpr_t * keyexpr) .. c:function:: const z_loaned_keyexpr_t * z_keyexpr_loan(const z_owned_keyexpr_t * keyexpr) .. c:function:: z_loaned_keyexpr_t * z_keyexpr_loan_mut(z_owned_keyexpr_t * keyexpr) -.. c:function:: z_result_t z_keyexpr_loaned_take(z_owned_keyexpr_t *dst, z_loaned_keyexpr_t *src) +.. c:function:: z_result_t z_keyexpr_take_loaned(z_owned_keyexpr_t *dst, z_loaned_keyexpr_t *src) Payload ------- @@ -263,13 +263,13 @@ See details at :ref:`owned_types_concept` .. c:function:: void z_bytes_clone(z_owned_bytes_t * dst, const z_loaned_bytes_t * bytes) .. c:function:: const z_loaned_bytes_t * z_bytes_loan(const z_owned_bytes_t * bytes) .. c:function:: z_loaned_bytes_t * z_bytes_loan_mut(z_owned_bytes_t * bytes) -.. c:function:: z_result_t z_bytes_loaned_take(z_owned_bytes_t *dst, z_loaned_bytes_t *src) +.. c:function:: z_result_t z_bytes_take_loaned(z_owned_bytes_t *dst, z_loaned_bytes_t *src) .. c:function:: void z_bytes_writer_drop(z_moved_bytes_writer_t * bytes_writer) .. c:function:: void z_bytes_writer_clone(z_owned_bytes_writer_t * dst, const z_loaned_bytes_writer_t * bytes_writer) .. c:function:: const z_loaned_bytes_writer_t * z_bytes_writer_loan(const z_owned_bytes_writer_t * bytes_writer) .. c:function:: z_loaned_bytes_writer_t * z_bytes_writer_loan_mut(z_owned_bytes_writer_t * bytes_writer) -.. c:function:: z_result_t z_bytes_writer_loaned_take(z_owned_bytes_writer_t *dst, z_loaned_bytes_writer_t *src) +.. c:function:: z_result_t z_bytes_writer_take_loaned(z_owned_bytes_writer_t *dst, z_loaned_bytes_writer_t *src) Encoding -------- @@ -304,7 +304,7 @@ See details at :ref:`owned_types_concept` .. c:function:: void z_encoding_clone(z_owned_encoding_t * dst, const z_loaned_encoding_t * encoding) .. c:function:: const z_loaned_encoding_t * z_encoding_loan(const z_owned_encoding_t * encoding) .. c:function:: z_loaned_encoding_t * z_encoding_loan_mut(z_owned_encoding_t * encoding) -.. c:function:: z_result_t z_encoding_loaned_take(z_owned_encoding_t *dst, z_loaned_encoding_t *src) +.. c:function:: z_result_t z_encoding_take_loaned(z_owned_encoding_t *dst, z_loaned_encoding_t *src) Predefined Encodings @@ -391,7 +391,7 @@ See details at :ref:`owned_types_concept` .. c:function:: void z_reply_err_clone(z_owned_reply_err_t * dst, const z_loaned_reply_err_t * reply_err) .. c:function:: const z_loaned_reply_err_t * z_reply_err_loan(const z_owned_reply_err_t * reply_err) .. c:function:: z_loaned_reply_err_t * z_reply_err_loan_mut(z_owned_reply_err_t * reply_err) -.. c:function:: z_result_t z_reply_err_loaned_take(z_owned_reply_err_t *dst, z_loaned_reply_err_t *src) +.. c:function:: z_result_t z_reply_err_take_loaned(z_owned_reply_err_t *dst, z_loaned_reply_err_t *src) Sample ------ @@ -431,7 +431,7 @@ See details at :ref:`owned_types_concept` .. c:function:: void z_sample_clone(z_owned_sample_t * dst, const z_loaned_sample_t * sample) .. c:function:: const z_loaned_sample_t * z_sample_loan(const z_owned_sample_t * sample) .. c:function:: z_loaned_sample_t * z_sample_loan_mut(z_owned_sample_t * sample) -.. c:function:: z_result_t z_sample_loaned_take(z_owned_sample_t *dst, z_loaned_sample_t *src) +.. c:function:: z_result_t z_sample_take_loaned(z_owned_sample_t *dst, z_loaned_sample_t *src) Timestamp @@ -1112,7 +1112,7 @@ See details at :ref:`owned_types_concept` .. c:function:: void z_query_clone(z_owned_query_t * dst, const z_loaned_query_t * query) .. c:function:: const z_loaned_query_t * z_query_loan(const z_owned_query_t * query) .. c:function:: z_loaned_query_t * z_query_loan_mut(z_owned_query_t * query) -.. c:function:: z_result_t z_query_loaned_take(z_owned_query_t *dst, z_loaned_query_t *src) +.. c:function:: z_result_t z_query_take_loaned(z_owned_query_t *dst, z_loaned_query_t *src) Query ===== @@ -1160,7 +1160,7 @@ See details at :ref:`owned_types_concept` .. c:function:: void z_reply_clone(z_owned_reply_t * dst, const z_loaned_reply_t * reply) .. c:function:: const z_loaned_reply_t * z_reply_loan(const z_owned_reply_t * reply) .. c:function:: z_loaned_reply_t * z_reply_loan_mut(z_owned_reply_t * reply) -.. c:function:: z_result_t z_reply_loaned_take(z_owned_reply_t *dst, z_loaned_reply_t *src) +.. c:function:: z_result_t z_reply_take_loaned(z_owned_reply_t *dst, z_loaned_reply_t *src) Scouting @@ -1200,7 +1200,7 @@ See details at :ref:`owned_types_concept` .. c:function:: void z_hello_clone(z_owned_hello_t * dst, const z_loaned_hello_t * hello) .. c:function:: const z_loaned_hello_t * z_hello_loan(const z_owned_hello_t * hello) .. c:function:: z_loaned_hello_t * z_hello_loan(z_owned_hello_t * hello) -.. c:function:: z_result_t z_hello_loaned_take(z_owned_hello_t *dst, z_loaned_hello_t *src) +.. c:function:: z_result_t z_hello_take_loaned(z_owned_hello_t *dst, z_loaned_hello_t *src) Serialization @@ -1293,7 +1293,7 @@ See details at :ref:`owned_types_concept` .. c:function:: void ze_serializer_clone(ze_owned_serializer_t * dst, const ze_loaned_serializer_t * serializer) .. c:function:: const ze_loaned_serializer_t * ze_serializer_loan(const ze_owned_serializer_t * serializer) .. c:function:: ze_loaned_serializer_t * ze_serializer_loan_mut(ze_owned_serializer_t * serializer) -.. c:function:: z_result_t ze_serializer_loaned_take(ze_owned_serializer_t *dst, ze_loaned_serializer_t *src) +.. c:function:: z_result_t ze_serializer_take_loaned(ze_owned_serializer_t *dst, ze_loaned_serializer_t *src) Others ====== diff --git a/include/zenoh-pico/api/macros.h b/include/zenoh-pico/api/macros.h index 6002bb4e0..cef9c2e51 100644 --- a/include/zenoh-pico/api/macros.h +++ b/include/zenoh-pico/api/macros.h @@ -333,21 +333,21 @@ * Returns: * `0` in case of success, negative error code otherwise. */ -#define z_loaned_take(dst, src) _Generic((dst), \ - z_owned_keyexpr_t* : z_keyexpr_loaned_take, \ - z_owned_query_t* : z_query_loaned_take, \ - z_owned_sample_t* : z_sample_loaned_take, \ - z_owned_bytes_t* : z_bytes_loaned_take, \ - z_owned_encoding_t* : z_encoding_loaned_take, \ - z_owned_reply_err_t* : z_reply_err_loaned_take, \ - z_owned_reply_t* : z_reply_loaned_take, \ - z_owned_hello_t* : z_hello_loaned_take, \ - z_owned_string_t* : z_string_loaned_take, \ - z_owned_slice_t* : z_slice_loaned_take, \ - z_owned_string_array_t* : z_string_array_loaned_take, \ - z_owned_config_t* : z_config_loaned_take \ - z_owned_bytes_writer_t* : z_bytes_writer_loaned_take, \ - ze_owned_serializer_t* : ze_serializer_loaned_take, \ +#define z_take_loaned(dst, src) _Generic((dst), \ + z_owned_keyexpr_t* : z_keyexpr_take_loaned, \ + z_owned_query_t* : z_query_take_loaned, \ + z_owned_sample_t* : z_sample_take_loaned, \ + z_owned_bytes_t* : z_bytes_take_loaned, \ + z_owned_encoding_t* : z_encoding_take_loaned, \ + z_owned_reply_err_t* : z_reply_err_take_loaned, \ + z_owned_reply_t* : z_reply_take_loaned, \ + z_owned_hello_t* : z_hello_take_loaned, \ + z_owned_string_t* : z_string_take_loaned, \ + z_owned_slice_t* : z_slice_take_loaned, \ + z_owned_string_array_t* : z_string_array_take_loaned, \ + z_owned_config_t* : z_config_take_loaned \ + z_owned_bytes_writer_t* : z_bytes_writer_take_loaned, \ + ze_owned_serializer_t* : ze_serializer_take_loaned, \ )(dst, src) /** @@ -757,48 +757,48 @@ inline z_result_t z_clone(z_owned_string_array_t* dst, const z_loaned_string_arr } inline z_result_t z_clone(z_owned_hello_t* dst, const z_loaned_hello_t* this_) { return z_hello_clone(dst, this_); } -// z_loaned_take definition -inline z_result_t z_loaned_take(z_owned_bytes_t* dst, z_loaned_bytes_t* this_) { - return z_bytes_loaned_take(dst, this_); +// z_take_loaned definition +inline z_result_t z_take_loaned(z_owned_bytes_t* dst, z_loaned_bytes_t* this_) { + return z_bytes_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_config_t* dst, z_loaned_config_t* this_) { - return z_config_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_config_t* dst, z_loaned_config_t* this_) { + return z_config_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_encoding_t* dst, z_loaned_encoding_t* this_) { - return z_encoding_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_encoding_t* dst, z_loaned_encoding_t* this_) { + return z_encoding_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_keyexpr_t* dst, z_loaned_keyexpr_t* this_) { - return z_keyexpr_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_keyexpr_t* dst, z_loaned_keyexpr_t* this_) { + return z_keyexpr_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_query_t* dst, z_loaned_query_t* this_) { - return z_query_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_query_t* dst, z_loaned_query_t* this_) { + return z_query_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_reply_t* dst, z_loaned_reply_t* this_) { - return z_reply_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_reply_t* dst, z_loaned_reply_t* this_) { + return z_reply_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_reply_err_t* dst, z_loaned_reply_err_t* this_) { - return z_reply_err_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_reply_err_t* dst, z_loaned_reply_err_t* this_) { + return z_reply_err_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_sample_t* dst, z_loaned_sample_t* this_) { - return z_sample_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_sample_t* dst, z_loaned_sample_t* this_) { + return z_sample_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_slice_t* dst, z_loaned_slice_t* this_) { - return z_slice_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_slice_t* dst, z_loaned_slice_t* this_) { + return z_slice_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_string_t* dst, z_loaned_string_t* this_) { - return z_string_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_string_t* dst, z_loaned_string_t* this_) { + return z_string_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_string_array_t* dst, z_loaned_string_array_t* this_) { - return z_string_array_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_string_array_t* dst, z_loaned_string_array_t* this_) { + return z_string_array_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_hello_t* dst, z_loaned_hello_t* this_) { - return z_hello_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_hello_t* dst, z_loaned_hello_t* this_) { + return z_hello_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(z_owned_bytes_writer_t* dst, z_loaned_bytes_writer_t* this_) { - return z_bytes_writer_loaned_take(dst, this_); +inline z_result_t z_take_loaned(z_owned_bytes_writer_t* dst, z_loaned_bytes_writer_t* this_) { + return z_bytes_writer_take_loaned(dst, this_); } -inline z_result_t z_loaned_take(ze_owned_serializer_t* dst, ze_loaned_serializer_t* this_) { - return ze_serializer_loaned_take(dst, this_); +inline z_result_t z_take_loaned(ze_owned_serializer_t* dst, ze_loaned_serializer_t* this_) { + return ze_serializer_take_loaned(dst, this_); } template diff --git a/include/zenoh-pico/api/primitives.h b/include/zenoh-pico/api/primitives.h index 239fe009d..2a37bdff6 100644 --- a/include/zenoh-pico/api/primitives.h +++ b/include/zenoh-pico/api/primitives.h @@ -1804,7 +1804,7 @@ void z_query_reply_options_default(z_query_reply_options_t *options); z_result_t z_query_reply(const z_loaned_query_t *query, const z_loaned_keyexpr_t *keyexpr, z_moved_bytes_t *payload, const z_query_reply_options_t *options); -z_result_t z_query_loaned_take(z_owned_query_t *dst, z_loaned_query_t *src); +z_result_t z_query_take_loaned(z_owned_query_t *dst, z_loaned_query_t *src); /** * Builds a :c:type:`z_query_reply_del_options_t` with default values. diff --git a/src/api/api.c b/src/api/api.c index 7aba4a8f1..2fa16d256 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -1110,7 +1110,7 @@ bool z_reply_replier_id(const z_loaned_reply_t *reply, z_id_t *out_id) { #if Z_FEATURE_QUERYABLE == 1 _Z_OWNED_FUNCTIONS_RC_IMPL(query) -z_result_t z_query_loaned_take(z_owned_query_t *dst, z_loaned_query_t *src) { +z_result_t z_query_take_loaned(z_owned_query_t *dst, z_loaned_query_t *src) { dst->_rc = *src; _z_query_t q = _z_query_null(); *src = _z_query_rc_new_from_val(&q);