diff --git a/src/link/link.c b/src/link/link.c index e60159564..9f725ee9c 100644 --- a/src/link/link.c +++ b/src/link/link.c @@ -153,17 +153,8 @@ size_t _z_link_recv_exact_zbuf(const _z_link_t *link, _z_zbuf_t *zbf, size_t len z_result_t _z_link_send_wbuf(const _z_link_t *link, const _z_wbuf_t *wbf) { z_result_t ret = _Z_RES_OK; - bool link_is_streamed; - - switch (link->_cap._flow) { - case Z_LINK_CAP_FLOW_STREAM: - link_is_streamed = true; - break; - case Z_LINK_CAP_FLOW_DATAGRAM: - default: - link_is_streamed = false; - break; - } + bool link_is_streamed = link->_cap._flow == Z_LINK_CAP_FLOW_STREAM; + for (size_t i = 0; (i < _z_wbuf_len_iosli(wbf)) && (ret == _Z_RES_OK); i++) { _z_slice_t bs = _z_iosli_to_bytes(_z_wbuf_get_iosli(wbf, i)); size_t n = bs.len; diff --git a/src/session/utils.c b/src/session/utils.c index 9ff2a5d41..05d8da358 100644 --- a/src/session/utils.c +++ b/src/session/utils.c @@ -26,18 +26,10 @@ #include "zenoh-pico/utils/logging.h" /*------------------ clone helpers ------------------*/ -_z_timestamp_t _z_timestamp_duplicate(const _z_timestamp_t *tstamp) { - _z_timestamp_t ts; - ts.valid = tstamp->valid; - ts.id = tstamp->id; - ts.time = tstamp->time; - return ts; -} +_z_timestamp_t _z_timestamp_duplicate(const _z_timestamp_t *tstamp) { return *tstamp; } void _z_timestamp_move(_z_timestamp_t *dst, _z_timestamp_t *src) { - dst->valid = src->valid; - dst->id = src->id; - dst->time = src->time; + *dst = *src; _z_timestamp_clear(src); }