Skip to content

Commit

Permalink
Remove clone for types which do not involve copying
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Sep 11, 2024
1 parent 3ea3059 commit ba9d97d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 0 additions & 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 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

0 comments on commit ba9d97d

Please sign in to comment.