Skip to content

Commit

Permalink
Merge pull request #645 from ZettaScaleLabs/remove_legacy_clone
Browse files Browse the repository at this point in the history
Remove clone for types which do not involve copying
  • Loading branch information
milyin authored Sep 11, 2024
2 parents 8a5f1bb + 2a8b174 commit 21aeda9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
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), \
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 @@ -1335,10 +1335,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

0 comments on commit 21aeda9

Please sign in to comment.