Skip to content

Commit

Permalink
Fix sting usage in _zp_*_info_session
Browse files Browse the repository at this point in the history
+ Formatting fix
  • Loading branch information
sashacmc committed May 28, 2024
1 parent 3a2716f commit b8975a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions examples/mbed/z_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ int main(int argc, char **argv) {
z_get_options_default(&opts);
// Value encoding
if (strcmp(VALUE, "") != 0) {
z_view_string_t value_str;
z_view_str_wrap(&value_str, VALUE);
z_owned_bytes_t payload;
z_bytes_encode_from_string(&payload, z_view_string_loan(&value_str));
opts.payload = &payload;
z_view_string_t value_str;
z_view_str_wrap(&value_str, VALUE);
z_owned_bytes_t payload;
z_bytes_encode_from_string(&payload, z_view_string_loan(&value_str));
opts.payload = &payload;
}
z_owned_closure_reply_t callback;
z_closure_reply(&callback, reply_handler, reply_dropper, NULL);
Expand Down
5 changes: 3 additions & 2 deletions src/transport/multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ void _zp_multicast_info_session(const _z_transport_t *zt, _z_config_t *ps) {
while (xs != NULL) {
_z_transport_peer_entry_t *peer = _z_transport_peer_entry_list_head(xs);
_z_bytes_t remote_zid = _z_bytes_wrap(peer->_remote_zid.id, _z_id_len(peer->_remote_zid));
// TODO(sashacmc): double check!
_zp_config_insert(ps, Z_INFO_PEER_PID_KEY, _z_string_from_bytes(&remote_zid).val);
_z_string_t remote_zid_str = _z_string_from_bytes(&remote_zid);
_zp_config_insert(ps, Z_INFO_PEER_PID_KEY, remote_zid_str.val);
_z_string_clear(&remote_zid_str);

xs = _z_transport_peer_entry_list_tail(xs);
}
Expand Down
7 changes: 4 additions & 3 deletions src/transport/unicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ void _zp_unicast_fetch_zid(const _z_transport_t *zt, z_owned_closure_zid_t *call

void _zp_unicast_info_session(const _z_transport_t *zt, _z_config_t *ps) {
_z_id_t remote_zid = zt->_transport._unicast._remote_zid;
_z_bytes_t remote_zidbytes = _z_bytes_wrap(remote_zid.id, _z_id_len(remote_zid));
// TODO(sashacmc): double check!
_zp_config_insert(ps, Z_INFO_ROUTER_PID_KEY, _z_string_from_bytes(&remote_zidbytes).val);
_z_bytes_t remote_zid_bytes = _z_bytes_wrap(remote_zid.id, _z_id_len(remote_zid));
_z_string_t remote_zid_str = _z_string_from_bytes(&remote_zid_bytes);
_zp_config_insert(ps, Z_INFO_ROUTER_PID_KEY, remote_zid_str.val);
_z_string_clear(&remote_zid_str);
}

#else
Expand Down

0 comments on commit b8975a4

Please sign in to comment.