Skip to content

Commit 44c88b8

Browse files
authored
fix: intializer & const init (#29)
1 parent 108ee1d commit 44c88b8

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/zenoh-pico/protocol/definitions/network.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,15 @@ static inline z_congestion_control_t _z_n_qos_get_congestion_control(_z_n_qos_t
9595
(n_qos._val & 0x08) ? Z_CONGESTION_CONTROL_BLOCK : Z_CONGESTION_CONTROL_DROP; // 0b1000
9696
return ret;
9797
}
98-
static inline bool _z_n_qos_get_express(_z_n_qos_t n_qos) { return (bool)(n_qos._val & 0x10 /* 0b10000 */); }
98+
static inline bool _z_n_qos_get_express(_z_n_qos_t n_qos) {
99+
bool ret = (n_qos._val & 0x10) != 0; // 0b10000
100+
return ret;
101+
}
99102
#define _z_n_qos_make(express, nodrop, priority) \
100103
_z_n_qos_create((bool)express, nodrop ? Z_CONGESTION_CONTROL_BLOCK : Z_CONGESTION_CONTROL_DROP, \
101104
(z_priority_t)priority)
102-
static const _z_qos_t _Z_N_QOS_DEFAULT = {._val = 5};
105+
106+
extern const _z_qos_t _Z_N_QOS_DEFAULT;
103107

104108
// RESPONSE FINAL message flags:
105109
// Z Extensions if Z==1 then Zenoh extensions are present

src/protocol/definitions/network.c

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "zenoh-pico/protocol/definitions/message.h"
2020
#include "zenoh-pico/utils/logging.h"
2121

22+
const _z_qos_t _Z_N_QOS_DEFAULT = {._val = 5};
23+
2224
_z_n_msg_request_exts_t _z_n_msg_request_needed_exts(const _z_n_msg_request_t *msg) {
2325
_z_n_msg_request_exts_t ret = {.n = 0,
2426
.ext_budget = msg->_ext_budget != 0,

0 commit comments

Comments
 (0)