Skip to content

Commit

Permalink
fix: use same time in the struct to reduce size
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Nov 17, 2023
1 parent 16d5e3f commit 52cdb36
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions include/zenoh-pico/link/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ typedef enum {
* reserved: 4 bits, reserved for futur use
*/
typedef struct _z_link_capabilities_t {
_z_link_cap_transport_t _transport : 2;
_z_link_cap_flow_t _flow : 1;
_Bool _is_reliable : 1;
uint8_t _transport : 2;
uint8_t _flow : 1;
uint8_t _is_reliable : 1;
uint8_t _reserved : 4;
} _z_link_capabilities_t;

Expand Down
4 changes: 2 additions & 2 deletions include/zenoh-pico/transport/common/tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include "zenoh-pico/net/session.h"
#include "zenoh-pico/transport/transport.h"

void __unsafe_z_prepare_wbuf(_z_wbuf_t *buf, _z_link_cap_flow_t flow);
void __unsafe_z_finalize_wbuf(_z_wbuf_t *buf, _z_link_cap_flow_t flow);
void __unsafe_z_prepare_wbuf(_z_wbuf_t *buf, uint8_t link_flow_capability);
void __unsafe_z_finalize_wbuf(_z_wbuf_t *buf, uint8_t link_flow_capability);
/*This function is unsafe because it operates in potentially concurrent
data.*Make sure that the following mutexes are locked before calling this function : *-ztu->mutex_tx */
int8_t __unsafe_z_serialize_zenoh_fragment(_z_wbuf_t *dst, _z_wbuf_t *src, z_reliability_t reliability, size_t sn);
Expand Down
8 changes: 4 additions & 4 deletions src/transport/common/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
* Make sure that the following mutexes are locked before calling this function:
* - ztu->mutex_tx
*/
void __unsafe_z_prepare_wbuf(_z_wbuf_t *buf, _z_link_cap_flow_t flow) {
void __unsafe_z_prepare_wbuf(_z_wbuf_t *buf, uint8_t link_flow_capability) {
_z_wbuf_reset(buf);

switch (flow) {
switch (link_flow_capability) {
// Stream capable links
case Z_LINK_CAP_FLOW_STREAM:
for (uint8_t i = 0; i < _Z_MSG_LEN_ENC_SIZE; i++) {
Expand All @@ -50,8 +50,8 @@ void __unsafe_z_prepare_wbuf(_z_wbuf_t *buf, _z_link_cap_flow_t flow) {
* Make sure that the following mutexes are locked before calling this function:
* - ztu->mutex_tx
*/
void __unsafe_z_finalize_wbuf(_z_wbuf_t *buf, _z_link_cap_flow_t flow) {
switch (flow) {
void __unsafe_z_finalize_wbuf(_z_wbuf_t *buf, uint8_t link_flow_capability) {
switch (link_flow_capability) {
// Stream capable links
case Z_LINK_CAP_FLOW_STREAM: {
size_t len = _z_wbuf_len(buf) - _Z_MSG_LEN_ENC_SIZE;
Expand Down

0 comments on commit 52cdb36

Please sign in to comment.