Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove clone for types which do not involve copying #645

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions include/zenoh-pico/api/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,6 @@
*/
#define z_clone(x, y) _Generic((x), \
sashacmc marked this conversation as resolved.
Show resolved Hide resolved
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, \
Expand All @@ -307,6 +303,7 @@
z_owned_reply_t : z_reply_clone, \
z_owned_hello_t : z_hello_clone, \
z_owned_string_t : z_string_clone, \
z_owned_slice_t : z_slice_clone, \
z_owned_string_array_t : z_string_array_clone, \
z_owned_config_t : z_config_clone \
)(&x, y)
Expand Down
8 changes: 4 additions & 4 deletions include/zenoh-pico/api/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -1358,10 +1358,10 @@ int8_t z_closure_zid(z_owned_closure_zid_t *closure, z_id_handler_t call, z_drop
_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_NO_COPY_DEF(session)
_Z_OWNED_FUNCTIONS_NO_COPY_DEF(subscriber)
_Z_OWNED_FUNCTIONS_NO_COPY_DEF(publisher)
_Z_OWNED_FUNCTIONS_NO_COPY_DEF(queryable)
_Z_OWNED_FUNCTIONS_DEF(hello)
_Z_OWNED_FUNCTIONS_DEF(reply)
_Z_OWNED_FUNCTIONS_DEF(string_array)
Expand Down
2 changes: 1 addition & 1 deletion src/api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading