Skip to content

Commit

Permalink
fix: intializer & const init (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland authored Dec 5, 2024
1 parent 108ee1d commit 44c88b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/zenoh-pico/protocol/definitions/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,15 @@ static inline z_congestion_control_t _z_n_qos_get_congestion_control(_z_n_qos_t
(n_qos._val & 0x08) ? Z_CONGESTION_CONTROL_BLOCK : Z_CONGESTION_CONTROL_DROP; // 0b1000
return ret;
}
static inline bool _z_n_qos_get_express(_z_n_qos_t n_qos) { return (bool)(n_qos._val & 0x10 /* 0b10000 */); }
static inline bool _z_n_qos_get_express(_z_n_qos_t n_qos) {
bool ret = (n_qos._val & 0x10) != 0; // 0b10000
return ret;
}
#define _z_n_qos_make(express, nodrop, priority) \
_z_n_qos_create((bool)express, nodrop ? Z_CONGESTION_CONTROL_BLOCK : Z_CONGESTION_CONTROL_DROP, \
(z_priority_t)priority)
static const _z_qos_t _Z_N_QOS_DEFAULT = {._val = 5};

extern const _z_qos_t _Z_N_QOS_DEFAULT;

// RESPONSE FINAL message flags:
// Z Extensions if Z==1 then Zenoh extensions are present
Expand Down
2 changes: 2 additions & 0 deletions src/protocol/definitions/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "zenoh-pico/protocol/definitions/message.h"
#include "zenoh-pico/utils/logging.h"

const _z_qos_t _Z_N_QOS_DEFAULT = {._val = 5};

_z_n_msg_request_exts_t _z_n_msg_request_needed_exts(const _z_n_msg_request_t *msg) {
_z_n_msg_request_exts_t ret = {.n = 0,
.ext_budget = msg->_ext_budget != 0,
Expand Down

0 comments on commit 44c88b8

Please sign in to comment.