diff --git a/include/zenoh-pico/api/macros.h b/include/zenoh-pico/api/macros.h index 28b30382e..237876357 100644 --- a/include/zenoh-pico/api/macros.h +++ b/include/zenoh-pico/api/macros.h @@ -294,21 +294,14 @@ * Returns the cloned instance of `x`. */ #define z_clone(x, y) _Generic((x), \ - z_owned_keyexpr_t : z_keyexpr_clone, \ z_owned_session_t : z_session_clone, \ - z_owned_subscriber_t : z_subscriber_clone, \ - z_owned_publisher_t : z_publisher_clone, \ - z_owned_queryable_t : z_queryable_clone, \ z_owned_query_t : z_query_clone, \ z_owned_sample_t : z_sample_clone, \ z_owned_bytes_t : z_bytes_clone, \ z_owned_encoding_t : z_encoding_clone, \ z_owned_reply_err_t : z_reply_err_clone, \ z_owned_reply_t : z_reply_clone, \ - z_owned_hello_t : z_hello_clone, \ - z_owned_string_t : z_string_clone, \ - z_owned_string_array_t : z_string_array_clone, \ - z_owned_config_t : z_config_clone \ + z_owned_string_t : z_string_clone \ )(&x, y) /** diff --git a/include/zenoh-pico/api/primitives.h b/include/zenoh-pico/api/primitives.h index 05c56ad31..69036697d 100644 --- a/include/zenoh-pico/api/primitives.h +++ b/include/zenoh-pico/api/primitives.h @@ -1359,17 +1359,17 @@ _Z_OWNED_FUNCTIONS_DEF(string) _Z_OWNED_FUNCTIONS_DEF(keyexpr) _Z_OWNED_FUNCTIONS_NO_COPY_DEF(config) _Z_OWNED_FUNCTIONS_DEF(session) -_Z_OWNED_FUNCTIONS_DEF(subscriber) -_Z_OWNED_FUNCTIONS_DEF(publisher) -_Z_OWNED_FUNCTIONS_DEF(queryable) -_Z_OWNED_FUNCTIONS_DEF(hello) +_Z_OWNED_FUNCTIONS_NO_COPY_DEF(subscriber) +_Z_OWNED_FUNCTIONS_NO_COPY_DEF(publisher) +_Z_OWNED_FUNCTIONS_NO_COPY_DEF(queryable) +_Z_OWNED_FUNCTIONS_NO_COPY_DEF(hello) _Z_OWNED_FUNCTIONS_DEF(reply) -_Z_OWNED_FUNCTIONS_DEF(string_array) +_Z_OWNED_FUNCTIONS_NO_COPY_DEF(string_array) _Z_OWNED_FUNCTIONS_DEF(sample) _Z_OWNED_FUNCTIONS_DEF(query) _Z_OWNED_FUNCTIONS_DEF(slice) _Z_OWNED_FUNCTIONS_DEF(bytes) -_Z_OWNED_FUNCTIONS_DEF(reply_err) +_Z_OWNED_FUNCTIONS_NO_COPY_DEF(reply_err) _Z_OWNED_FUNCTIONS_DEF(encoding) _Z_OWNED_FUNCTIONS_CLOSURE_DEF(closure_sample) diff --git a/src/api/api.c b/src/api/api.c index e54c85d79..53db43e14 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -117,7 +117,7 @@ int8_t z_keyexpr_as_view_string(const z_loaned_keyexpr_t *keyexpr, z_view_string int8_t z_keyexpr_concat(z_owned_keyexpr_t *key, const z_loaned_keyexpr_t *left, const char *right, size_t len) { z_internal_keyexpr_null(key); if (len == 0) { - return z_keyexpr_clone(key, left); + return _z_keyexpr_copy(&key->_val, left); } else if (right == NULL) { return _Z_ERR_INVALID; } @@ -770,7 +770,7 @@ _Z_OWNED_FUNCTIONS_VALUE_IMPL(_z_string_t, string, _z_string_check, _z_string_nu _Bool _z_value_check(const _z_value_t *value) { return _z_encoding_check(&value->encoding) || _z_bytes_check(&value->payload); } -_Z_OWNED_FUNCTIONS_VALUE_IMPL(_z_value_t, reply_err, _z_value_check, _z_value_null, _z_value_copy, _z_value_clear) +_Z_OWNED_FUNCTIONS_VALUE_NO_COPY_IMPL(_z_value_t, reply_err, _z_value_check, _z_value_null, _z_value_clear) _Z_OWNED_FUNCTIONS_VALUE_IMPL(_z_keyexpr_t, keyexpr, _z_keyexpr_check, _z_keyexpr_null, _z_keyexpr_copy, _z_keyexpr_clear) @@ -778,7 +778,7 @@ _Z_VIEW_FUNCTIONS_IMPL(_z_keyexpr_t, keyexpr, _z_keyexpr_check, _z_keyexpr_null) _Z_VIEW_FUNCTIONS_IMPL(_z_string_t, string, _z_string_check, _z_string_null) _Z_VIEW_FUNCTIONS_IMPL(_z_slice_t, slice, _z_slice_check, _z_slice_empty) -_Z_OWNED_FUNCTIONS_VALUE_IMPL(_z_hello_t, hello, _z_hello_check, _z_hello_null, _z_hello_copy, _z_hello_clear) +_Z_OWNED_FUNCTIONS_VALUE_NO_COPY_IMPL(_z_hello_t, hello, _z_hello_check, _z_hello_null, _z_hello_clear) z_id_t z_hello_zid(const z_loaned_hello_t *hello) { return hello->_zid; } @@ -814,8 +814,8 @@ int8_t _z_string_array_copy(_z_string_svec_t *dst, const _z_string_svec_t *src) return dst->_len == src->_len ? _Z_RES_OK : _Z_ERR_SYSTEM_OUT_OF_MEMORY; } _z_string_svec_t _z_string_array_null(void) { return _z_string_svec_make(0); } -_Z_OWNED_FUNCTIONS_VALUE_IMPL(_z_string_svec_t, string_array, _z_string_array_check, _z_string_array_null, - _z_string_array_copy, _z_string_svec_clear) +_Z_OWNED_FUNCTIONS_VALUE_NO_COPY_IMPL(_z_string_svec_t, string_array, _z_string_array_check, _z_string_array_null, + _z_string_svec_clear) _Z_OWNED_FUNCTIONS_VALUE_IMPL(_z_slice_t, slice, _z_slice_check, _z_slice_empty, _z_slice_copy, _z_slice_clear) _Z_OWNED_FUNCTIONS_VALUE_IMPL(_z_bytes_t, bytes, _z_bytes_check, _z_bytes_null, _z_bytes_copy, _z_bytes_drop)