From 7c9e30be1d6403122a21d62f2198352975aa4af2 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Tue, 17 Sep 2024 10:50:45 +0200 Subject: [PATCH 1/7] replace _Bool with bool to make c++ compiler happy --- examples/unix/c11/z_get_attachment.c | 2 +- examples/unix/c11/z_pub_attachment.c | 2 +- examples/unix/c11/z_queryable_attachment.c | 2 +- include/zenoh-pico/api/handlers.h | 186 +++++++++--------- include/zenoh-pico/api/olv_macros.h | 96 ++++----- include/zenoh-pico/api/primitives.h | 20 +- include/zenoh-pico/api/types.h | 30 +-- include/zenoh-pico/collections/arc_slice.h | 2 +- include/zenoh-pico/collections/array.h | 2 +- include/zenoh-pico/collections/bytes.h | 4 +- include/zenoh-pico/collections/element.h | 4 +- include/zenoh-pico/collections/fifo.h | 8 +- include/zenoh-pico/collections/fifo_mt.h | 2 +- include/zenoh-pico/collections/intmap.h | 90 ++++----- include/zenoh-pico/collections/lifo.h | 8 +- include/zenoh-pico/collections/list.h | 4 +- include/zenoh-pico/collections/refcount.h | 14 +- include/zenoh-pico/collections/ring_mt.h | 2 +- include/zenoh-pico/collections/slice.h | 10 +- include/zenoh-pico/collections/string.h | 8 +- include/zenoh-pico/collections/vec.h | 14 +- include/zenoh-pico/config.h | 2 +- include/zenoh-pico/link/endpoint.h | 2 +- include/zenoh-pico/net/encoding.h | 2 +- include/zenoh-pico/net/filtering.h | 2 +- include/zenoh-pico/net/primitives.h | 10 +- include/zenoh-pico/net/publish.h | 4 +- include/zenoh-pico/net/query.h | 4 +- include/zenoh-pico/net/reply.h | 2 +- include/zenoh-pico/net/sample.h | 2 +- include/zenoh-pico/net/subscribe.h | 2 +- include/zenoh-pico/protocol/codec/core.h | 4 +- include/zenoh-pico/protocol/codec/ext.h | 6 +- include/zenoh-pico/protocol/codec/interest.h | 4 +- include/zenoh-pico/protocol/core.h | 12 +- .../protocol/definitions/declarations.h | 6 +- .../zenoh-pico/protocol/definitions/message.h | 8 +- .../zenoh-pico/protocol/definitions/network.h | 27 ++- .../protocol/definitions/transport.h | 8 +- include/zenoh-pico/protocol/iobuf.h | 6 +- include/zenoh-pico/protocol/keyexpr.h | 10 +- include/zenoh-pico/session/session.h | 14 +- include/zenoh-pico/session/utils.h | 2 +- include/zenoh-pico/system/link/raweth.h | 4 +- .../system/platform/arduino/opencr.h | 4 +- include/zenoh-pico/system/platform/espidf.h | 2 +- .../system/platform/freertos_plus_tcp.h | 2 +- include/zenoh-pico/system/platform/mbed.h | 4 +- .../transport/multicast/transport.h | 2 +- include/zenoh-pico/transport/transport.h | 20 +- .../zenoh-pico/transport/unicast/transport.h | 2 +- include/zenoh-pico/transport/utils.h | 2 +- include/zenoh-pico/utils/string.h | 2 +- src/api/api.c | 34 ++-- src/collections/arc_slice.c | 2 +- src/collections/bytes.c | 4 +- src/collections/intmap.c | 4 +- src/collections/lifo.c | 4 +- src/collections/list.c | 2 +- src/collections/refcount.c | 4 +- src/collections/slice.c | 8 +- src/collections/string.c | 8 +- src/collections/vec.c | 6 +- src/link/endpoint.c | 4 +- src/link/link.c | 2 +- src/net/encoding.c | 2 +- src/net/filtering.c | 4 +- src/net/memory.c | 2 +- src/net/primitives.c | 10 +- src/net/publish.c | 2 +- src/net/query.c | 2 +- src/net/reply.c | 2 +- src/net/sample.c | 2 +- src/net/subscribe.c | 2 +- src/protocol/codec.c | 4 +- src/protocol/codec/declarations.c | 18 +- src/protocol/codec/ext.c | 8 +- src/protocol/codec/interest.c | 6 +- src/protocol/codec/message.c | 30 +-- src/protocol/codec/network.c | 26 +-- src/protocol/config.c | 2 +- src/protocol/core.c | 4 +- src/protocol/definitions/declarations.c | 2 +- src/protocol/definitions/network.c | 4 +- src/protocol/definitions/transport.c | 6 +- src/protocol/iobuf.c | 4 +- src/protocol/keyexpr.c | 68 ++++--- src/session/interest.c | 4 +- src/session/query.c | 4 +- src/session/queryable.c | 2 +- src/session/resource.c | 6 +- src/session/rx.c | 2 +- src/session/scout.c | 4 +- src/session/subscription.c | 2 +- src/session/utils.c | 2 +- src/system/unix/link/raweth.c | 2 +- src/transport/common/tx.c | 2 +- src/transport/multicast/rx.c | 2 +- src/transport/multicast/transport.c | 4 +- src/transport/multicast/tx.c | 4 +- src/transport/peer_entry.c | 4 +- src/transport/raweth/link.c | 20 +- src/transport/raweth/rx.c | 2 +- src/transport/raweth/tx.c | 2 +- src/transport/transport.c | 2 +- src/transport/unicast/rx.c | 2 +- src/transport/unicast/transport.c | 6 +- src/transport/unicast/tx.c | 4 +- src/transport/utils.c | 2 +- src/utils/string.c | 4 +- tests/z_api_alignment_test.c | 2 +- tests/z_api_bytes_test.c | 6 +- tests/z_iobuf_test.c | 2 +- tests/z_keyexpr_test.c | 2 +- tests/z_msgcodec_test.c | 14 +- tests/z_peer_multicast_test.c | 2 +- zenohpico.pc | 2 +- 117 files changed, 550 insertions(+), 553 deletions(-) diff --git a/examples/unix/c11/z_get_attachment.c b/examples/unix/c11/z_get_attachment.c index a24ee6f13..14f33524a 100644 --- a/examples/unix/c11/z_get_attachment.c +++ b/examples/unix/c11/z_get_attachment.c @@ -46,7 +46,7 @@ typedef struct kv_pairs_rx_t { static z_owned_condvar_t cond; static z_owned_mutex_t mutex; -_Bool create_attachment_iter(z_owned_bytes_t *kv_pair, void *context) { +bool create_attachment_iter(z_owned_bytes_t *kv_pair, void *context) { kv_pairs_tx_t *kvs = (kv_pairs_tx_t *)(context); z_owned_bytes_t k, v; if (kvs->current_idx >= kvs->len) { diff --git a/examples/unix/c11/z_pub_attachment.c b/examples/unix/c11/z_pub_attachment.c index ad5f96875..41deb9270 100644 --- a/examples/unix/c11/z_pub_attachment.c +++ b/examples/unix/c11/z_pub_attachment.c @@ -36,7 +36,7 @@ typedef struct kv_pairs_t { #if Z_FEATURE_PUBLICATION == 1 -_Bool create_attachment_iter(z_owned_bytes_t *kv_pair, void *context) { +bool create_attachment_iter(z_owned_bytes_t *kv_pair, void *context) { kv_pairs_t *kvs = (kv_pairs_t *)(context); z_owned_bytes_t k, v; if (kvs->current_idx >= kvs->len) { diff --git a/examples/unix/c11/z_queryable_attachment.c b/examples/unix/c11/z_queryable_attachment.c index 78dff9b16..7533f14e7 100644 --- a/examples/unix/c11/z_queryable_attachment.c +++ b/examples/unix/c11/z_queryable_attachment.c @@ -58,7 +58,7 @@ size_t kv_pairs_size(kv_pairs_tx_t *kvp) { return ret; } -_Bool create_attachment_iter(z_owned_bytes_t *kv_pair, void *context) { +bool create_attachment_iter(z_owned_bytes_t *kv_pair, void *context) { kv_pairs_tx_t *kvs = (kv_pairs_tx_t *)(context); z_owned_bytes_t k, v; if (kvs->current_idx >= kvs->len) { diff --git a/include/zenoh-pico/api/handlers.h b/include/zenoh-pico/api/handlers.h index 60c59423d..d578e24a9 100644 --- a/include/zenoh-pico/api/handlers.h +++ b/include/zenoh-pico/api/handlers.h @@ -28,99 +28,99 @@ extern "C" { #endif // -- Channel -#define _Z_CHANNEL_DEFINE_IMPL(handler_type, handler_name, handler_new_f_name, callback_type, callback_new_f, \ - collection_type, collection_new_f, collection_free_f, collection_push_f, \ - collection_pull_f, collection_try_pull_f, collection_close_f, elem_owned_type, \ - elem_loaned_type, elem_clone_f, elem_move_f, elem_drop_f, elem_null_f) \ - typedef struct { \ - collection_type *collection; \ - } handler_type; \ - \ - _Z_OWNED_TYPE_VALUE(handler_type, handler_name) \ - \ - static inline void _z_##handler_name##_elem_free(void **elem) { \ - elem_drop_f(elem_move_f((elem_owned_type *)*elem)); \ - z_free(*elem); \ - *elem = NULL; \ - } \ - static inline void _z_##handler_name##_elem_move(void *dst, void *src) { \ - memcpy(dst, src, sizeof(elem_owned_type)); \ - z_free(src); \ - } \ - static inline void _z_##handler_name##_close(void *context) { \ - int8_t ret = collection_close_f((collection_type *)context); \ - if (ret < 0) { \ - _Z_ERROR("%s failed: %i", #collection_push_f, ret); \ - } \ - } \ - static inline void _z_##handler_name##_send(elem_loaned_type *elem, void *context) { \ - elem_owned_type *internal_elem = (elem_owned_type *)z_malloc(sizeof(elem_owned_type)); \ - if (internal_elem == NULL) { \ - _Z_ERROR("Out of memory"); \ - return; \ - } \ - elem_clone_f(internal_elem, elem); \ - int8_t ret = collection_push_f(internal_elem, context, _z_##handler_name##_elem_free); \ - if (ret != _Z_RES_OK) { \ - _Z_ERROR("%s failed: %i", #collection_push_f, ret); \ - } \ - } \ - static inline int8_t z_##handler_name##_recv(const z_loaned_##handler_name##_t *handler, elem_owned_type *elem) { \ - elem_null_f(elem); \ - int8_t ret = collection_pull_f(elem, (collection_type *)handler->collection, _z_##handler_name##_elem_move); \ - if (ret == _Z_RES_CHANNEL_CLOSED) { \ - return Z_CHANNEL_DISCONNECTED; \ - } \ - if (ret != _Z_RES_OK) { \ - _Z_ERROR("%s failed: %i", #collection_pull_f, ret); \ - return ret; \ - } \ - return _Z_RES_OK; \ - } \ - static inline int8_t z_##handler_name##_try_recv(const z_loaned_##handler_name##_t *handler, \ - elem_owned_type *elem) { \ - elem_null_f(elem); \ - int8_t ret = \ - collection_try_pull_f(elem, (collection_type *)handler->collection, _z_##handler_name##_elem_move); \ - if (ret == _Z_RES_CHANNEL_CLOSED) { \ - return Z_CHANNEL_DISCONNECTED; \ - } else if (ret == _Z_RES_CHANNEL_NODATA) { \ - return Z_CHANNEL_NODATA; \ - } \ - if (ret != _Z_RES_OK) { \ - _Z_ERROR("%s failed: %i", #collection_try_pull_f, ret); \ - return ret; \ - } \ - return _Z_RES_OK; \ - } \ - \ - static inline void _z_##handler_name##_clear(handler_type *handler) { \ - if (handler != NULL && handler->collection != NULL) { \ - collection_free_f(handler->collection, _z_##handler_name##_elem_free); \ - handler->collection = NULL; \ - } \ - } \ - static inline _Bool _z_##handler_name##_check(const handler_type *handler) { return handler->collection == NULL; } \ - static inline handler_type _z_##handler_name##_null(void) { \ - handler_type h; \ - h.collection = NULL; \ - return h; \ - } \ - \ - _Z_OWNED_FUNCTIONS_VALUE_NO_COPY_INLINE_IMPL(handler_type, handler_name, _z_##handler_name##_check, \ - _z_##handler_name##_null, _z_##handler_name##_clear) \ - \ - static inline int8_t handler_new_f_name(callback_type *callback, z_owned_##handler_name##_t *handler, \ - size_t capacity) { \ - if (capacity < 1) { \ - return _Z_ERR_INVALID; \ - } \ - handler->_val.collection = collection_new_f(capacity); \ - if (handler->_val.collection == NULL) { \ - return _Z_ERR_SYSTEM_OUT_OF_MEMORY; \ - } \ - callback_new_f(callback, _z_##handler_name##_send, _z_##handler_name##_close, handler->_val.collection); \ - return _Z_RES_OK; \ +#define _Z_CHANNEL_DEFINE_IMPL(handler_type, handler_name, handler_new_f_name, callback_type, callback_new_f, \ + collection_type, collection_new_f, collection_free_f, collection_push_f, \ + collection_pull_f, collection_try_pull_f, collection_close_f, elem_owned_type, \ + elem_loaned_type, elem_clone_f, elem_move_f, elem_drop_f, elem_null_f) \ + typedef struct { \ + collection_type *collection; \ + } handler_type; \ + \ + _Z_OWNED_TYPE_VALUE(handler_type, handler_name) \ + \ + static inline void _z_##handler_name##_elem_free(void **elem) { \ + elem_drop_f(elem_move_f((elem_owned_type *)*elem)); \ + z_free(*elem); \ + *elem = NULL; \ + } \ + static inline void _z_##handler_name##_elem_move(void *dst, void *src) { \ + memcpy(dst, src, sizeof(elem_owned_type)); \ + z_free(src); \ + } \ + static inline void _z_##handler_name##_close(void *context) { \ + int8_t ret = collection_close_f((collection_type *)context); \ + if (ret < 0) { \ + _Z_ERROR("%s failed: %i", #collection_push_f, ret); \ + } \ + } \ + static inline void _z_##handler_name##_send(elem_loaned_type *elem, void *context) { \ + elem_owned_type *internal_elem = (elem_owned_type *)z_malloc(sizeof(elem_owned_type)); \ + if (internal_elem == NULL) { \ + _Z_ERROR("Out of memory"); \ + return; \ + } \ + elem_clone_f(internal_elem, elem); \ + int8_t ret = collection_push_f(internal_elem, context, _z_##handler_name##_elem_free); \ + if (ret != _Z_RES_OK) { \ + _Z_ERROR("%s failed: %i", #collection_push_f, ret); \ + } \ + } \ + static inline int8_t z_##handler_name##_recv(const z_loaned_##handler_name##_t *handler, elem_owned_type *elem) { \ + elem_null_f(elem); \ + int8_t ret = collection_pull_f(elem, (collection_type *)handler->collection, _z_##handler_name##_elem_move); \ + if (ret == _Z_RES_CHANNEL_CLOSED) { \ + return Z_CHANNEL_DISCONNECTED; \ + } \ + if (ret != _Z_RES_OK) { \ + _Z_ERROR("%s failed: %i", #collection_pull_f, ret); \ + return ret; \ + } \ + return _Z_RES_OK; \ + } \ + static inline int8_t z_##handler_name##_try_recv(const z_loaned_##handler_name##_t *handler, \ + elem_owned_type *elem) { \ + elem_null_f(elem); \ + int8_t ret = \ + collection_try_pull_f(elem, (collection_type *)handler->collection, _z_##handler_name##_elem_move); \ + if (ret == _Z_RES_CHANNEL_CLOSED) { \ + return Z_CHANNEL_DISCONNECTED; \ + } else if (ret == _Z_RES_CHANNEL_NODATA) { \ + return Z_CHANNEL_NODATA; \ + } \ + if (ret != _Z_RES_OK) { \ + _Z_ERROR("%s failed: %i", #collection_try_pull_f, ret); \ + return ret; \ + } \ + return _Z_RES_OK; \ + } \ + \ + static inline void _z_##handler_name##_clear(handler_type *handler) { \ + if (handler != NULL && handler->collection != NULL) { \ + collection_free_f(handler->collection, _z_##handler_name##_elem_free); \ + handler->collection = NULL; \ + } \ + } \ + static inline bool _z_##handler_name##_check(const handler_type *handler) { return handler->collection == NULL; } \ + static inline handler_type _z_##handler_name##_null(void) { \ + handler_type h; \ + h.collection = NULL; \ + return h; \ + } \ + \ + _Z_OWNED_FUNCTIONS_VALUE_NO_COPY_INLINE_IMPL(handler_type, handler_name, _z_##handler_name##_check, \ + _z_##handler_name##_null, _z_##handler_name##_clear) \ + \ + static inline int8_t handler_new_f_name(callback_type *callback, z_owned_##handler_name##_t *handler, \ + size_t capacity) { \ + if (capacity < 1) { \ + return _Z_ERR_INVALID; \ + } \ + handler->_val.collection = collection_new_f(capacity); \ + if (handler->_val.collection == NULL) { \ + return _Z_ERR_SYSTEM_OUT_OF_MEMORY; \ + } \ + callback_new_f(callback, _z_##handler_name##_send, _z_##handler_name##_close, handler->_val.collection); \ + return _Z_RES_OK; \ } #define _Z_CHANNEL_DEFINE(item_name, kind_name) \ diff --git a/include/zenoh-pico/api/olv_macros.h b/include/zenoh-pico/api/olv_macros.h index e29aa316f..42d60e143 100644 --- a/include/zenoh-pico/api/olv_macros.h +++ b/include/zenoh-pico/api/olv_macros.h @@ -57,7 +57,7 @@ #define _Z_OWNED_FUNCTIONS_DEF(name) \ void z_internal_##name##_null(z_owned_##name##_t *obj); \ - _Bool z_internal_##name##_check(const z_owned_##name##_t *obj); \ + bool z_internal_##name##_check(const z_owned_##name##_t *obj); \ const z_loaned_##name##_t *z_##name##_loan(const z_owned_##name##_t *obj); \ z_loaned_##name##_t *z_##name##_loan_mut(z_owned_##name##_t *obj); \ z_moved_##name##_t *z_##name##_move(z_owned_##name##_t *obj); \ @@ -67,7 +67,7 @@ #define _Z_OWNED_FUNCTIONS_NO_COPY_DEF(name) \ void z_internal_##name##_null(z_owned_##name##_t *obj); \ - _Bool z_internal_##name##_check(const z_owned_##name##_t *obj); \ + bool z_internal_##name##_check(const z_owned_##name##_t *obj); \ const z_loaned_##name##_t *z_##name##_loan(const z_owned_##name##_t *obj); \ z_loaned_##name##_t *z_##name##_loan_mut(z_owned_##name##_t *obj); \ z_moved_##name##_t *z_##name##_move(z_owned_##name##_t *obj); \ @@ -82,7 +82,7 @@ z_moved_##name##_t *z_##name##_move(z_owned_##name##_t *obj); #define _Z_VIEW_FUNCTIONS_DEF(name) \ - _Bool z_view_##name##_is_empty(const z_view_##name##_t *obj); \ + bool z_view_##name##_is_empty(const z_view_##name##_t *obj); \ const z_loaned_##name##_t *z_view_##name##_loan(const z_view_##name##_t *name); \ z_loaned_##name##_t *z_view_##name##_loan_mut(z_view_##name##_t *name); \ void z_view_##name##_empty(z_view_##name##_t *name); @@ -97,7 +97,7 @@ #define _Z_OWNED_FUNCTIONS_VALUE_IMPL(type, name, f_check, f_null, f_copy, f_drop) \ _Z_OWNED_FUNCTIONS_IMPL_MOVE_TAKE(name) \ void z_internal_##name##_null(z_owned_##name##_t *obj) { obj->_val = f_null(); } \ - _Bool z_internal_##name##_check(const z_owned_##name##_t *obj) { return f_check((&obj->_val)); } \ + bool z_internal_##name##_check(const z_owned_##name##_t *obj) { return f_check((&obj->_val)); } \ const z_loaned_##name##_t *z_##name##_loan(const z_owned_##name##_t *obj) { return &obj->_val; } \ z_loaned_##name##_t *z_##name##_loan_mut(z_owned_##name##_t *obj) { return &obj->_val; } \ int8_t z_##name##_clone(z_owned_##name##_t *obj, const z_loaned_##name##_t *src) { \ @@ -109,7 +109,7 @@ #define _Z_OWNED_FUNCTIONS_VALUE_NO_COPY_IMPL_INNER(type, name, f_check, f_null, f_drop, attribute) \ attribute void z_internal_##name##_null(z_owned_##name##_t *obj) { obj->_val = f_null(); } \ - attribute _Bool z_internal_##name##_check(const z_owned_##name##_t *obj) { return f_check((&obj->_val)); } \ + attribute bool z_internal_##name##_check(const z_owned_##name##_t *obj) { return f_check((&obj->_val)); } \ attribute const z_loaned_##name##_t *z_##name##_loan(const z_owned_##name##_t *obj) { return &obj->_val; } \ attribute z_loaned_##name##_t *z_##name##_loan_mut(z_owned_##name##_t *obj) { return &obj->_val; } \ attribute z_moved_##name##_t *z_##name##_move(z_owned_##name##_t *obj) { return (z_moved_##name##_t *)(obj); } \ @@ -129,24 +129,24 @@ #define _Z_OWNED_FUNCTIONS_VALUE_NO_COPY_INLINE_IMPL(type, name, f_check, f_null, f_drop) \ _Z_OWNED_FUNCTIONS_VALUE_NO_COPY_IMPL_INNER(type, name, f_check, f_null, f_drop, static inline) -#define _Z_OWNED_FUNCTIONS_RC_IMPL(name) \ - _Z_OWNED_FUNCTIONS_IMPL_MOVE_TAKE(name) \ - void z_internal_##name##_null(z_owned_##name##_t *val) { val->_rc = _z_##name##_rc_null(); } \ - _Bool z_internal_##name##_check(const z_owned_##name##_t *val) { return !_Z_RC_IS_NULL(&val->_rc); } \ - const z_loaned_##name##_t *z_##name##_loan(const z_owned_##name##_t *val) { return &val->_rc; } \ - z_loaned_##name##_t *z_##name##_loan_mut(z_owned_##name##_t *val) { return &val->_rc; } \ - int8_t z_##name##_clone(z_owned_##name##_t *obj, const z_loaned_##name##_t *src) { \ - int8_t ret = _Z_RES_OK; \ - obj->_rc = _z_##name##_rc_clone((z_loaned_##name##_t *)src); \ - if (_Z_RC_IS_NULL(&obj->_rc)) { \ - ret = _Z_ERR_SYSTEM_OUT_OF_MEMORY; \ - } \ - return ret; \ - } \ - void z_##name##_drop(z_moved_##name##_t *obj) { \ - if (!_Z_RC_IS_NULL(&obj->_this._rc)) { \ - _z_##name##_rc_drop(&obj->_this._rc); \ - } \ +#define _Z_OWNED_FUNCTIONS_RC_IMPL(name) \ + _Z_OWNED_FUNCTIONS_IMPL_MOVE_TAKE(name) \ + void z_internal_##name##_null(z_owned_##name##_t *val) { val->_rc = _z_##name##_rc_null(); } \ + bool z_internal_##name##_check(const z_owned_##name##_t *val) { return !_Z_RC_IS_NULL(&val->_rc); } \ + const z_loaned_##name##_t *z_##name##_loan(const z_owned_##name##_t *val) { return &val->_rc; } \ + z_loaned_##name##_t *z_##name##_loan_mut(z_owned_##name##_t *val) { return &val->_rc; } \ + int8_t z_##name##_clone(z_owned_##name##_t *obj, const z_loaned_##name##_t *src) { \ + int8_t ret = _Z_RES_OK; \ + obj->_rc = _z_##name##_rc_clone((z_loaned_##name##_t *)src); \ + if (_Z_RC_IS_NULL(&obj->_rc)) { \ + ret = _Z_ERR_SYSTEM_OUT_OF_MEMORY; \ + } \ + return ret; \ + } \ + void z_##name##_drop(z_moved_##name##_t *obj) { \ + if (!_Z_RC_IS_NULL(&obj->_this._rc)) { \ + _z_##name##_rc_drop(&obj->_this._rc); \ + } \ } #define _Z_OWNED_FUNCTIONS_SYSTEM_IMPL(type, name) \ @@ -156,42 +156,42 @@ z_loaned_##name##_t *z_##name##_loan_mut(z_owned_##name##_t *obj) { return &obj->_val; } #define _Z_VIEW_FUNCTIONS_IMPL(type, name, f_check, f_null) \ - _Bool z_view_##name##_is_empty(const z_view_##name##_t *obj) { return !f_check((&obj->_val)); } \ + bool z_view_##name##_is_empty(const z_view_##name##_t *obj) { return !f_check((&obj->_val)); } \ const z_loaned_##name##_t *z_view_##name##_loan(const z_view_##name##_t *obj) { return &obj->_val; } \ z_loaned_##name##_t *z_view_##name##_loan_mut(z_view_##name##_t *obj) { return &obj->_val; } \ void z_view_##name##_empty(z_view_##name##_t *obj) { obj->_val = f_null(); } #define _Z_OWNED_FUNCTIONS_CLOSURE_DEF(name) \ void z_internal_##name##_null(z_owned_##name##_t *name); \ - _Bool z_internal_##name##_check(const z_owned_##name##_t *val); \ + bool z_internal_##name##_check(const z_owned_##name##_t *val); \ z_moved_##name##_t *z_##name##_move(z_owned_##name##_t *val); \ void z_##name##_take(z_owned_##name##_t *obj, z_moved_##name##_t *src); \ void z_##name##_drop(z_moved_##name##_t *obj); \ const z_loaned_##name##_t *z_##name##_loan(const z_owned_##name##_t *val); -#define _Z_OWNED_FUNCTIONS_CLOSURE_IMPL(name, f_call, f_drop) \ - _Z_OWNED_FUNCTIONS_IMPL_MOVE_TAKE(name) \ - void z_internal_##name##_null(z_owned_##name##_t *val) { \ - val->_val.call = NULL; \ - val->_val.drop = NULL; \ - val->_val.context = NULL; \ - } \ - _Bool z_internal_##name##_check(const z_owned_##name##_t *val) { return val->_val.call != NULL; } \ - void z_##name##_drop(z_moved_##name##_t *obj) { \ - if (obj->_this._val.drop != NULL) { \ - (obj->_this._val.drop)(obj->_this._val.context); \ - obj->_this._val.drop = NULL; \ - } \ - obj->_this._val.call = NULL; \ - obj->_this._val.context = NULL; \ - } \ - const z_loaned_##name##_t *z_##name##_loan(const z_owned_##name##_t *val) { return &val->_val; } \ - int8_t z_##name(z_owned_##name##_t *closure, f_call call, f_drop drop, void *context) { \ - closure->_val.call = call; \ - closure->_val.drop = drop; \ - closure->_val.context = context; \ - \ - return _Z_RES_OK; \ +#define _Z_OWNED_FUNCTIONS_CLOSURE_IMPL(name, f_call, f_drop) \ + _Z_OWNED_FUNCTIONS_IMPL_MOVE_TAKE(name) \ + void z_internal_##name##_null(z_owned_##name##_t *val) { \ + val->_val.call = NULL; \ + val->_val.drop = NULL; \ + val->_val.context = NULL; \ + } \ + bool z_internal_##name##_check(const z_owned_##name##_t *val) { return val->_val.call != NULL; } \ + void z_##name##_drop(z_moved_##name##_t *obj) { \ + if (obj->_this._val.drop != NULL) { \ + (obj->_this._val.drop)(obj->_this._val.context); \ + obj->_this._val.drop = NULL; \ + } \ + obj->_this._val.call = NULL; \ + obj->_this._val.context = NULL; \ + } \ + const z_loaned_##name##_t *z_##name##_loan(const z_owned_##name##_t *val) { return &val->_val; } \ + int8_t z_##name(z_owned_##name##_t *closure, f_call call, f_drop drop, void *context) { \ + closure->_val.call = call; \ + closure->_val.drop = drop; \ + closure->_val.context = context; \ + \ + return _Z_RES_OK; \ } #endif /* INCLUDE_ZENOH_PICO_API_OLV_MACROS_H */ diff --git a/include/zenoh-pico/api/primitives.h b/include/zenoh-pico/api/primitives.h index 65f091ca1..d86264b05 100644 --- a/include/zenoh-pico/api/primitives.h +++ b/include/zenoh-pico/api/primitives.h @@ -252,7 +252,7 @@ int8_t z_keyexpr_canonize_null_terminated(char *start); * ``true`` if ``l`` includes ``r``, i.e. the set defined by ``l`` contains every key belonging to the set * defined by ``r``. Otherwise, returns ``false``. */ -_Bool z_keyexpr_includes(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r); +bool z_keyexpr_includes(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r); /** * Checks if a given keyexpr intersects with another keyexpr. @@ -265,7 +265,7 @@ _Bool z_keyexpr_includes(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t * * ``true`` if keyexprs intersect, i.e. there exists at least one key which is contained in both of the * sets defined by ``l`` and ``r``. Otherwise, returns ``false``. */ -_Bool z_keyexpr_intersects(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r); +bool z_keyexpr_intersects(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r); /** * Checks if two keyexpr are equal. @@ -277,7 +277,7 @@ _Bool z_keyexpr_intersects(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t * Return: * ``true`` if both ``l`` and ``r`` are equal. Otherwise, returns ``false``. */ -_Bool z_keyexpr_equals(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r); +bool z_keyexpr_equals(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r); /** * Builds a new, zenoh-allocated, empty configuration. @@ -895,7 +895,7 @@ int8_t z_bytes_serialize_from_str(z_owned_bytes_t *bytes, const char *value); * Return: * ``0`` if encode successful, ``negative value`` otherwise. */ -int8_t z_bytes_from_iter(z_owned_bytes_t *bytes, _Bool (*iterator_body)(z_owned_bytes_t *data, void *context), +int8_t z_bytes_from_iter(z_owned_bytes_t *bytes, bool (*iterator_body)(z_owned_bytes_t *data, void *context), void *context); /** @@ -935,7 +935,7 @@ size_t z_bytes_len(const z_loaned_bytes_t *bytes); * Return: * ``true`` if conainer is empty, ``false`` otherwise. */ -_Bool z_bytes_is_empty(const z_loaned_bytes_t *bytes); +bool z_bytes_is_empty(const z_loaned_bytes_t *bytes); /** * Returns an iterator for multi-element serialized data. @@ -959,7 +959,7 @@ z_bytes_iterator_t z_bytes_get_iterator(const z_loaned_bytes_t *bytes); * Return: * ``false`` when iterator reaches the end, ``true`` otherwise. */ -_Bool z_bytes_iterator_next(z_bytes_iterator_t *iter, z_owned_bytes_t *out); +bool z_bytes_iterator_next(z_bytes_iterator_t *iter, z_owned_bytes_t *out); /** * Returns an iterator on raw bytes slices contained in the `z_loaned_bytes_t`. @@ -987,7 +987,7 @@ z_bytes_slice_iterator_t z_bytes_get_slice_iterator(const z_loaned_bytes_t *byte * Return: * ``false`` when iterator reaches the end, ``true`` otherwise. */ -_Bool z_bytes_slice_iterator_next(z_bytes_slice_iterator_t *iter, z_view_slice_t *out); +bool z_bytes_slice_iterator_next(z_bytes_slice_iterator_t *iter, z_view_slice_t *out); /** * Returns a reader for the `bytes`. @@ -1135,7 +1135,7 @@ z_id_t z_timestamp_id(const z_timestamp_t *ts); * Return: * ``true`` if timestamp is valid, ``false`` otherwise. */ -_Bool z_timestamp_check(z_timestamp_t ts); +bool z_timestamp_check(z_timestamp_t ts); /** * Builds a default query target. @@ -1869,7 +1869,7 @@ int8_t z_get(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr, co * Return: * ``true`` if queryable answered with an OK, ``false`` otherwise. */ -_Bool z_reply_is_ok(const z_loaned_reply_t *reply); +bool z_reply_is_ok(const z_loaned_reply_t *reply); /** * Gets the content of an OK reply. @@ -1906,7 +1906,7 @@ const z_loaned_reply_err_t *z_reply_err(const z_loaned_reply_t *reply); * Return: * `true` if id is present */ -_Bool z_reply_replier_id(const z_loaned_reply_t *reply, z_id_t *out_id); +bool z_reply_replier_id(const z_loaned_reply_t *reply, z_id_t *out_id); #endif #if Z_FEATURE_QUERYABLE == 1 diff --git a/include/zenoh-pico/api/types.h b/include/zenoh-pico/api/types.h index fed282823..10bbcd477 100644 --- a/include/zenoh-pico/api/types.h +++ b/include/zenoh-pico/api/types.h @@ -228,14 +228,14 @@ typedef struct { * z_congestion_control_t congestion_control: The congestion control to apply when routing messages from this * publisher. * z_priority_t priority: The priority of messages issued by this publisher. - * _Bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. + * bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. * (unstable) z_reliability_t reliability: The reliability that should be used to transmit the data. */ typedef struct { z_moved_encoding_t *encoding; z_congestion_control_t congestion_control; z_priority_t priority; - _Bool is_express; + bool is_express; #if Z_FEATURE_UNSTABLE_API == 1 z_reliability_t reliability; #endif @@ -245,10 +245,10 @@ typedef struct { * Represents the configuration used to configure a queryable upon declaration :c:func:`z_declare_queryable`. * * Members: - * _Bool complete: The completeness of the queryable. + * bool complete: The completeness of the queryable. */ typedef struct { - _Bool complete; + bool complete; } z_queryable_options_t; /** @@ -259,7 +259,7 @@ typedef struct { * z_congestion_control_t congestion_control: The congestion control to apply when routing this message. * z_priority_t priority: The priority of this message when routed. * z_timestamp_t *timestamp: The API level timestamp (e.g. of the data when it was created). - * _Bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. + * bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. * z_moved_bytes_t* attachment: An optional attachment to the response. */ typedef struct { @@ -267,7 +267,7 @@ typedef struct { z_congestion_control_t congestion_control; z_priority_t priority; z_timestamp_t *timestamp; - _Bool is_express; + bool is_express; z_moved_bytes_t *attachment; } z_query_reply_options_t; @@ -278,14 +278,14 @@ typedef struct { * z_congestion_control_t congestion_control: The congestion control to apply when routing this message. * z_priority_t priority: The priority of this message when routed. * z_timestamp_t *timestamp: The API level timestamp (e.g. of the data when it was created). - * _Bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. + * bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. * z_moved_bytes_t* attachment: An optional attachment to the response. */ typedef struct { z_congestion_control_t congestion_control; z_priority_t priority; z_timestamp_t *timestamp; - _Bool is_express; + bool is_express; z_moved_bytes_t *attachment; } z_query_reply_del_options_t; @@ -307,7 +307,7 @@ typedef struct { * z_congestion_control_t congestion_control: The congestion control to apply when routing this message. * z_priority_t priority: The priority of this message when routed. * z_timestamp_t *timestamp: The API level timestamp (e.g. of the data when it was created). - * _Bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. + * bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. * z_moved_bytes_t* attachment: An optional attachment to the publication. * (unstable) z_reliability_t reliability: The reliability that should be used to transmit the data. */ @@ -316,7 +316,7 @@ typedef struct { z_congestion_control_t congestion_control; z_priority_t priority; z_timestamp_t *timestamp; - _Bool is_express; + bool is_express; z_moved_bytes_t *attachment; #if Z_FEATURE_UNSTABLE_API == 1 z_reliability_t reliability; @@ -329,14 +329,14 @@ typedef struct { * Members: * z_congestion_control_t congestion_control: The congestion control to apply when routing this message. * z_priority_t priority: The priority of this message when router. - * _Bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. + * bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. * z_timestamp_t *timestamp: The API level timestamp (e.g. of the data when it was created). * (unstable) z_reliability_t reliability: The reliability that should be used to transmit the data. */ typedef struct { z_congestion_control_t congestion_control; z_priority_t priority; - _Bool is_express; + bool is_express; z_timestamp_t *timestamp; #if Z_FEATURE_UNSTABLE_API == 1 z_reliability_t reliability; @@ -378,7 +378,7 @@ typedef struct { * z_query_consolidation_t consolidation: The replies consolidation strategy to apply on replies. * z_congestion_control_t congestion_control: The congestion control to apply when routing the query. * z_priority_t priority: The priority of the query. - * _Bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. + * bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth. * z_query_target_t target: The queryables that should be targeted by this get. * z_moved_bytes_t* attachment: An optional attachment to the query. */ @@ -388,7 +388,7 @@ typedef struct { z_query_consolidation_t consolidation; z_congestion_control_t congestion_control; z_priority_t priority; - _Bool is_express; + bool is_express; z_query_target_t target; uint64_t timeout_ms; z_moved_bytes_t *attachment; @@ -486,7 +486,7 @@ _Z_VIEW_TYPE(_z_string_svec_t, string_array) const z_loaned_string_t *z_string_array_get(const z_loaned_string_array_t *a, size_t k); size_t z_string_array_len(const z_loaned_string_array_t *a); -_Bool z_string_array_is_empty(const z_loaned_string_array_t *a); +bool z_string_array_is_empty(const z_loaned_string_array_t *a); typedef void (*z_dropper_handler_t)(void *arg); typedef _z_data_handler_t z_data_handler_t; diff --git a/include/zenoh-pico/collections/arc_slice.h b/include/zenoh-pico/collections/arc_slice.h index 2e6c1bf67..2454fb0b2 100644 --- a/include/zenoh-pico/collections/arc_slice.h +++ b/include/zenoh-pico/collections/arc_slice.h @@ -46,7 +46,7 @@ _z_arc_slice_t _z_arc_slice_empty(void); _z_arc_slice_t _z_arc_slice_wrap(_z_slice_t s, size_t offset, size_t len); _z_arc_slice_t _z_arc_slice_get_subslice(const _z_arc_slice_t* s, size_t offset, size_t len); size_t _z_arc_slice_len(const _z_arc_slice_t* s); -_Bool _z_arc_slice_is_empty(const _z_arc_slice_t* s); +bool _z_arc_slice_is_empty(const _z_arc_slice_t* s); const uint8_t* _z_arc_slice_data(const _z_arc_slice_t* s); int8_t _z_arc_slice_copy(_z_arc_slice_t* dst, const _z_arc_slice_t* src); int8_t _z_arc_slice_move(_z_arc_slice_t* dst, _z_arc_slice_t* src); diff --git a/include/zenoh-pico/collections/array.h b/include/zenoh-pico/collections/array.h index fe2b3f306..0c08d9af2 100644 --- a/include/zenoh-pico/collections/array.h +++ b/include/zenoh-pico/collections/array.h @@ -53,7 +53,7 @@ } \ static inline type *name##_array_get(const name##_array_t *a, size_t k) { return &a->_val[k]; } \ static inline size_t name##_array_len(const name##_array_t *a) { return a->_len; } \ - static inline _Bool name##_array_is_empty(const name##_array_t *a) { return a->_len == 0; } \ + static inline bool name##_array_is_empty(const name##_array_t *a) { return a->_len == 0; } \ static inline void name##_array_clear(name##_array_t *a) { \ for (size_t i = 0; i < a->_len; i++) { \ name##_elem_clear(&a->_val[i]); \ diff --git a/include/zenoh-pico/collections/bytes.h b/include/zenoh-pico/collections/bytes.h index 6553fe199..3090bf5bf 100644 --- a/include/zenoh-pico/collections/bytes.h +++ b/include/zenoh-pico/collections/bytes.h @@ -45,7 +45,7 @@ typedef struct { _z_arc_slice_svec_t _slices; } _z_bytes_t; -_Bool _z_bytes_check(const _z_bytes_t *bytes); +bool _z_bytes_check(const _z_bytes_t *bytes); _z_bytes_t _z_bytes_null(void); int8_t _z_bytes_append_bytes(_z_bytes_t *dst, _z_bytes_t *src); int8_t _z_bytes_append_slice(_z_bytes_t *dst, _z_arc_slice_t *s); @@ -57,7 +57,7 @@ void _z_bytes_free(_z_bytes_t **bs); size_t _z_bytes_num_slices(const _z_bytes_t *bs); _z_arc_slice_t *_z_bytes_get_slice(const _z_bytes_t *bs, size_t i); size_t _z_bytes_len(const _z_bytes_t *bs); -_Bool _z_bytes_is_empty(const _z_bytes_t *bs); +bool _z_bytes_is_empty(const _z_bytes_t *bs); int8_t _z_bytes_to_uint8(const _z_bytes_t *bs, uint8_t *u); int8_t _z_bytes_to_uint16(const _z_bytes_t *bs, uint16_t *u); int8_t _z_bytes_to_uint32(const _z_bytes_t *bs, uint32_t *u); diff --git a/include/zenoh-pico/collections/element.h b/include/zenoh-pico/collections/element.h index 94a71403d..ef5178ad1 100644 --- a/include/zenoh-pico/collections/element.h +++ b/include/zenoh-pico/collections/element.h @@ -28,10 +28,10 @@ typedef void (*z_element_free_f)(void **e); typedef void (*z_element_copy_f)(void *dst, const void *src); typedef void (*z_element_move_f)(void *dst, void *src); typedef void *(*z_element_clone_f)(const void *e); -typedef _Bool (*z_element_eq_f)(const void *left, const void *right); +typedef bool (*z_element_eq_f)(const void *left, const void *right); #define _Z_ELEM_DEFINE(name, type, elem_size_f, elem_clear_f, elem_copy_f) \ - typedef _Bool (*name##_eq_f)(const type *left, const type *right); \ + typedef bool (*name##_eq_f)(const type *left, const type *right); \ static inline void name##_elem_clear(void *e) { elem_clear_f((type *)e); } \ static inline void name##_elem_free(void **e) { \ type *ptr = (type *)*e; \ diff --git a/include/zenoh-pico/collections/fifo.h b/include/zenoh-pico/collections/fifo.h index 23562e460..c3f3dae61 100644 --- a/include/zenoh-pico/collections/fifo.h +++ b/include/zenoh-pico/collections/fifo.h @@ -30,8 +30,8 @@ _z_fifo_t _z_fifo_make(size_t capacity); size_t _z_fifo_capacity(const _z_fifo_t *r); size_t _z_fifo_len(const _z_fifo_t *r); -_Bool _z_fifo_is_empty(const _z_fifo_t *r); -_Bool _z_fifo_is_full(const _z_fifo_t *r); +bool _z_fifo_is_empty(const _z_fifo_t *r); +bool _z_fifo_is_full(const _z_fifo_t *r); void *_z_fifo_push(_z_fifo_t *r, void *e); void _z_fifo_push_drop(_z_fifo_t *r, void *e, z_element_free_f f); @@ -50,8 +50,8 @@ void _z_fifo_free(_z_fifo_t **xs, z_element_free_f f_f); static inline name##_fifo_t name##_fifo_make(size_t capacity) { return _z_fifo_make(capacity); } \ static inline size_t name##_fifo_capacity(const name##_fifo_t *r) { return _z_fifo_capacity(r); } \ static inline size_t name##_fifo_len(const name##_fifo_t *r) { return _z_fifo_len(r); } \ - static inline _Bool name##_fifo_is_empty(const name##_fifo_t *r) { return _z_fifo_is_empty(r); } \ - static inline _Bool name##_fifo_is_full(const name##_fifo_t *r) { return _z_fifo_is_full(r); } \ + static inline bool name##_fifo_is_empty(const name##_fifo_t *r) { return _z_fifo_is_empty(r); } \ + static inline bool name##_fifo_is_full(const name##_fifo_t *r) { return _z_fifo_is_full(r); } \ static inline type *name##_fifo_push(name##_fifo_t *r, type *e) { return _z_fifo_push(r, (void *)e); } \ static inline void name##_fifo_push_drop(name##_fifo_t *r, type *e) { \ _z_fifo_push_drop(r, (void *)e, name##_elem_free); \ diff --git a/include/zenoh-pico/collections/fifo_mt.h b/include/zenoh-pico/collections/fifo_mt.h index 3257c7704..224e178ad 100644 --- a/include/zenoh-pico/collections/fifo_mt.h +++ b/include/zenoh-pico/collections/fifo_mt.h @@ -27,7 +27,7 @@ extern "C" { /*-------- Fifo Buffer Multithreaded --------*/ typedef struct { _z_fifo_t _fifo; - _Bool is_closed; + bool is_closed; #if Z_FEATURE_MULTI_THREAD == 1 _z_mutex_t _mutex; _z_condvar_t _cv_not_full; diff --git a/include/zenoh-pico/collections/intmap.h b/include/zenoh-pico/collections/intmap.h index c3c853670..737ee4428 100644 --- a/include/zenoh-pico/collections/intmap.h +++ b/include/zenoh-pico/collections/intmap.h @@ -59,7 +59,7 @@ void _z_int_void_map_remove(_z_int_void_map_t *map, size_t k, z_element_free_f f size_t _z_int_void_map_capacity(const _z_int_void_map_t *map); size_t _z_int_void_map_len(const _z_int_void_map_t *map); -_Bool _z_int_void_map_is_empty(const _z_int_void_map_t *map); +bool _z_int_void_map_is_empty(const _z_int_void_map_t *map); int8_t _z_int_void_map_copy(_z_int_void_map_t *dst, const _z_int_void_map_t *src, z_element_clone_f f_c); _z_int_void_map_t _z_int_void_map_clone(const _z_int_void_map_t *src, z_element_clone_f f_c, z_element_free_f f_f); @@ -67,50 +67,50 @@ _z_int_void_map_t _z_int_void_map_clone(const _z_int_void_map_t *src, z_element_ void _z_int_void_map_clear(_z_int_void_map_t *map, z_element_free_f f); void _z_int_void_map_free(_z_int_void_map_t **map, z_element_free_f f); -#define _Z_INT_MAP_DEFINE(name, type) \ - typedef _z_int_void_map_entry_t name##_intmap_entry_t; \ - static inline void name##_intmap_entry_elem_free(void **e) { \ - name##_intmap_entry_t *ptr = (name##_intmap_entry_t *)*e; \ - if (ptr != NULL) { \ - name##_elem_free(&ptr->_val); \ - z_free(ptr); \ - *e = NULL; \ - } \ - } \ - static inline void *name##_intmap_entry_elem_clone(const void *e) { \ - const name##_intmap_entry_t *src = (name##_intmap_entry_t *)e; \ - name##_intmap_entry_t *dst = (name##_intmap_entry_t *)z_malloc(sizeof(name##_intmap_entry_t)); \ - dst->_key = src->_key; \ - dst->_val = name##_elem_clone(src->_val); \ - return dst; \ - } \ - typedef _z_int_void_map_t name##_intmap_t; \ - static inline void name##_intmap_init(name##_intmap_t *m) { \ - _z_int_void_map_init(m, _Z_DEFAULT_INT_MAP_CAPACITY); \ - } \ - static inline name##_intmap_t name##_intmap_make(void) { \ - return _z_int_void_map_make(_Z_DEFAULT_INT_MAP_CAPACITY); \ - } \ - static inline type *name##_intmap_insert(name##_intmap_t *m, size_t k, type *v) { \ - return (type *)_z_int_void_map_insert(m, k, v, name##_intmap_entry_elem_free); \ - } \ - static inline type *name##_intmap_get(const name##_intmap_t *m, size_t k) { \ - return (type *)_z_int_void_map_get(m, k); \ - } \ - static inline name##_intmap_t name##_intmap_clone(const name##_intmap_t *m) { \ - return _z_int_void_map_clone(m, name##_intmap_entry_elem_clone, name##_intmap_entry_elem_free); \ - } \ - static inline void name##_intmap_remove(name##_intmap_t *m, size_t k) { \ - _z_int_void_map_remove(m, k, name##_intmap_entry_elem_free); \ - } \ - static inline size_t name##_intmap_capacity(name##_intmap_t *m) { return _z_int_void_map_capacity(m); } \ - static inline size_t name##_intmap_len(name##_intmap_t *m) { return _z_int_void_map_len(m); } \ - static inline _Bool name##_intmap_is_empty(const name##_intmap_t *m) { return _z_int_void_map_is_empty(m); } \ - static inline void name##_intmap_clear(name##_intmap_t *m) { \ - _z_int_void_map_clear(m, name##_intmap_entry_elem_free); \ - } \ - static inline void name##_intmap_free(name##_intmap_t **m) { \ - _z_int_void_map_free(m, name##_intmap_entry_elem_free); \ +#define _Z_INT_MAP_DEFINE(name, type) \ + typedef _z_int_void_map_entry_t name##_intmap_entry_t; \ + static inline void name##_intmap_entry_elem_free(void **e) { \ + name##_intmap_entry_t *ptr = (name##_intmap_entry_t *)*e; \ + if (ptr != NULL) { \ + name##_elem_free(&ptr->_val); \ + z_free(ptr); \ + *e = NULL; \ + } \ + } \ + static inline void *name##_intmap_entry_elem_clone(const void *e) { \ + const name##_intmap_entry_t *src = (name##_intmap_entry_t *)e; \ + name##_intmap_entry_t *dst = (name##_intmap_entry_t *)z_malloc(sizeof(name##_intmap_entry_t)); \ + dst->_key = src->_key; \ + dst->_val = name##_elem_clone(src->_val); \ + return dst; \ + } \ + typedef _z_int_void_map_t name##_intmap_t; \ + static inline void name##_intmap_init(name##_intmap_t *m) { \ + _z_int_void_map_init(m, _Z_DEFAULT_INT_MAP_CAPACITY); \ + } \ + static inline name##_intmap_t name##_intmap_make(void) { \ + return _z_int_void_map_make(_Z_DEFAULT_INT_MAP_CAPACITY); \ + } \ + static inline type *name##_intmap_insert(name##_intmap_t *m, size_t k, type *v) { \ + return (type *)_z_int_void_map_insert(m, k, v, name##_intmap_entry_elem_free); \ + } \ + static inline type *name##_intmap_get(const name##_intmap_t *m, size_t k) { \ + return (type *)_z_int_void_map_get(m, k); \ + } \ + static inline name##_intmap_t name##_intmap_clone(const name##_intmap_t *m) { \ + return _z_int_void_map_clone(m, name##_intmap_entry_elem_clone, name##_intmap_entry_elem_free); \ + } \ + static inline void name##_intmap_remove(name##_intmap_t *m, size_t k) { \ + _z_int_void_map_remove(m, k, name##_intmap_entry_elem_free); \ + } \ + static inline size_t name##_intmap_capacity(name##_intmap_t *m) { return _z_int_void_map_capacity(m); } \ + static inline size_t name##_intmap_len(name##_intmap_t *m) { return _z_int_void_map_len(m); } \ + static inline bool name##_intmap_is_empty(const name##_intmap_t *m) { return _z_int_void_map_is_empty(m); } \ + static inline void name##_intmap_clear(name##_intmap_t *m) { \ + _z_int_void_map_clear(m, name##_intmap_entry_elem_free); \ + } \ + static inline void name##_intmap_free(name##_intmap_t **m) { \ + _z_int_void_map_free(m, name##_intmap_entry_elem_free); \ } #endif /* ZENOH_PICO_COLLECTIONS_INTMAP_H */ diff --git a/include/zenoh-pico/collections/lifo.h b/include/zenoh-pico/collections/lifo.h index caba25d18..b17a85f5d 100644 --- a/include/zenoh-pico/collections/lifo.h +++ b/include/zenoh-pico/collections/lifo.h @@ -31,8 +31,8 @@ _z_lifo_t _z_lifo_make(size_t capacity); size_t _z_lifo_capacity(const _z_lifo_t *r); size_t _z_lifo_len(const _z_lifo_t *r); -_Bool _z_lifo_is_empty(const _z_lifo_t *r); -_Bool _z_lifo_is_full(const _z_lifo_t *r); +bool _z_lifo_is_empty(const _z_lifo_t *r); +bool _z_lifo_is_full(const _z_lifo_t *r); void *_z_lifo_push(_z_lifo_t *r, void *e); void _z_lifo_push_drop(_z_lifo_t *r, void *e, z_element_free_f f); @@ -51,8 +51,8 @@ void _z_lifo_free(_z_lifo_t **xs, z_element_free_f f_f); static inline name##_lifo_t name##_lifo_make(size_t capacity) { return _z_lifo_make(capacity); } \ static inline size_t name##_lifo_capacity(const name##_lifo_t *r) { return _z_lifo_capacity(r); } \ static inline size_t name##_lifo_len(const name##_lifo_t *r) { return _z_lifo_len(r); } \ - static inline _Bool name##_lifo_is_empty(const name##_lifo_t *r) { return _z_lifo_is_empty(r); } \ - static inline _Bool name##_lifo_is_full(const name##_lifo_t *r) { return _z_lifo_is_full(r); } \ + static inline bool name##_lifo_is_empty(const name##_lifo_t *r) { return _z_lifo_is_empty(r); } \ + static inline bool name##_lifo_is_full(const name##_lifo_t *r) { return _z_lifo_is_full(r); } \ static inline type *name##_lifo_push(name##_lifo_t *r, type *e) { return _z_lifo_push(r, (void *)e); } \ static inline void name##_lifo_push_drop(name##_lifo_t *r, type *e) { \ _z_lifo_push_drop(r, (void *)e, name##_elem_free); \ diff --git a/include/zenoh-pico/collections/list.h b/include/zenoh-pico/collections/list.h index 210737047..a779706f0 100644 --- a/include/zenoh-pico/collections/list.h +++ b/include/zenoh-pico/collections/list.h @@ -36,7 +36,7 @@ typedef struct _z_l_t { _z_list_t *_z_list_of(void *x); size_t _z_list_len(const _z_list_t *xs); -_Bool _z_list_is_empty(const _z_list_t *xs); +bool _z_list_is_empty(const _z_list_t *xs); void *_z_list_head(const _z_list_t *xs); _z_list_t *_z_list_tail(const _z_list_t *xs); @@ -56,7 +56,7 @@ void _z_list_free(_z_list_t **xs, z_element_free_f f_f); typedef _z_list_t name##_list_t; \ static inline name##_list_t *name##_list_new(void) { return NULL; } \ static inline size_t name##_list_len(const name##_list_t *l) { return _z_list_len(l); } \ - static inline _Bool name##_list_is_empty(const name##_list_t *l) { return _z_list_is_empty(l); } \ + static inline bool name##_list_is_empty(const name##_list_t *l) { return _z_list_is_empty(l); } \ static inline type *name##_list_head(const name##_list_t *l) { return (type *)_z_list_head(l); } \ static inline name##_list_t *name##_list_tail(const name##_list_t *l) { return _z_list_tail(l); } \ static inline name##_list_t *name##_list_push(name##_list_t *l, type *e) { return _z_list_push(l, e); } \ diff --git a/include/zenoh-pico/collections/refcount.h b/include/zenoh-pico/collections/refcount.h index df6b2eadb..c005ab6a7 100644 --- a/include/zenoh-pico/collections/refcount.h +++ b/include/zenoh-pico/collections/refcount.h @@ -27,8 +27,8 @@ extern "C" { int8_t _z_rc_init(void **cnt); int8_t _z_rc_increase_strong(void *cnt); int8_t _z_rc_increase_weak(void *cnt); -_Bool _z_rc_decrease_strong(void **cnt); -_Bool _z_rc_decrease_weak(void **cnt); +bool _z_rc_decrease_strong(void **cnt); +bool _z_rc_decrease_weak(void **cnt); int8_t _z_rc_weak_upgrade(void *cnt); size_t _z_rc_weak_count(void *cnt); @@ -115,10 +115,10 @@ size_t _z_rc_strong_count(void *cnt); return c; \ } \ static inline void name##_rc_copy(name##_rc_t *dst, const name##_rc_t *p) { *dst = name##_rc_clone(p); } \ - static inline _Bool name##_rc_eq(const name##_rc_t *left, const name##_rc_t *right) { \ + static inline bool name##_rc_eq(const name##_rc_t *left, const name##_rc_t *right) { \ return (left->_val == right->_val); \ } \ - static inline _Bool name##_rc_decr(name##_rc_t *p) { \ + static inline bool name##_rc_decr(name##_rc_t *p) { \ if ((p == NULL) || (p->_cnt == NULL)) { \ return false; \ } \ @@ -127,7 +127,7 @@ size_t _z_rc_strong_count(void *cnt); } \ return false; \ } \ - static inline _Bool name##_rc_drop(name##_rc_t *p) { \ + static inline bool name##_rc_drop(name##_rc_t *p) { \ if (name##_rc_decr(p) && p->_val != NULL) { \ type##_clear(p->_val); \ z_free(p->_val); \ @@ -151,10 +151,10 @@ size_t _z_rc_strong_count(void *cnt); } \ return c; \ } \ - static inline _Bool name##_weak_eq(const name##_weak_t *left, const name##_weak_t *right) { \ + static inline bool name##_weak_eq(const name##_weak_t *left, const name##_weak_t *right) { \ return (left->_val == right->_val); \ } \ - static inline _Bool name##_weak_drop(name##_weak_t *p) { \ + static inline bool name##_weak_drop(name##_weak_t *p) { \ if ((p == NULL) || (p->_cnt == NULL)) { \ return false; \ } \ diff --git a/include/zenoh-pico/collections/ring_mt.h b/include/zenoh-pico/collections/ring_mt.h index a7702e017..f957b4e98 100644 --- a/include/zenoh-pico/collections/ring_mt.h +++ b/include/zenoh-pico/collections/ring_mt.h @@ -27,7 +27,7 @@ extern "C" { /*-------- Ring Buffer Multithreaded --------*/ typedef struct { _z_ring_t _ring; - _Bool is_closed; + bool is_closed; #if Z_FEATURE_MULTI_THREAD == 1 _z_mutex_t _mutex; _z_condvar_t _cv_not_empty; diff --git a/include/zenoh-pico/collections/slice.h b/include/zenoh-pico/collections/slice.h index 7edd952e8..fd09c0c19 100644 --- a/include/zenoh-pico/collections/slice.h +++ b/include/zenoh-pico/collections/slice.h @@ -25,7 +25,7 @@ typedef struct { } _z_delete_context_t; _z_delete_context_t _z_delete_context_null(void); -_Bool _z_delete_context_is_null(const _z_delete_context_t *c); +bool _z_delete_context_is_null(const _z_delete_context_t *c); _z_delete_context_t _z_delete_context_create(void (*deleter)(void *context, void *data), void *context); _z_delete_context_t _z_delete_context_default(void); void _z_delete_context_delete(_z_delete_context_t *c, void *data); @@ -46,7 +46,7 @@ typedef struct { } _z_slice_t; _z_slice_t _z_slice_empty(void); -inline static _Bool _z_slice_check(const _z_slice_t *slice) { return slice->start != NULL; } +inline static bool _z_slice_check(const _z_slice_t *slice) { return slice->start != NULL; } int8_t _z_slice_init(_z_slice_t *bs, size_t capacity); _z_slice_t _z_slice_make(size_t capacity); _z_slice_t _z_slice_alias_buf(const uint8_t *bs, size_t len); @@ -59,10 +59,10 @@ int8_t _z_slice_n_copy(_z_slice_t *dst, const _z_slice_t *src, size_t offset, si _z_slice_t _z_slice_duplicate(const _z_slice_t *src); void _z_slice_move(_z_slice_t *dst, _z_slice_t *src); void _z_slice_reset(_z_slice_t *bs); -_Bool _z_slice_is_empty(const _z_slice_t *bs); -_Bool _z_slice_eq(const _z_slice_t *left, const _z_slice_t *right); +bool _z_slice_is_empty(const _z_slice_t *bs); +bool _z_slice_eq(const _z_slice_t *left, const _z_slice_t *right); void _z_slice_clear(_z_slice_t *bs); void _z_slice_free(_z_slice_t **bs); -_Bool _z_slice_is_alloced(const _z_slice_t *s); +bool _z_slice_is_alloced(const _z_slice_t *s); #endif /* ZENOH_PICO_COLLECTIONS_SLICE_H */ diff --git a/include/zenoh-pico/collections/string.h b/include/zenoh-pico/collections/string.h index 4d6268bb6..04b0a0876 100644 --- a/include/zenoh-pico/collections/string.h +++ b/include/zenoh-pico/collections/string.h @@ -28,7 +28,7 @@ char *_z_str_clone(const char *src); char *_z_str_n_clone(const char *src, size_t len); void _z_str_clear(char *src); void _z_str_free(char **src); -_Bool _z_str_eq(const char *left, const char *right); +bool _z_str_eq(const char *left, const char *right); size_t _z_str_size(const char *src); void _z_str_copy(char *dst, const char *src); @@ -67,14 +67,14 @@ typedef struct { } _z_string_t; _z_string_t _z_string_null(void); -_Bool _z_string_check(const _z_string_t *value); +bool _z_string_check(const _z_string_t *value); _z_string_t _z_string_copy_from_str(const char *value); _z_string_t _z_string_copy_from_substr(const char *value, size_t len); _z_string_t *_z_string_copy_from_str_as_ptr(const char *value); _z_string_t _z_string_alias_str(const char *value); _z_string_t _z_string_alias_substr(const char *value, size_t len); _z_string_t _z_string_from_str_custom_deleter(char *value, _z_delete_context_t c); -_Bool _z_string_is_empty(const _z_string_t *s); +bool _z_string_is_empty(const _z_string_t *s); const char *_z_string_rchr(_z_string_t *str, char filter); char *_z_string_pbrk(_z_string_t *str, const char *filter); @@ -89,7 +89,7 @@ void _z_string_move_str(_z_string_t *dst, char *src); void _z_string_clear(_z_string_t *s); void _z_string_free(_z_string_t **s); void _z_string_reset(_z_string_t *s); -_Bool _z_string_equals(const _z_string_t *left, const _z_string_t *right); +bool _z_string_equals(const _z_string_t *left, const _z_string_t *right); _z_string_t _z_string_convert_bytes(const _z_slice_t *bs); _z_string_t _z_string_preallocate(const size_t len); diff --git a/include/zenoh-pico/collections/vec.h b/include/zenoh-pico/collections/vec.h index 066b72cbb..d1c12ec6b 100644 --- a/include/zenoh-pico/collections/vec.h +++ b/include/zenoh-pico/collections/vec.h @@ -33,7 +33,7 @@ _z_vec_t _z_vec_make(size_t capacity); void _z_vec_copy(_z_vec_t *dst, const _z_vec_t *src, z_element_clone_f f); size_t _z_vec_len(const _z_vec_t *v); -_Bool _z_vec_is_empty(const _z_vec_t *v); +bool _z_vec_is_empty(const _z_vec_t *v); void _z_vec_append(_z_vec_t *v, void *e); void *_z_vec_get(const _z_vec_t *v, size_t pos); @@ -49,7 +49,7 @@ void _z_vec_release(_z_vec_t *v); typedef _z_vec_t name##_vec_t; \ static inline name##_vec_t name##_vec_make(size_t capacity) { return _z_vec_make(capacity); } \ static inline size_t name##_vec_len(const name##_vec_t *v) { return _z_vec_len(v); } \ - static inline _Bool name##_vec_is_empty(const name##_vec_t *v) { return _z_vec_is_empty(v); } \ + static inline bool name##_vec_is_empty(const name##_vec_t *v) { return _z_vec_is_empty(v); } \ static inline void name##_vec_append(name##_vec_t *v, type *e) { _z_vec_append(v, e); } \ static inline type *name##_vec_get(const name##_vec_t *v, size_t pos) { return (type *)_z_vec_get(v, pos); } \ static inline void name##_vec_set(name##_vec_t *v, size_t pos, type *e) { \ @@ -75,10 +75,10 @@ typedef struct { } _z_svec_t; _z_svec_t _z_svec_make(size_t capacity, size_t element_size); -_Bool _z_svec_copy(_z_svec_t *dst, const _z_svec_t *src, z_element_copy_f copy, size_t element_size); +bool _z_svec_copy(_z_svec_t *dst, const _z_svec_t *src, z_element_copy_f copy, size_t element_size); size_t _z_svec_len(const _z_svec_t *v); -_Bool _z_svec_is_empty(const _z_svec_t *v); +bool _z_svec_is_empty(const _z_svec_t *v); bool _z_svec_append(_z_svec_t *v, const void *e, z_element_move_f m, size_t element_size); void *_z_svec_get(const _z_svec_t *v, size_t pos, size_t element_size); @@ -94,8 +94,8 @@ void _z_svec_release(_z_svec_t *v); typedef _z_svec_t name##_svec_t; \ static inline name##_svec_t name##_svec_make(size_t capacity) { return _z_svec_make(capacity, sizeof(type)); } \ static inline size_t name##_svec_len(const name##_svec_t *v) { return _z_svec_len(v); } \ - static inline _Bool name##_svec_is_empty(const name##_svec_t *v) { return _z_svec_is_empty(v); } \ - static inline _Bool name##_svec_append(name##_svec_t *v, type *e) { \ + static inline bool name##_svec_is_empty(const name##_svec_t *v) { return _z_svec_is_empty(v); } \ + static inline bool name##_svec_append(name##_svec_t *v, type *e) { \ return _z_svec_append(v, e, name##_elem_move, sizeof(type)); \ } \ static inline type *name##_svec_get(const name##_svec_t *v, size_t pos) { \ @@ -107,7 +107,7 @@ void _z_svec_release(_z_svec_t *v); static inline void name##_svec_remove(name##_svec_t *v, size_t pos) { \ _z_svec_remove(v, pos, name##_elem_clear, name##_elem_move, sizeof(type)); \ } \ - static inline _Bool name##_svec_copy(name##_svec_t *dst, const name##_svec_t *src) { \ + static inline bool name##_svec_copy(name##_svec_t *dst, const name##_svec_t *src) { \ return _z_svec_copy(dst, src, name##_elem_copy, sizeof(type)); \ } \ static inline void name##_svec_reset(name##_svec_t *v) { _z_svec_reset(v, name##_elem_clear, sizeof(type)); } \ diff --git a/include/zenoh-pico/config.h b/include/zenoh-pico/config.h index 1230a0a4b..7cdc80718 100644 --- a/include/zenoh-pico/config.h +++ b/include/zenoh-pico/config.h @@ -21,7 +21,7 @@ #define Z_BATCH_MULTICAST_SIZE 2048 #define Z_CONFIG_SOCKET_TIMEOUT 100 -#define Z_FEATURE_UNSTABLE_API 0 +#define Z_FEATURE_UNSTABLE_API 1 #define Z_FEATURE_MULTI_THREAD 1 #define Z_FEATURE_PUBLICATION 1 #define Z_FEATURE_SUBSCRIPTION 1 diff --git a/include/zenoh-pico/link/endpoint.h b/include/zenoh-pico/link/endpoint.h index f9dd2efa3..689046b6b 100644 --- a/include/zenoh-pico/link/endpoint.h +++ b/include/zenoh-pico/link/endpoint.h @@ -46,7 +46,7 @@ typedef struct { _z_string_t _address; } _z_locator_t; -_Bool _z_locator_eq(const _z_locator_t *left, const _z_locator_t *right); +bool _z_locator_eq(const _z_locator_t *left, const _z_locator_t *right); void _z_locator_init(_z_locator_t *locator); _z_string_t _z_locator_to_string(const _z_locator_t *loc); diff --git a/include/zenoh-pico/net/encoding.h b/include/zenoh-pico/net/encoding.h index acd9061ec..7e92c5699 100644 --- a/include/zenoh-pico/net/encoding.h +++ b/include/zenoh-pico/net/encoding.h @@ -31,7 +31,7 @@ int8_t _z_encoding_make(_z_encoding_t *encoding, uint16_t id, const char *schema _z_encoding_t _z_encoding_wrap(uint16_t id, const char *schema); _z_encoding_t _z_encoding_null(void); void _z_encoding_clear(_z_encoding_t *encoding); -_Bool _z_encoding_check(const _z_encoding_t *encoding); +bool _z_encoding_check(const _z_encoding_t *encoding); int8_t _z_encoding_copy(_z_encoding_t *dst, const _z_encoding_t *src); void _z_encoding_move(_z_encoding_t *dst, _z_encoding_t *src); _z_encoding_t _z_encoding_steal(_z_encoding_t *val); diff --git a/include/zenoh-pico/net/filtering.h b/include/zenoh-pico/net/filtering.h index 57e12c01a..9327a0c34 100644 --- a/include/zenoh-pico/net/filtering.h +++ b/include/zenoh-pico/net/filtering.h @@ -43,6 +43,6 @@ typedef struct _z_publisher_t _z_publisher_t; int8_t _z_write_filter_create(_z_publisher_t *pub); int8_t _z_write_filter_destroy(const _z_publisher_t *pub); -_Bool _z_write_filter_active(const _z_publisher_t *pub); +bool _z_write_filter_active(const _z_publisher_t *pub); #endif /* ZENOH_PICO_FILTERING_NETAPI_H */ diff --git a/include/zenoh-pico/net/primitives.h b/include/zenoh-pico/net/primitives.h index 4a0387e37..682e0e720 100644 --- a/include/zenoh-pico/net/primitives.h +++ b/include/zenoh-pico/net/primitives.h @@ -90,7 +90,7 @@ int8_t _z_undeclare_resource(_z_session_t *zn, uint16_t rid); * The created :c:type:`_z_publisher_t` (in null state if the declaration failed).. */ _z_publisher_t _z_declare_publisher(const _z_session_rc_t *zn, _z_keyexpr_t keyexpr, _z_encoding_t *encoding, - z_congestion_control_t congestion_control, z_priority_t priority, _Bool is_express, + z_congestion_control_t congestion_control, z_priority_t priority, bool is_express, z_reliability_t reliability); /** @@ -126,7 +126,7 @@ int8_t _z_undeclare_publisher(_z_publisher_t *pub); */ int8_t _z_write(_z_session_t *zn, const _z_keyexpr_t keyexpr, _z_bytes_t payload, const _z_encoding_t *encoding, const z_sample_kind_t kind, const z_congestion_control_t cong_ctrl, z_priority_t priority, - _Bool is_express, const _z_timestamp_t *timestamp, const _z_bytes_t attachment, + bool is_express, const _z_timestamp_t *timestamp, const _z_bytes_t attachment, z_reliability_t reliability); #endif @@ -174,7 +174,7 @@ int8_t _z_undeclare_subscriber(_z_subscriber_t *sub); * Returns: * The created :c:type:`_z_queryable_t` (in null state if the declaration failed).. */ -_z_queryable_t _z_declare_queryable(const _z_session_rc_t *zn, _z_keyexpr_t keyexpr, _Bool complete, +_z_queryable_t _z_declare_queryable(const _z_session_rc_t *zn, _z_keyexpr_t keyexpr, bool complete, _z_queryable_handler_t callback, _z_drop_handler_t dropper, void *arg); /** @@ -205,7 +205,7 @@ int8_t _z_undeclare_queryable(_z_queryable_t *qle); */ int8_t _z_send_reply(const _z_query_t *query, const _z_session_rc_t *zsrc, const _z_keyexpr_t keyexpr, const _z_value_t payload, const z_sample_kind_t kind, const z_congestion_control_t cong_ctrl, - z_priority_t priority, _Bool is_express, const _z_timestamp_t *timestamp, + z_priority_t priority, bool is_express, const _z_timestamp_t *timestamp, const _z_bytes_t attachment); /** * Send a reply error to a query. @@ -247,7 +247,7 @@ int8_t _z_send_reply_err(const _z_query_t *query, const _z_session_rc_t *zsrc, c int8_t _z_query(_z_session_t *zn, _z_keyexpr_t keyexpr, const char *parameters, const z_query_target_t target, const z_consolidation_mode_t consolidation, const _z_value_t value, _z_reply_handler_t callback, _z_drop_handler_t dropper, void *arg, uint64_t timeout_ms, const _z_bytes_t attachment, - z_congestion_control_t cong_ctrl, z_priority_t priority, _Bool is_express); + z_congestion_control_t cong_ctrl, z_priority_t priority, bool is_express); #endif #if Z_FEATURE_INTEREST == 1 diff --git a/include/zenoh-pico/net/publish.h b/include/zenoh-pico/net/publish.h index 58c632d38..21a8b500f 100644 --- a/include/zenoh-pico/net/publish.h +++ b/include/zenoh-pico/net/publish.h @@ -30,7 +30,7 @@ typedef struct _z_publisher_t { z_congestion_control_t _congestion_control; z_priority_t _priority; z_reliability_t reliability; - _Bool _is_express; + bool _is_express; #if Z_FEATURE_INTEREST == 1 _z_write_filter_t _filter; #endif @@ -39,7 +39,7 @@ typedef struct _z_publisher_t { #if Z_FEATURE_PUBLICATION == 1 void _z_publisher_clear(_z_publisher_t *pub); void _z_publisher_free(_z_publisher_t **pub); -_Bool _z_publisher_check(const _z_publisher_t *publisher); +bool _z_publisher_check(const _z_publisher_t *publisher); _z_publisher_t _z_publisher_null(void); #endif diff --git a/include/zenoh-pico/net/query.h b/include/zenoh-pico/net/query.h index 6800d8b0c..12c70d6b2 100644 --- a/include/zenoh-pico/net/query.h +++ b/include/zenoh-pico/net/query.h @@ -31,7 +31,7 @@ typedef struct _z_query_t { _z_session_weak_t _zn; // Can't be an rc because of cross referencing _z_bytes_t attachment; char *_parameters; - _Bool _anyke; + bool _anyke; } _z_query_t; _z_query_t _z_query_null(void); @@ -55,7 +55,7 @@ _z_query_t _z_query_create(_z_value_t *value, _z_keyexpr_t *key, const _z_slice_ void _z_queryable_clear(_z_queryable_t *qbl); void _z_queryable_free(_z_queryable_t **qbl); _z_queryable_t _z_queryable_null(void); -_Bool _z_queryable_check(const _z_queryable_t *queryable); +bool _z_queryable_check(const _z_queryable_t *queryable); #endif #endif /* ZENOH_PICO_QUERY_NETAPI_H */ diff --git a/include/zenoh-pico/net/reply.h b/include/zenoh-pico/net/reply.h index b40658d3c..b3f78b6a2 100644 --- a/include/zenoh-pico/net/reply.h +++ b/include/zenoh-pico/net/reply.h @@ -91,7 +91,7 @@ typedef struct _z_pending_reply_t { _z_timestamp_t _tstamp; } _z_pending_reply_t; -_Bool _z_pending_reply_eq(const _z_pending_reply_t *one, const _z_pending_reply_t *two); +bool _z_pending_reply_eq(const _z_pending_reply_t *one, const _z_pending_reply_t *two); void _z_pending_reply_clear(_z_pending_reply_t *res); _Z_ELEM_DEFINE(_z_pending_reply, _z_pending_reply_t, _z_noop_size, _z_pending_reply_clear, _z_noop_copy) diff --git a/include/zenoh-pico/net/sample.h b/include/zenoh-pico/net/sample.h index 2cc11fbd8..ee8720077 100644 --- a/include/zenoh-pico/net/sample.h +++ b/include/zenoh-pico/net/sample.h @@ -41,7 +41,7 @@ typedef struct _z_sample_t { void _z_sample_clear(_z_sample_t *sample); _z_sample_t _z_sample_null(void); -_Bool _z_sample_check(const _z_sample_t *sample); +bool _z_sample_check(const _z_sample_t *sample); void _z_sample_move(_z_sample_t *dst, _z_sample_t *src); /** diff --git a/include/zenoh-pico/net/subscribe.h b/include/zenoh-pico/net/subscribe.h index 2edf7370f..4cf0cb4d4 100644 --- a/include/zenoh-pico/net/subscribe.h +++ b/include/zenoh-pico/net/subscribe.h @@ -32,7 +32,7 @@ typedef struct { void _z_subscriber_clear(_z_subscriber_t *sub); void _z_subscriber_free(_z_subscriber_t **sub); -_Bool _z_subscriber_check(const _z_subscriber_t *subscriber); +bool _z_subscriber_check(const _z_subscriber_t *subscriber); _z_subscriber_t _z_subscriber_null(void); #endif diff --git a/include/zenoh-pico/protocol/codec/core.h b/include/zenoh-pico/protocol/codec/core.h index 53857ba00..29afa1005 100644 --- a/include/zenoh-pico/protocol/codec/core.h +++ b/include/zenoh-pico/protocol/codec/core.h @@ -77,8 +77,8 @@ int8_t _z_encoding_decode(_z_encoding_t *en, _z_zbuf_t *zbf); int8_t _z_value_encode(_z_wbuf_t *wbf, const _z_value_t *en); int8_t _z_value_decode(_z_value_t *en, _z_zbuf_t *zbf); -int8_t _z_keyexpr_encode(_z_wbuf_t *buf, _Bool has_suffix, const _z_keyexpr_t *ke); -int8_t _z_keyexpr_decode(_z_keyexpr_t *ke, _z_zbuf_t *buf, _Bool has_suffix); +int8_t _z_keyexpr_encode(_z_wbuf_t *buf, bool has_suffix, const _z_keyexpr_t *ke); +int8_t _z_keyexpr_decode(_z_keyexpr_t *ke, _z_zbuf_t *buf, bool has_suffix); int8_t _z_timestamp_encode(_z_wbuf_t *buf, const _z_timestamp_t *ts); int8_t _z_timestamp_encode_ext(_z_wbuf_t *buf, const _z_timestamp_t *ts); diff --git a/include/zenoh-pico/protocol/codec/ext.h b/include/zenoh-pico/protocol/codec/ext.h index d8c086566..544d79bdd 100644 --- a/include/zenoh-pico/protocol/codec/ext.h +++ b/include/zenoh-pico/protocol/codec/ext.h @@ -22,9 +22,9 @@ #include "zenoh-pico/protocol/iobuf.h" /*------------------ Message Extension ------------------*/ -int8_t _z_msg_ext_encode(_z_wbuf_t *wbf, const _z_msg_ext_t *ext, _Bool has_next); -int8_t _z_msg_ext_decode(_z_msg_ext_t *ext, _z_zbuf_t *zbf, _Bool *has_next); -int8_t _z_msg_ext_decode_na(_z_msg_ext_t *ext, _z_zbuf_t *zbf, _Bool *has_next); +int8_t _z_msg_ext_encode(_z_wbuf_t *wbf, const _z_msg_ext_t *ext, bool has_next); +int8_t _z_msg_ext_decode(_z_msg_ext_t *ext, _z_zbuf_t *zbf, bool *has_next); +int8_t _z_msg_ext_decode_na(_z_msg_ext_t *ext, _z_zbuf_t *zbf, bool *has_next); int8_t _z_msg_ext_vec_encode(_z_wbuf_t *wbf, const _z_msg_ext_vec_t *extensions); int8_t _z_msg_ext_vec_decode(_z_msg_ext_vec_t *extensions, _z_zbuf_t *zbf); /** diff --git a/include/zenoh-pico/protocol/codec/interest.h b/include/zenoh-pico/protocol/codec/interest.h index 239144870..f86d08987 100644 --- a/include/zenoh-pico/protocol/codec/interest.h +++ b/include/zenoh-pico/protocol/codec/interest.h @@ -18,7 +18,7 @@ #include "zenoh-pico/protocol/definitions/interest.h" #include "zenoh-pico/protocol/iobuf.h" -int8_t _z_interest_encode(_z_wbuf_t *wbf, const _z_interest_t *interest, _Bool is_final); -int8_t _z_interest_decode(_z_interest_t *decl, _z_zbuf_t *zbf, _Bool is_final, _Bool has_ext); +int8_t _z_interest_encode(_z_wbuf_t *wbf, const _z_interest_t *interest, bool is_final); +int8_t _z_interest_decode(_z_interest_t *decl, _z_zbuf_t *zbf, bool is_final, bool has_ext); #endif /* INCLUDE_ZENOH_PICO_PROTOCOL_CODEC_DECLARATIONS_H */ diff --git a/include/zenoh-pico/protocol/core.h b/include/zenoh-pico/protocol/core.h index 2fd9a76ec..be010dd6b 100644 --- a/include/zenoh-pico/protocol/core.h +++ b/include/zenoh-pico/protocol/core.h @@ -55,7 +55,7 @@ typedef struct { uint8_t id[16]; } _z_id_t; uint8_t _z_id_len(_z_id_t id); -_Bool _z_id_check(_z_id_t id); +bool _z_id_check(_z_id_t id); _z_id_t _z_id_empty(void); /** @@ -69,7 +69,7 @@ typedef struct { _z_timestamp_t _z_timestamp_duplicate(const _z_timestamp_t *tstamp); _z_timestamp_t _z_timestamp_null(void); void _z_timestamp_clear(_z_timestamp_t *tstamp); -_Bool _z_timestamp_check(const _z_timestamp_t *stamp); +bool _z_timestamp_check(const _z_timestamp_t *stamp); uint64_t _z_timestamp_ntp64_from_time(uint32_t seconds, uint32_t nanos); /** @@ -101,7 +101,7 @@ typedef struct { } _z_keyexpr_t; static inline uint16_t _z_keyexpr_mapping_id(const _z_keyexpr_t *key) { return key->_mapping._val & 0x7fff; } -static inline _Bool _z_keyexpr_is_local(const _z_keyexpr_t *key) { +static inline bool _z_keyexpr_is_local(const _z_keyexpr_t *key) { return (key->_mapping._val & 0x7fff) == _Z_KEYEXPR_MAPPING_LOCAL; } static inline _z_mapping_t _z_keyexpr_mapping(uint16_t id) { @@ -119,8 +119,8 @@ static inline void _z_keyexpr_fix_mapping(_z_keyexpr_t *ke, uint16_t id) { _z_keyexpr_set_mapping(ke, id); } } -static inline _Bool _z_keyexpr_has_suffix(const _z_keyexpr_t *ke) { return _z_string_check(&ke->_suffix); } -static inline _Bool _z_keyexpr_check(const _z_keyexpr_t *ke) { return (ke->_id != 0) || _z_keyexpr_has_suffix(ke); } +static inline bool _z_keyexpr_has_suffix(const _z_keyexpr_t *ke) { return _z_string_check(&ke->_suffix); } +static inline bool _z_keyexpr_check(const _z_keyexpr_t *ke) { return (ke->_id != 0) || _z_keyexpr_has_suffix(ke); } /** * Create a resource key from a resource name. @@ -188,7 +188,7 @@ void _z_hello_clear(_z_hello_t *src); void _z_hello_free(_z_hello_t **hello); int8_t _z_hello_copy(_z_hello_t *dst, const _z_hello_t *src); _z_hello_t _z_hello_null(void); -_Bool _z_hello_check(const _z_hello_t *hello); +bool _z_hello_check(const _z_hello_t *hello); _Z_ELEM_DEFINE(_z_hello, _z_hello_t, _z_noop_size, _z_hello_clear, _z_noop_copy) _Z_LIST_DEFINE(_z_hello, _z_hello_t) diff --git a/include/zenoh-pico/protocol/definitions/declarations.h b/include/zenoh-pico/protocol/definitions/declarations.h index c9bc3c9b6..c33cab627 100644 --- a/include/zenoh-pico/protocol/definitions/declarations.h +++ b/include/zenoh-pico/protocol/definitions/declarations.h @@ -45,7 +45,7 @@ typedef struct { _z_keyexpr_t _keyexpr; uint32_t _id; struct { - _Bool _complete; + bool _complete; uint16_t _distance; } _ext_queryable_info; } _z_decl_queryable_t; @@ -68,7 +68,7 @@ typedef struct { _z_undecl_token_t _z_undecl_token_null(void); typedef struct { - _Bool _placeholder; // In case we add extensions + bool _placeholder; // In case we add extensions } _z_decl_final_t; _z_decl_final_t _z_decl_final_null(void); @@ -105,7 +105,7 @@ _z_declaration_t _z_make_undecl_keyexpr(uint16_t id); _z_declaration_t _z_make_decl_subscriber(_Z_MOVE(_z_keyexpr_t) key, uint32_t id); _z_declaration_t _z_make_undecl_subscriber(uint32_t id, _Z_OPTIONAL const _z_keyexpr_t* key); -_z_declaration_t _z_make_decl_queryable(_Z_MOVE(_z_keyexpr_t) key, uint32_t id, _Bool complete, uint16_t distance); +_z_declaration_t _z_make_decl_queryable(_Z_MOVE(_z_keyexpr_t) key, uint32_t id, bool complete, uint16_t distance); _z_declaration_t _z_make_undecl_queryable(uint32_t id, _Z_OPTIONAL const _z_keyexpr_t* key); _z_declaration_t _z_make_decl_token(_Z_MOVE(_z_keyexpr_t) key, uint32_t id); diff --git a/include/zenoh-pico/protocol/definitions/message.h b/include/zenoh-pico/protocol/definitions/message.h index d58ec38f9..5d43defa4 100644 --- a/include/zenoh-pico/protocol/definitions/message.h +++ b/include/zenoh-pico/protocol/definitions/message.h @@ -104,15 +104,15 @@ typedef struct { _z_bytes_t _ext_attachment; } _z_msg_query_t; typedef struct { - _Bool info; - _Bool body; - _Bool attachment; + bool info; + bool body; + bool attachment; } _z_msg_query_reqexts_t; _z_msg_query_reqexts_t _z_msg_query_required_extensions(const _z_msg_query_t *msg); void _z_msg_query_clear(_z_msg_query_t *msg); typedef struct { - _Bool _is_put; + bool _is_put; union { _z_msg_del_t _del; _z_msg_put_t _put; diff --git a/include/zenoh-pico/protocol/definitions/network.h b/include/zenoh-pico/protocol/definitions/network.h index 794321349..f0cd40f01 100644 --- a/include/zenoh-pico/protocol/definitions/network.h +++ b/include/zenoh-pico/protocol/definitions/network.h @@ -75,10 +75,9 @@ typedef _z_qos_t _z_n_qos_t; -static inline _z_qos_t _z_n_qos_create(_Bool express, z_congestion_control_t congestion_control, - z_priority_t priority) { +static inline _z_qos_t _z_n_qos_create(bool express, z_congestion_control_t congestion_control, z_priority_t priority) { _z_n_qos_t ret; - _Bool nodrop = congestion_control == Z_CONGESTION_CONTROL_DROP ? 0 : 1; + bool nodrop = congestion_control == Z_CONGESTION_CONTROL_DROP ? 0 : 1; ret._val = (uint8_t)((express << 4) | (nodrop << 3) | priority); return ret; } @@ -88,9 +87,9 @@ static inline z_priority_t _z_n_qos_get_priority(_z_n_qos_t n_qos) { static inline z_congestion_control_t _z_n_qos_get_congestion_control(_z_n_qos_t n_qos) { return (n_qos._val & 0x08 /* 0b1000 */) ? Z_CONGESTION_CONTROL_BLOCK : Z_CONGESTION_CONTROL_DROP; } -static inline _Bool _z_n_qos_get_express(_z_n_qos_t n_qos) { return (_Bool)(n_qos._val & 0x10 /* 0b10000 */); } -#define _z_n_qos_make(express, nodrop, priority) \ - _z_n_qos_create((_Bool)express, nodrop ? Z_CONGESTION_CONTROL_BLOCK : Z_CONGESTION_CONTROL_DROP, \ +static inline bool _z_n_qos_get_express(_z_n_qos_t n_qos) { return (bool)(n_qos._val & 0x10 /* 0b10000 */); } +#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) #define _Z_N_QOS_DEFAULT _z_n_qos_make(0, 0, 5) @@ -139,11 +138,11 @@ typedef struct { } _body; } _z_n_msg_request_t; typedef struct { - _Bool ext_qos; - _Bool ext_tstamp; - _Bool ext_target; - _Bool ext_budget; - _Bool ext_timeout_ms; + bool ext_qos; + bool ext_tstamp; + bool ext_target; + bool ext_budget; + bool ext_timeout_ms; uint8_t n; } _z_n_msg_request_exts_t; _z_n_msg_request_exts_t _z_n_msg_request_needed_exts(const _z_n_msg_request_t *msg); @@ -226,7 +225,7 @@ typedef struct { _z_timestamp_t _ext_timestamp; _z_n_qos_t _ext_qos; uint32_t _interest_id; - _Bool has_interest_id; + bool has_interest_id; } _z_n_msg_declare_t; static inline void _z_n_msg_declare_clear(_z_n_msg_declare_t *msg) { _z_declaration_clear(&msg->_decl); } @@ -295,10 +294,10 @@ void _z_msg_fix_mapping(_z_zenoh_message_t *msg, uint16_t mapping); _z_network_message_t _z_msg_make_query(_Z_MOVE(_z_keyexpr_t) key, _Z_MOVE(_z_slice_t) parameters, _z_zint_t qid, z_consolidation_mode_t consolidation, _Z_MOVE(_z_value_t) value, uint64_t timeout_ms, _z_bytes_t attachment, z_congestion_control_t cong_ctrl, - z_priority_t priority, _Bool is_express); + z_priority_t priority, bool is_express); _z_network_message_t _z_n_msg_make_reply(_z_zint_t rid, _Z_MOVE(_z_keyexpr_t) key, _Z_MOVE(_z_push_body_t) body); _z_network_message_t _z_n_msg_make_response_final(_z_zint_t rid); -_z_network_message_t _z_n_msg_make_declare(_z_declaration_t declaration, _Bool has_interest_id, uint32_t interest_id); +_z_network_message_t _z_n_msg_make_declare(_z_declaration_t declaration, bool has_interest_id, uint32_t interest_id); _z_network_message_t _z_n_msg_make_push(_Z_MOVE(_z_keyexpr_t) key, _Z_MOVE(_z_push_body_t) body); _z_network_message_t _z_n_msg_make_interest(_z_interest_t interest); diff --git a/include/zenoh-pico/protocol/definitions/transport.h b/include/zenoh-pico/protocol/definitions/transport.h index 28e5d8ee9..7334f391a 100644 --- a/include/zenoh-pico/protocol/definitions/transport.h +++ b/include/zenoh-pico/protocol/definitions/transport.h @@ -220,7 +220,7 @@ typedef struct { _z_coundit_sn_t _plain; _z_coundit_sn_t _qos[Z_PRIORITIES_NUM]; } _val; - _Bool _is_qos; + bool _is_qos; } _z_conduit_sn_list_t; typedef struct { _z_id_t _zid; @@ -505,14 +505,14 @@ _z_transport_message_t _z_t_msg_make_init_syn(z_whatami_t whatami, _z_id_t zid); _z_transport_message_t _z_t_msg_make_init_ack(z_whatami_t whatami, _z_id_t zid, _z_slice_t cookie); _z_transport_message_t _z_t_msg_make_open_syn(_z_zint_t lease, _z_zint_t initial_sn, _z_slice_t cookie); _z_transport_message_t _z_t_msg_make_open_ack(_z_zint_t lease, _z_zint_t initial_sn); -_z_transport_message_t _z_t_msg_make_close(uint8_t reason, _Bool link_only); +_z_transport_message_t _z_t_msg_make_close(uint8_t reason, bool link_only); _z_transport_message_t _z_t_msg_make_keep_alive(void); _z_transport_message_t _z_t_msg_make_frame(_z_zint_t sn, _z_network_message_vec_t messages, z_reliability_t reliability); _z_transport_message_t _z_t_msg_make_frame_header(_z_zint_t sn, z_reliability_t reliability); -_z_transport_message_t _z_t_msg_make_fragment_header(_z_zint_t sn, z_reliability_t reliability, _Bool is_last); +_z_transport_message_t _z_t_msg_make_fragment_header(_z_zint_t sn, z_reliability_t reliability, bool is_last); _z_transport_message_t _z_t_msg_make_fragment(_z_zint_t sn, _z_slice_t messages, z_reliability_t reliability, - _Bool is_last); + bool is_last); /*------------------ Copy ------------------*/ void _z_t_msg_copy(_z_transport_message_t *clone, _z_transport_message_t *msg); diff --git a/include/zenoh-pico/protocol/iobuf.h b/include/zenoh-pico/protocol/iobuf.h index 1f29a9b56..7a60a5f4a 100644 --- a/include/zenoh-pico/protocol/iobuf.h +++ b/include/zenoh-pico/protocol/iobuf.h @@ -30,7 +30,7 @@ typedef struct { size_t _w_pos; size_t _capacity; uint8_t *_buf; - _Bool _is_alloc; + bool _is_alloc; } _z_iosli_t; _z_iosli_t _z_iosli_make(size_t capacity); @@ -72,7 +72,7 @@ _z_zbuf_t _z_slice_as_zbuf(_z_slice_t slice); size_t _z_zbuf_capacity(const _z_zbuf_t *zbf); uint8_t const *_z_zbuf_start(const _z_zbuf_t *zbf); size_t _z_zbuf_len(const _z_zbuf_t *zbf); -_Bool _z_zbuf_can_read(const _z_zbuf_t *zbf); +bool _z_zbuf_can_read(const _z_zbuf_t *zbf); size_t _z_zbuf_space_left(const _z_zbuf_t *zbf); uint8_t _z_zbuf_read(_z_zbuf_t *zbf); @@ -101,7 +101,7 @@ typedef struct { size_t _expansion_step; } _z_wbuf_t; -_z_wbuf_t _z_wbuf_make(size_t capacity, _Bool is_expandable); +_z_wbuf_t _z_wbuf_make(size_t capacity, bool is_expandable); size_t _z_wbuf_capacity(const _z_wbuf_t *wbf); size_t _z_wbuf_len(const _z_wbuf_t *wbf); diff --git a/include/zenoh-pico/protocol/keyexpr.h b/include/zenoh-pico/protocol/keyexpr.h index e475f8761..047cd6d4c 100644 --- a/include/zenoh-pico/protocol/keyexpr.h +++ b/include/zenoh-pico/protocol/keyexpr.h @@ -21,9 +21,9 @@ zp_keyexpr_canon_status_t _z_keyexpr_is_canon(const char *start, size_t len); zp_keyexpr_canon_status_t _z_keyexpr_canonize(char *start, size_t *len); -_Bool _z_keyexpr_suffix_includes(const _z_keyexpr_t *left, const _z_keyexpr_t *right); -_Bool _z_keyexpr_suffix_intersects(const _z_keyexpr_t *left, const _z_keyexpr_t *right); -_Bool _z_keyexpr_suffix_equals(const _z_keyexpr_t *left, const _z_keyexpr_t *right); +bool _z_keyexpr_suffix_includes(const _z_keyexpr_t *left, const _z_keyexpr_t *right); +bool _z_keyexpr_suffix_intersects(const _z_keyexpr_t *left, const _z_keyexpr_t *right); +bool _z_keyexpr_suffix_equals(const _z_keyexpr_t *left, const _z_keyexpr_t *right); /*------------------ clone/Copy/Free helpers ------------------*/ _z_keyexpr_t _z_keyexpr_from_string(uint16_t rid, _z_string_t *str); @@ -34,13 +34,13 @@ _z_keyexpr_t _z_keyexpr_alias(_z_keyexpr_t src); /// Returns either keyexpr defined by id + mapping with null suffix if try_declared is true and id is non-zero, /// or keyexpr defined by its suffix only, with 0 id and no mapping. This is to be used only when forwarding /// keyexpr in user api to properly separate declared keyexpr from its suffix. -_z_keyexpr_t _z_keyexpr_alias_from_user_defined(_z_keyexpr_t src, _Bool try_declared); +_z_keyexpr_t _z_keyexpr_alias_from_user_defined(_z_keyexpr_t src, bool try_declared); _z_keyexpr_t _z_keyexpr_steal(_Z_MOVE(_z_keyexpr_t) src); static inline _z_keyexpr_t _z_keyexpr_null(void) { _z_keyexpr_t keyexpr = {0, {0}, _z_string_null()}; return keyexpr; } -_Bool _z_keyexpr_equals(const _z_keyexpr_t *left, const _z_keyexpr_t *right); +bool _z_keyexpr_equals(const _z_keyexpr_t *left, const _z_keyexpr_t *right); void _z_keyexpr_move(_z_keyexpr_t *dst, _z_keyexpr_t *src); void _z_keyexpr_clear(_z_keyexpr_t *rk); void _z_keyexpr_free(_z_keyexpr_t **rk); diff --git a/include/zenoh-pico/session/session.h b/include/zenoh-pico/session/session.h index 592a483ae..80e5609e8 100644 --- a/include/zenoh-pico/session/session.h +++ b/include/zenoh-pico/session/session.h @@ -40,7 +40,7 @@ typedef struct { uint16_t _refcount; } _z_resource_t; -_Bool _z_resource_eq(const _z_resource_t *one, const _z_resource_t *two); +bool _z_resource_eq(const _z_resource_t *one, const _z_resource_t *two); void _z_resource_clear(_z_resource_t *res); void _z_resource_copy(_z_resource_t *dst, const _z_resource_t *src); void _z_resource_free(_z_resource_t **res); @@ -65,7 +65,7 @@ typedef struct { void *_arg; } _z_subscription_t; -_Bool _z_subscription_eq(const _z_subscription_t *one, const _z_subscription_t *two); +bool _z_subscription_eq(const _z_subscription_t *one, const _z_subscription_t *two); void _z_subscription_clear(_z_subscription_t *sub); _Z_REFCOUNT_DEFINE(_z_subscription, _z_subscription) @@ -93,10 +93,10 @@ typedef struct { _z_queryable_handler_t _callback; _z_drop_handler_t _dropper; void *_arg; - _Bool _complete; + bool _complete; } _z_session_queryable_t; -_Bool _z_session_queryable_eq(const _z_session_queryable_t *one, const _z_session_queryable_t *two); +bool _z_session_queryable_eq(const _z_session_queryable_t *one, const _z_session_queryable_t *two); void _z_session_queryable_clear(_z_session_queryable_t *res); _Z_REFCOUNT_DEFINE(_z_session_queryable, _z_session_queryable) @@ -125,10 +125,10 @@ typedef struct { _z_pending_reply_list_t *_pending_replies; z_query_target_t _target; z_consolidation_mode_t _consolidation; - _Bool _anykey; + bool _anykey; } _z_pending_query_t; -_Bool _z_pending_query_eq(const _z_pending_query_t *one, const _z_pending_query_t *two); +bool _z_pending_query_eq(const _z_pending_query_t *one, const _z_pending_query_t *two); void _z_pending_query_clear(_z_pending_query_t *res); _Z_ELEM_DEFINE(_z_pending_query, _z_pending_query_t, _z_noop_size, _z_pending_query_clear, _z_noop_copy) @@ -178,7 +178,7 @@ typedef struct { uint8_t _flags; } _z_session_interest_t; -_Bool _z_session_interest_eq(const _z_session_interest_t *one, const _z_session_interest_t *two); +bool _z_session_interest_eq(const _z_session_interest_t *one, const _z_session_interest_t *two); void _z_session_interest_clear(_z_session_interest_t *res); _Z_REFCOUNT_DEFINE(_z_session_interest, _z_session_interest) diff --git a/include/zenoh-pico/session/utils.h b/include/zenoh-pico/session/utils.h index 5e125556a..7a7a9d504 100644 --- a/include/zenoh-pico/session/utils.h +++ b/include/zenoh-pico/session/utils.h @@ -24,7 +24,7 @@ /*------------------ Session ------------------*/ _z_hello_list_t *_z_scout_inner(const z_what_t what, _z_id_t id, _z_string_t *locator, const uint32_t timeout, - const _Bool exit_on_first); + const bool exit_on_first); int8_t _z_session_init(_z_session_rc_t *zsrc, _z_id_t *zid); void _z_session_clear(_z_session_t *zn); diff --git a/include/zenoh-pico/system/link/raweth.h b/include/zenoh-pico/system/link/raweth.h index af725a12b..0bbdc5f0a 100644 --- a/include/zenoh-pico/system/link/raweth.h +++ b/include/zenoh-pico/system/link/raweth.h @@ -37,7 +37,7 @@ typedef struct { _z_keyexpr_t _keyexpr; uint16_t _vlan; // vlan tag (pcp + dei + id), big endian uint8_t _dmac[_ZP_MAC_ADDR_LENGTH]; - _Bool _has_vlan; + bool _has_vlan; } _zp_raweth_mapping_entry_t; void _z_raweth_clear_mapping_entry(_zp_raweth_mapping_entry_t *entry); @@ -79,7 +79,7 @@ typedef struct { uint16_t _ethtype; uint8_t _dmac[_ZP_MAC_ADDR_LENGTH]; uint8_t _smac[_ZP_MAC_ADDR_LENGTH]; - _Bool _has_vlan; + bool _has_vlan; } _z_raweth_socket_t; int8_t _z_open_raweth(_z_sys_net_socket_t *sock, const char *interface); diff --git a/include/zenoh-pico/system/platform/arduino/opencr.h b/include/zenoh-pico/system/platform/arduino/opencr.h index 44b0f4a8f..c9c374d2d 100644 --- a/include/zenoh-pico/system/platform/arduino/opencr.h +++ b/include/zenoh-pico/system/platform/arduino/opencr.h @@ -42,7 +42,7 @@ typedef struct { #if Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1 WiFiUDP *_udp; // As pointer to cross the boundary between C and C++ #endif - _Bool _err; + bool _err; }; } _z_sys_net_socket_t; @@ -57,7 +57,7 @@ typedef struct { __z_net_iptcp_addr_t _iptcp; #endif }; - _Bool _err; + bool _err; } _z_sys_net_endpoint_t; #endif /* ZENOH_PICO_SYSTEM_ARDUINO_OPENCR_TYPES_H */ diff --git a/include/zenoh-pico/system/platform/espidf.h b/include/zenoh-pico/system/platform/espidf.h index aa09362b4..1f35832a6 100644 --- a/include/zenoh-pico/system/platform/espidf.h +++ b/include/zenoh-pico/system/platform/espidf.h @@ -30,7 +30,7 @@ typedef struct { UBaseType_t priority; size_t stack_depth; #if (configSUPPORT_STATIC_ALLOCATION == 1) - _Bool static_allocation; + bool static_allocation; StackType_t *stack_buffer; StaticTask_t *task_buffer; #endif /* SUPPORT_STATIC_ALLOCATION */ diff --git a/include/zenoh-pico/system/platform/freertos_plus_tcp.h b/include/zenoh-pico/system/platform/freertos_plus_tcp.h index 81ea0389a..7332889c5 100644 --- a/include/zenoh-pico/system/platform/freertos_plus_tcp.h +++ b/include/zenoh-pico/system/platform/freertos_plus_tcp.h @@ -24,7 +24,7 @@ typedef struct { UBaseType_t priority; size_t stack_depth; #if (configSUPPORT_STATIC_ALLOCATION == 1) - _Bool static_allocation; + bool static_allocation; StackType_t *stack_buffer; StaticTask_t *task_buffer; #endif /* SUPPORT_STATIC_ALLOCATION */ diff --git a/include/zenoh-pico/system/platform/mbed.h b/include/zenoh-pico/system/platform/mbed.h index e444dc930..08bb09c83 100644 --- a/include/zenoh-pico/system/platform/mbed.h +++ b/include/zenoh-pico/system/platform/mbed.h @@ -38,7 +38,7 @@ typedef struct TCPSocket TCPSocket; // Forward declaration to be used typedef struct SocketAddress SocketAddress; // Forward declaration to be used in _z_sys_net_endpoint_t typedef struct { - _Bool _err; + bool _err; union { #if Z_FEATURE_LINK_TCP == 1 TCPSocket *_tcp; // As pointer to cross the boundary between C and C++ @@ -53,7 +53,7 @@ typedef struct { } _z_sys_net_socket_t; typedef struct { - _Bool _err; + bool _err; union { #if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1 SocketAddress *_iptcp; // As pointer to cross the boundary between C and C++ diff --git a/include/zenoh-pico/transport/multicast/transport.h b/include/zenoh-pico/transport/multicast/transport.h index fa1f0bedd..b4795f959 100644 --- a/include/zenoh-pico/transport/multicast/transport.h +++ b/include/zenoh-pico/transport/multicast/transport.h @@ -23,7 +23,7 @@ int8_t _z_multicast_open_peer(_z_transport_multicast_establish_param_t *param, c const _z_id_t *local_zid); int8_t _z_multicast_open_client(_z_transport_multicast_establish_param_t *param, const _z_link_t *zl, const _z_id_t *local_zid); -int8_t _z_multicast_send_close(_z_transport_multicast_t *ztm, uint8_t reason, _Bool link_only); +int8_t _z_multicast_send_close(_z_transport_multicast_t *ztm, uint8_t reason, bool link_only); int8_t _z_multicast_transport_close(_z_transport_multicast_t *ztm, uint8_t reason); void _z_multicast_transport_clear(_z_transport_t *zt); #endif /* ZENOH_PICO_MULTICAST_TRANSPORT_H */ diff --git a/include/zenoh-pico/transport/transport.h b/include/zenoh-pico/transport/transport.h index 0e5163b6d..0ae300833 100644 --- a/include/zenoh-pico/transport/transport.h +++ b/include/zenoh-pico/transport/transport.h @@ -42,13 +42,13 @@ typedef struct { volatile _z_zint_t _next_lease; uint16_t _peer_id; - volatile _Bool _received; + volatile bool _received; } _z_transport_peer_entry_t; size_t _z_transport_peer_entry_size(const _z_transport_peer_entry_t *src); void _z_transport_peer_entry_clear(_z_transport_peer_entry_t *src); void _z_transport_peer_entry_copy(_z_transport_peer_entry_t *dst, const _z_transport_peer_entry_t *src); -_Bool _z_transport_peer_entry_eq(const _z_transport_peer_entry_t *left, const _z_transport_peer_entry_t *right); +bool _z_transport_peer_entry_eq(const _z_transport_peer_entry_t *left, const _z_transport_peer_entry_t *right); _Z_ELEM_DEFINE(_z_transport_peer_entry, _z_transport_peer_entry_t, _z_transport_peer_entry_size, _z_transport_peer_entry_clear, _z_transport_peer_entry_copy) _Z_LIST_DEFINE(_z_transport_peer_entry, _z_transport_peer_entry_t) @@ -98,12 +98,12 @@ typedef struct { #if Z_FEATURE_MULTI_THREAD == 1 _z_task_t *_read_task; _z_task_t *_lease_task; - volatile _Bool _read_task_running; - volatile _Bool _lease_task_running; + volatile bool _read_task_running; + volatile bool _lease_task_running; #endif // Z_FEATURE_MULTI_THREAD == 1 - volatile _Bool _received; - volatile _Bool _transmitted; + volatile bool _received; + volatile bool _transmitted; } _z_transport_unicast_t; typedef struct _z_transport_multicast_t { @@ -140,11 +140,11 @@ typedef struct _z_transport_multicast_t { #if Z_FEATURE_MULTI_THREAD == 1 _z_task_t *_read_task; _z_task_t *_lease_task; - volatile _Bool _read_task_running; - volatile _Bool _lease_task_running; + volatile bool _read_task_running; + volatile bool _lease_task_running; #endif // Z_FEATURE_MULTI_THREAD == 1 - volatile _Bool _transmitted; + volatile bool _transmitted; } _z_transport_multicast_t; typedef struct { @@ -174,7 +174,7 @@ typedef struct { uint8_t _key_id_res; uint8_t _req_id_res; uint8_t _seq_num_res; - _Bool _is_qos; + bool _is_qos; } _z_transport_unicast_establish_param_t; typedef struct { diff --git a/include/zenoh-pico/transport/unicast/transport.h b/include/zenoh-pico/transport/unicast/transport.h index 9ac7b885b..5f344b072 100644 --- a/include/zenoh-pico/transport/unicast/transport.h +++ b/include/zenoh-pico/transport/unicast/transport.h @@ -22,7 +22,7 @@ int8_t _z_unicast_open_client(_z_transport_unicast_establish_param_t *param, con const _z_id_t *local_zid); int8_t _z_unicast_open_peer(_z_transport_unicast_establish_param_t *param, const _z_link_t *zl, const _z_id_t *local_zid); -int8_t _z_unicast_send_close(_z_transport_unicast_t *ztu, uint8_t reason, _Bool link_only); +int8_t _z_unicast_send_close(_z_transport_unicast_t *ztu, uint8_t reason, bool link_only); int8_t _z_unicast_transport_close(_z_transport_unicast_t *ztu, uint8_t reason); void _z_unicast_transport_clear(_z_transport_t *zt); #endif /* ZENOH_PICO_UNICAST_TRANSPORT_H */ diff --git a/include/zenoh-pico/transport/utils.h b/include/zenoh-pico/transport/utils.h index a53267680..aff81dc03 100644 --- a/include/zenoh-pico/transport/utils.h +++ b/include/zenoh-pico/transport/utils.h @@ -24,7 +24,7 @@ _z_zint_t _z_sn_max(uint8_t bits); _z_zint_t _z_sn_half(_z_zint_t sn); _z_zint_t _z_sn_modulo_mask(uint8_t bits); -_Bool _z_sn_precedes(const _z_zint_t sn_resolution, const _z_zint_t sn_left, const _z_zint_t sn_right); +bool _z_sn_precedes(const _z_zint_t sn_resolution, const _z_zint_t sn_left, const _z_zint_t sn_right); _z_zint_t _z_sn_increment(const _z_zint_t sn_resolution, const _z_zint_t sn); _z_zint_t _z_sn_decrement(const _z_zint_t sn_resolution, const _z_zint_t sn); diff --git a/include/zenoh-pico/utils/string.h b/include/zenoh-pico/utils/string.h index b4680ee1c..ca9b5a6b6 100644 --- a/include/zenoh-pico/utils/string.h +++ b/include/zenoh-pico/utils/string.h @@ -47,7 +47,7 @@ char const *_z_strstr(char const *haystack_start, char const *haystack_end, cons char const *_z_strstr_skipneedle(char const *haystack_start, char const *haystack_end, const char *needle_start); char const *_z_bstrstr_skipneedle(_z_str_se_t haystack, _z_str_se_t needle); -_Bool _z_splitstr_is_empty(const _z_splitstr_t *src); +bool _z_splitstr_is_empty(const _z_splitstr_t *src); _z_str_se_t _z_splitstr_next(_z_splitstr_t *str); _z_str_se_t _z_splitstr_split_once(_z_splitstr_t src, _z_str_se_t *next); _z_str_se_t _z_splitstr_nextback(_z_splitstr_t *str); diff --git a/src/api/api.c b/src/api/api.c index 83916d78f..ff1511bc2 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -64,7 +64,7 @@ const z_loaned_string_t *z_string_array_get(const z_loaned_string_array_t *a, si size_t z_string_array_len(const z_loaned_string_array_t *a) { return _z_string_svec_len(a); } -_Bool z_string_array_is_empty(const z_loaned_string_array_t *a) { return _z_string_svec_is_empty(a); } +bool z_string_array_is_empty(const z_loaned_string_array_t *a) { return _z_string_svec_is_empty(a); } int8_t z_keyexpr_is_canon(const char *start, size_t len) { return _z_keyexpr_is_canon(start, len); } @@ -172,15 +172,15 @@ z_keyexpr_intersection_level_t z_keyexpr_relation_to(const z_loaned_keyexpr_t *l return Z_KEYEXPR_INTERSECTION_LEVEL_DISJOINT; } -_Bool z_keyexpr_includes(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r) { +bool z_keyexpr_includes(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r) { return _z_keyexpr_suffix_includes(l, r); } -_Bool z_keyexpr_intersects(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r) { +bool z_keyexpr_intersects(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r) { return _z_keyexpr_suffix_intersects(l, r); } -_Bool z_keyexpr_equals(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r) { +bool z_keyexpr_equals(const z_loaned_keyexpr_t *l, const z_loaned_keyexpr_t *r) { return _z_keyexpr_suffix_equals(l, r); } @@ -302,7 +302,7 @@ static int8_t _z_encoding_convert_into_string(const z_loaned_encoding_t *encodin prefix = ENCODING_VALUES_ID_TO_STR[encoding->id]; prefix_len = strlen(prefix); } - _Bool has_schema = _z_string_len(&encoding->schema) > 0; + bool has_schema = _z_string_len(&encoding->schema) > 0; // Size include null terminator size_t total_len = prefix_len + _z_string_len(&encoding->schema) + 1; // Check for schema separator @@ -584,7 +584,7 @@ int8_t z_bytes_serialize_from_str(z_owned_bytes_t *bytes, const char *value) { return z_bytes_from_string(bytes, z_string_move(&s)); } -int8_t z_bytes_from_iter(z_owned_bytes_t *bytes, _Bool (*iterator_body)(z_owned_bytes_t *data, void *context), +int8_t z_bytes_from_iter(z_owned_bytes_t *bytes, bool (*iterator_body)(z_owned_bytes_t *data, void *context), void *context) { z_bytes_empty(bytes); z_owned_bytes_t data; @@ -605,7 +605,7 @@ void z_bytes_empty(z_owned_bytes_t *bytes) { bytes->_val = _z_bytes_null(); } size_t z_bytes_len(const z_loaned_bytes_t *bytes) { return _z_bytes_len(bytes); } -_Bool z_bytes_is_empty(const z_loaned_bytes_t *bytes) { return _z_bytes_is_empty(bytes); } +bool z_bytes_is_empty(const z_loaned_bytes_t *bytes) { return _z_bytes_is_empty(bytes); } z_bytes_reader_t z_bytes_get_reader(const z_loaned_bytes_t *bytes) { return _z_bytes_get_iterator(bytes); } @@ -625,7 +625,7 @@ int64_t z_bytes_reader_tell(z_bytes_reader_t *reader) { return _z_bytes_reader_t z_bytes_iterator_t z_bytes_get_iterator(const z_loaned_bytes_t *bytes) { return _z_bytes_get_iterator(bytes); } -_Bool z_bytes_iterator_next(z_bytes_iterator_t *iter, z_owned_bytes_t *bytes) { +bool z_bytes_iterator_next(z_bytes_iterator_t *iter, z_owned_bytes_t *bytes) { z_bytes_empty(bytes); if (_z_bytes_iterator_next(iter, &bytes->_val) != _Z_RES_OK) { z_bytes_drop(z_bytes_move(bytes)); @@ -638,7 +638,7 @@ z_bytes_slice_iterator_t z_bytes_get_slice_iterator(const z_loaned_bytes_t *byte return (z_bytes_slice_iterator_t){._bytes = bytes, ._slice_idx = 0}; } -_Bool z_bytes_slice_iterator_next(z_bytes_slice_iterator_t *iter, z_view_slice_t *out) { +bool z_bytes_slice_iterator_next(z_bytes_slice_iterator_t *iter, z_view_slice_t *out) { if (iter->_slice_idx >= _z_bytes_num_slices(iter->_bytes)) { return false; } @@ -677,7 +677,7 @@ uint64_t z_timestamp_ntp64_time(const z_timestamp_t *ts) { return ts->time; } z_id_t z_timestamp_id(const z_timestamp_t *ts) { return ts->id; } -_Bool z_timestamp_check(z_timestamp_t ts) { return _z_timestamp_check(&ts); } +bool z_timestamp_check(z_timestamp_t ts) { return _z_timestamp_check(&ts); } z_query_target_t z_query_target_default(void) { return Z_QUERY_TARGET_DEFAULT; } @@ -742,7 +742,7 @@ void z_closure_zid_call(const z_loaned_closure_zid_t *closure, const z_id_t *id) } } -_Bool _z_config_check(const _z_config_t *config) { return !_z_str_intmap_is_empty(config); } +bool _z_config_check(const _z_config_t *config) { return !_z_str_intmap_is_empty(config); } _z_config_t _z_config_null(void) { return _z_str_intmap_make(); } int8_t _z_config_copy(_z_config_t *dst, const _z_config_t *src) { *dst = _z_str_intmap_clone(src); @@ -753,7 +753,7 @@ _Z_OWNED_FUNCTIONS_VALUE_IMPL(_z_config_t, config, _z_config_check, _z_config_nu _Z_OWNED_FUNCTIONS_VALUE_IMPL(_z_string_t, string, _z_string_check, _z_string_null, _z_string_copy, _z_string_clear) -_Bool _z_value_check(const _z_value_t *value) { +bool _z_value_check(const _z_value_t *value) { return _z_encoding_check(&value->encoding) || _z_bytes_check(&value->payload); } _Z_OWNED_FUNCTIONS_VALUE_IMPL(_z_value_t, reply_err, _z_value_check, _z_value_null, _z_value_copy, _z_value_clear) @@ -794,7 +794,7 @@ int8_t z_whatami_to_view_string(z_whatami_t whatami, z_view_string_t *str_out) { return _Z_RES_OK; } -_Bool _z_string_array_check(const _z_string_svec_t *val) { return !_z_string_svec_is_empty(val); } +bool _z_string_array_check(const _z_string_svec_t *val) { return !_z_string_svec_is_empty(val); } int8_t _z_string_array_copy(_z_string_svec_t *dst, const _z_string_svec_t *src) { _z_string_svec_copy(dst, src); return dst->_len == src->_len ? _Z_RES_OK : _Z_ERR_SYSTEM_OUT_OF_MEMORY; @@ -1283,7 +1283,7 @@ const z_loaned_keyexpr_t *z_publisher_keyexpr(const z_loaned_publisher_t *publis #endif #if Z_FEATURE_QUERY == 1 -_Bool _z_reply_check(const _z_reply_t *reply) { +bool _z_reply_check(const _z_reply_t *reply) { if (reply->data._tag == _Z_REPLY_TAG_DATA) { return _z_sample_check(&reply->data._result.sample); } else if (reply->data._tag == _Z_REPLY_TAG_ERROR) { @@ -1352,13 +1352,13 @@ int8_t z_get(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr, co return ret; } -_Bool z_reply_is_ok(const z_loaned_reply_t *reply) { return reply->data._tag != _Z_REPLY_TAG_ERROR; } +bool z_reply_is_ok(const z_loaned_reply_t *reply) { return reply->data._tag != _Z_REPLY_TAG_ERROR; } const z_loaned_sample_t *z_reply_ok(const z_loaned_reply_t *reply) { return &reply->data._result.sample; } const z_loaned_reply_err_t *z_reply_err(const z_loaned_reply_t *reply) { return &reply->data._result.error; } -_Bool z_reply_replier_id(const z_loaned_reply_t *reply, z_id_t *out_id) { +bool z_reply_replier_id(const z_loaned_reply_t *reply, z_id_t *out_id) { if (_z_id_check(reply->data.replier_id)) { *out_id = reply->data.replier_id; return true; @@ -1600,7 +1600,7 @@ int8_t z_declare_subscriber(z_owned_subscriber_t *sub, const z_loaned_session_t if (_Z_RC_IN_VAL(zs)->_tp._type == _Z_TRANSPORT_UNICAST_TYPE) { _z_resource_t *r = _z_get_resource_by_key(_Z_RC_IN_VAL(zs), &keyexpr_aliased); if (r == NULL) { - _Bool do_keydecl = true; + bool do_keydecl = true; _z_keyexpr_t resource_key = _z_keyexpr_alias(keyexpr_aliased); // Remove wild char *wild = _z_string_pbrk(&keyexpr_aliased._suffix, "*$"); diff --git a/src/collections/arc_slice.c b/src/collections/arc_slice.c index 08a569edf..cb89e3c15 100644 --- a/src/collections/arc_slice.c +++ b/src/collections/arc_slice.c @@ -56,7 +56,7 @@ _z_arc_slice_t _z_arc_slice_get_subslice(const _z_arc_slice_t* s, size_t offset, size_t _z_arc_slice_len(const _z_arc_slice_t* s) { return s->len; } -_Bool _z_arc_slice_is_empty(const _z_arc_slice_t* s) { return _z_arc_slice_len(s) == 0; } +bool _z_arc_slice_is_empty(const _z_arc_slice_t* s) { return _z_arc_slice_len(s) == 0; } const uint8_t* _z_arc_slice_data(const _z_arc_slice_t* s) { return _Z_RC_IN_VAL(&s->slice)->start + s->start; } diff --git a/src/collections/bytes.c b/src/collections/bytes.c index 5c1759242..9b9b0d355 100644 --- a/src/collections/bytes.c +++ b/src/collections/bytes.c @@ -25,7 +25,7 @@ #include "zenoh-pico/utils/result.h" /*-------- Bytes --------*/ -_Bool _z_bytes_check(const _z_bytes_t *bytes) { return !_z_bytes_is_empty(bytes); } +bool _z_bytes_check(const _z_bytes_t *bytes) { return !_z_bytes_is_empty(bytes); } _z_bytes_t _z_bytes_null(void) { _z_bytes_t b; @@ -57,7 +57,7 @@ size_t _z_bytes_len(const _z_bytes_t *bs) { return len; } -_Bool _z_bytes_is_empty(const _z_bytes_t *bs) { +bool _z_bytes_is_empty(const _z_bytes_t *bs) { for (size_t i = 0; i < _z_arc_slice_svec_len(&bs->_slices); i++) { const _z_arc_slice_t *s = _z_arc_slice_svec_get(&bs->_slices, i); if (_z_arc_slice_len(s) > 0) return false; diff --git a/src/collections/intmap.c b/src/collections/intmap.c index 5e78dee3e..ff903fb69 100644 --- a/src/collections/intmap.c +++ b/src/collections/intmap.c @@ -19,7 +19,7 @@ #include /*-------- int-void map --------*/ -_Bool _z_int_void_map_entry_key_eq(const void *left, const void *right) { +bool _z_int_void_map_entry_key_eq(const void *left, const void *right) { _z_int_void_map_entry_t *l = (_z_int_void_map_entry_t *)left; _z_int_void_map_entry_t *r = (_z_int_void_map_entry_t *)right; return l->_key == r->_key; @@ -83,7 +83,7 @@ _z_int_void_map_t _z_int_void_map_clone(const _z_int_void_map_t *src, z_element_ return dst; } -_Bool _z_int_void_map_is_empty(const _z_int_void_map_t *map) { return _z_int_void_map_len(map) == (size_t)0; } +bool _z_int_void_map_is_empty(const _z_int_void_map_t *map) { return _z_int_void_map_len(map) == (size_t)0; } void _z_int_void_map_remove(_z_int_void_map_t *map, size_t k, z_element_free_f f) { if (map->_vals != NULL) { diff --git a/src/collections/lifo.c b/src/collections/lifo.c index 4f31a22cf..8b43a2f68 100644 --- a/src/collections/lifo.c +++ b/src/collections/lifo.c @@ -38,8 +38,8 @@ _z_lifo_t _z_lifo_make(size_t capacity) { size_t _z_lifo_capacity(const _z_lifo_t *r) { return r->_capacity; } size_t _z_lifo_len(const _z_lifo_t *r) { return r->_len; } -_Bool _z_lifo_is_empty(const _z_lifo_t *r) { return r->_len == 0; } -_Bool _z_lifo_is_full(const _z_lifo_t *r) { return r->_len == r->_capacity; } +bool _z_lifo_is_empty(const _z_lifo_t *r) { return r->_len == 0; } +bool _z_lifo_is_full(const _z_lifo_t *r) { return r->_len == r->_capacity; } void *_z_lifo_push(_z_lifo_t *r, void *e) { void *ret = e; diff --git a/src/collections/list.c b/src/collections/list.c index 36dbadd51..1df8bcba1 100644 --- a/src/collections/list.c +++ b/src/collections/list.c @@ -60,7 +60,7 @@ size_t _z_list_len(const _z_list_t *xs) { return len; } -_Bool _z_list_is_empty(const _z_list_t *xs) { return _z_list_len(xs) == (size_t)0; } +bool _z_list_is_empty(const _z_list_t *xs) { return _z_list_len(xs) == (size_t)0; } _z_list_t *_z_list_pop(_z_list_t *xs, z_element_free_f f_f, void **x) { _z_list_t *l = (_z_list_t *)xs; diff --git a/src/collections/refcount.c b/src/collections/refcount.c index d7e44f548..2d5c5c741 100644 --- a/src/collections/refcount.c +++ b/src/collections/refcount.c @@ -193,7 +193,7 @@ int8_t _z_rc_increase_weak(void* cnt) { return _Z_RES_OK; } -_Bool _z_rc_decrease_strong(void** cnt) { +bool _z_rc_decrease_strong(void** cnt) { _z_inner_rc_t* c = (_z_inner_rc_t*)*cnt; if (_ZP_RC_OP_DECR_AND_CMP_STRONG(c, 1)) { return _z_rc_decrease_weak(cnt); @@ -201,7 +201,7 @@ _Bool _z_rc_decrease_strong(void** cnt) { return _z_rc_decrease_weak(cnt); } -_Bool _z_rc_decrease_weak(void** cnt) { +bool _z_rc_decrease_weak(void** cnt) { _z_inner_rc_t* c = (_z_inner_rc_t*)*cnt; if (_ZP_RC_OP_DECR_AND_CMP_WEAK(c, 1)) { return false; diff --git a/src/collections/slice.c b/src/collections/slice.c index 730ce618c..0a72f9e97 100644 --- a/src/collections/slice.c +++ b/src/collections/slice.c @@ -30,7 +30,7 @@ void _z_default_deleter(void *data, void *context) { _z_delete_context_t _z_delete_context_null(void) { return _z_delete_context_create(NULL, NULL); } -_Bool _z_delete_context_is_null(const _z_delete_context_t *c) { return c->deleter == NULL; } +bool _z_delete_context_is_null(const _z_delete_context_t *c) { return c->deleter == NULL; } _z_delete_context_t _z_delete_context_create(void (*deleter)(void *data, void *context), void *context) { return (_z_delete_context_t){.deleter = deleter, .context = context}; @@ -154,15 +154,15 @@ _z_slice_t _z_slice_duplicate(const _z_slice_t *src) { return dst; } -_Bool _z_slice_is_empty(const _z_slice_t *bs) { return bs->len == 0; } +bool _z_slice_is_empty(const _z_slice_t *bs) { return bs->len == 0; } _z_slice_t _z_slice_steal(_z_slice_t *b) { _z_slice_t ret = *b; *b = _z_slice_empty(); return ret; } -_Bool _z_slice_eq(const _z_slice_t *left, const _z_slice_t *right) { +bool _z_slice_eq(const _z_slice_t *left, const _z_slice_t *right) { return left->len == right->len && memcmp(left->start, right->start, left->len) == 0; } -_Bool _z_slice_is_alloced(const _z_slice_t *s) { return !_z_delete_context_is_null(&s->_delete_context); } +bool _z_slice_is_alloced(const _z_slice_t *s) { return !_z_delete_context_is_null(&s->_delete_context); } diff --git a/src/collections/string.c b/src/collections/string.c index 0e8129be4..c46200965 100644 --- a/src/collections/string.c +++ b/src/collections/string.c @@ -25,7 +25,7 @@ _z_string_t _z_string_null(void) { return s; } -_Bool _z_string_check(const _z_string_t *value) { return !_z_slice_is_empty(&value->_slice); } +bool _z_string_check(const _z_string_t *value) { return !_z_slice_is_empty(&value->_slice); } _z_string_t _z_string_copy_from_str(const char *value) { _z_string_t s; @@ -104,7 +104,7 @@ void _z_string_free(_z_string_t **str) { } } -_Bool _z_string_equals(const _z_string_t *left, const _z_string_t *right) { +bool _z_string_equals(const _z_string_t *left, const _z_string_t *right) { if (_z_string_len(left) != _z_string_len(right)) { return false; } @@ -138,7 +138,7 @@ _z_string_t _z_string_preallocate(size_t len) { } const char *_z_string_data(const _z_string_t *s) { return (const char *)s->_slice.start; } -_Bool _z_string_is_empty(const _z_string_t *s) { return s->_slice.len <= 1; } +bool _z_string_is_empty(const _z_string_t *s) { return s->_slice.len <= 1; } const char *_z_string_rchr(_z_string_t *str, char filter) { const char *curr_res = NULL; @@ -218,4 +218,4 @@ char *_z_str_n_clone(const char *src, size_t len) { return dst; } -_Bool _z_str_eq(const char *left, const char *right) { return strcmp(left, right) == 0; } +bool _z_str_eq(const char *left, const char *right) { return strcmp(left, right) == 0; } diff --git a/src/collections/vec.c b/src/collections/vec.c index e33034fd2..6556d6b88 100644 --- a/src/collections/vec.c +++ b/src/collections/vec.c @@ -77,7 +77,7 @@ void _z_vec_free(_z_vec_t **v, z_element_free_f free_f) { size_t _z_vec_len(const _z_vec_t *v) { return v->_len; } -_Bool _z_vec_is_empty(const _z_vec_t *v) { return v->_len == 0; } +bool _z_vec_is_empty(const _z_vec_t *v) { return v->_len == 0; } void _z_vec_append(_z_vec_t *v, void *e) { if (v->_len == v->_capacity) { @@ -164,7 +164,7 @@ void __z_svec_move_inner(void *dst, void *src, z_element_move_f move, size_t num } } -_Bool _z_svec_copy(_z_svec_t *dst, const _z_svec_t *src, z_element_copy_f copy, size_t element_size) { +bool _z_svec_copy(_z_svec_t *dst, const _z_svec_t *src, z_element_copy_f copy, size_t element_size) { dst->_capacity = 0; dst->_len = 0; dst->_val = z_malloc(element_size * src->_capacity); @@ -213,7 +213,7 @@ void _z_svec_free(_z_svec_t **v, z_element_clear_f clear, size_t element_size) { size_t _z_svec_len(const _z_svec_t *v) { return v->_len; } -_Bool _z_svec_is_empty(const _z_svec_t *v) { return v->_len == 0; } +bool _z_svec_is_empty(const _z_svec_t *v) { return v->_len == 0; } bool _z_svec_append(_z_svec_t *v, const void *e, z_element_move_f move, size_t element_size) { if (v->_len == v->_capacity) { diff --git a/src/link/endpoint.c b/src/link/endpoint.c index 400f2d1e6..5c9f23f92 100644 --- a/src/link/endpoint.c +++ b/src/link/endpoint.c @@ -71,8 +71,8 @@ int8_t _z_locator_copy(_z_locator_t *dst, const _z_locator_t *src) { return _Z_RES_OK; } -_Bool _z_locator_eq(const _z_locator_t *left, const _z_locator_t *right) { - _Bool res = false; +bool _z_locator_eq(const _z_locator_t *left, const _z_locator_t *right) { + bool res = false; res = _z_string_equals(&left->_protocol, &right->_protocol); if (res == true) { diff --git a/src/link/link.c b/src/link/link.c index e7a20fba0..f15b5b69b 100644 --- a/src/link/link.c +++ b/src/link/link.c @@ -153,7 +153,7 @@ size_t _z_link_recv_exact_zbuf(const _z_link_t *link, _z_zbuf_t *zbf, size_t len int8_t _z_link_send_wbuf(const _z_link_t *link, const _z_wbuf_t *wbf) { int8_t ret = _Z_RES_OK; - _Bool link_is_streamed = false; + bool link_is_streamed = false; switch (link->_cap._flow) { case Z_LINK_CAP_FLOW_STREAM: diff --git a/src/net/encoding.c b/src/net/encoding.c index 2b2a48b6d..98d3d51bb 100644 --- a/src/net/encoding.c +++ b/src/net/encoding.c @@ -42,7 +42,7 @@ _z_encoding_t _z_encoding_null(void) { return _z_encoding_wrap(_Z_ENCODING_ID_DE void _z_encoding_clear(_z_encoding_t *encoding) { _z_string_clear(&encoding->schema); } -_Bool _z_encoding_check(const _z_encoding_t *encoding) { +bool _z_encoding_check(const _z_encoding_t *encoding) { return ((encoding->id != _Z_ENCODING_ID_DEFAULT) || _z_string_check(&encoding->schema)); } diff --git a/src/net/filtering.c b/src/net/filtering.c index 0787c462b..eb2400752 100644 --- a/src/net/filtering.c +++ b/src/net/filtering.c @@ -100,7 +100,7 @@ int8_t _z_write_filter_destroy(const _z_publisher_t *pub) { return _Z_RES_OK; } -_Bool _z_write_filter_active(const _z_publisher_t *pub) { return (pub->_filter.ctx->state == WRITE_FILTER_ACTIVE); } +bool _z_write_filter_active(const _z_publisher_t *pub) { return (pub->_filter.ctx->state == WRITE_FILTER_ACTIVE); } #else int8_t _z_write_filter_create(_z_publisher_t *pub) { @@ -113,7 +113,7 @@ int8_t _z_write_filter_destroy(const _z_publisher_t *pub) { return _Z_RES_OK; } -_Bool _z_write_filter_active(const _z_publisher_t *pub) { +bool _z_write_filter_active(const _z_publisher_t *pub) { _ZP_UNUSED(pub); return false; } diff --git a/src/net/memory.c b/src/net/memory.c index 3152a85c0..509373129 100644 --- a/src/net/memory.c +++ b/src/net/memory.c @@ -45,4 +45,4 @@ void _z_value_free(_z_value_t **value) { } } -_Bool _z_hello_check(const _z_hello_t *hello) { return _z_id_check(hello->_zid); } +bool _z_hello_check(const _z_hello_t *hello) { return _z_id_check(hello->_zid); } diff --git a/src/net/primitives.c b/src/net/primitives.c index 7ebe4fbae..019f9dbdd 100644 --- a/src/net/primitives.c +++ b/src/net/primitives.c @@ -103,7 +103,7 @@ int8_t _z_undeclare_resource(_z_session_t *zn, uint16_t rid) { #if Z_FEATURE_PUBLICATION == 1 /*------------------ Publisher Declaration ------------------*/ _z_publisher_t _z_declare_publisher(const _z_session_rc_t *zn, _z_keyexpr_t keyexpr, _z_encoding_t *encoding, - z_congestion_control_t congestion_control, z_priority_t priority, _Bool is_express, + z_congestion_control_t congestion_control, z_priority_t priority, bool is_express, z_reliability_t reliability) { // Allocate publisher _z_publisher_t ret; @@ -132,7 +132,7 @@ int8_t _z_undeclare_publisher(_z_publisher_t *pub) { /*------------------ Write ------------------*/ int8_t _z_write(_z_session_t *zn, const _z_keyexpr_t keyexpr, const _z_bytes_t payload, const _z_encoding_t *encoding, const z_sample_kind_t kind, const z_congestion_control_t cong_ctrl, z_priority_t priority, - _Bool is_express, const _z_timestamp_t *timestamp, const _z_bytes_t attachment, + bool is_express, const _z_timestamp_t *timestamp, const _z_bytes_t attachment, z_reliability_t reliability) { int8_t ret = _Z_RES_OK; _z_network_message_t msg; @@ -255,7 +255,7 @@ int8_t _z_undeclare_subscriber(_z_subscriber_t *sub) { #if Z_FEATURE_QUERYABLE == 1 /*------------------ Queryable Declaration ------------------*/ -_z_queryable_t _z_declare_queryable(const _z_session_rc_t *zn, _z_keyexpr_t keyexpr, _Bool complete, +_z_queryable_t _z_declare_queryable(const _z_session_rc_t *zn, _z_keyexpr_t keyexpr, bool complete, _z_queryable_handler_t callback, _z_drop_handler_t dropper, void *arg) { _z_session_queryable_t q; q._id = _z_get_entity_id(_Z_RC_IN_VAL(zn)); @@ -316,7 +316,7 @@ int8_t _z_undeclare_queryable(_z_queryable_t *qle) { int8_t _z_send_reply(const _z_query_t *query, const _z_session_rc_t *zsrc, _z_keyexpr_t keyexpr, const _z_value_t payload, const z_sample_kind_t kind, const z_congestion_control_t cong_ctrl, - z_priority_t priority, _Bool is_express, const _z_timestamp_t *timestamp, const _z_bytes_t att) { + z_priority_t priority, bool is_express, const _z_timestamp_t *timestamp, const _z_bytes_t att) { int8_t ret = _Z_RES_OK; _z_session_t *zn = _Z_RC_IN_VAL(zsrc); @@ -453,7 +453,7 @@ int8_t _z_send_reply_err(const _z_query_t *query, const _z_session_rc_t *zsrc, c int8_t _z_query(_z_session_t *zn, _z_keyexpr_t keyexpr, const char *parameters, const z_query_target_t target, const z_consolidation_mode_t consolidation, _z_value_t value, _z_reply_handler_t callback, _z_drop_handler_t dropper, void *arg, uint64_t timeout_ms, const _z_bytes_t attachment, - z_congestion_control_t cong_ctrl, z_priority_t priority, _Bool is_express) { + z_congestion_control_t cong_ctrl, z_priority_t priority, bool is_express) { int8_t ret = _Z_RES_OK; // Create the pending query object diff --git a/src/net/publish.c b/src/net/publish.c index 8545bb6ca..b88d46da5 100644 --- a/src/net/publish.c +++ b/src/net/publish.c @@ -34,7 +34,7 @@ void _z_publisher_free(_z_publisher_t **pub) { } } -_Bool _z_publisher_check(const _z_publisher_t *publisher) { return !_Z_RC_IS_NULL(&publisher->_zn); } +bool _z_publisher_check(const _z_publisher_t *publisher) { return !_Z_RC_IS_NULL(&publisher->_zn); } _z_publisher_t _z_publisher_null(void) { return (_z_publisher_t) { ._congestion_control = Z_CONGESTION_CONTROL_DEFAULT, ._id = 0, ._key = _z_keyexpr_null(), diff --git a/src/net/query.c b/src/net/query.c index c55da99b9..76cda128e 100644 --- a/src/net/query.c +++ b/src/net/query.c @@ -101,7 +101,7 @@ _z_query_t _z_query_create(_z_value_t *value, _z_keyexpr_t *key, const _z_slice_ _z_queryable_t _z_queryable_null(void) { return (_z_queryable_t){._entity_id = 0, ._zn = _z_session_weak_null()}; } -_Bool _z_queryable_check(const _z_queryable_t *queryable) { return !_Z_RC_IS_NULL(&queryable->_zn); } +bool _z_queryable_check(const _z_queryable_t *queryable) { return !_Z_RC_IS_NULL(&queryable->_zn); } void _z_queryable_clear(_z_queryable_t *qbl) { _z_session_weak_drop(&qbl->_zn); diff --git a/src/net/reply.c b/src/net/reply.c index e28c63215..b84a19eec 100644 --- a/src/net/reply.c +++ b/src/net/reply.c @@ -84,7 +84,7 @@ int8_t _z_reply_copy(_z_reply_t *dst, const _z_reply_t *src) { return _Z_RES_OK; } -_Bool _z_pending_reply_eq(const _z_pending_reply_t *one, const _z_pending_reply_t *two) { +bool _z_pending_reply_eq(const _z_pending_reply_t *one, const _z_pending_reply_t *two) { return one->_tstamp.time == two->_tstamp.time; } diff --git a/src/net/sample.c b/src/net/sample.c index 74262f4c4..c6e3e9a37 100644 --- a/src/net/sample.c +++ b/src/net/sample.c @@ -29,7 +29,7 @@ _z_sample_t _z_sample_null(void) { return s; } -_Bool _z_sample_check(const _z_sample_t *sample) { +bool _z_sample_check(const _z_sample_t *sample) { return _z_keyexpr_check(&sample->keyexpr) || _z_bytes_check(&sample->payload) || _z_bytes_check(&sample->attachment) || _z_encoding_check(&sample->encoding); } diff --git a/src/net/subscribe.c b/src/net/subscribe.c index 03f595805..84960a0a2 100644 --- a/src/net/subscribe.c +++ b/src/net/subscribe.c @@ -31,7 +31,7 @@ void _z_subscriber_free(_z_subscriber_t **sub) { } } -_Bool _z_subscriber_check(const _z_subscriber_t *subscriber) { return !_Z_RC_IS_NULL(&subscriber->_zn); } +bool _z_subscriber_check(const _z_subscriber_t *subscriber) { return !_Z_RC_IS_NULL(&subscriber->_zn); } _z_subscriber_t _z_subscriber_null(void) { return (_z_subscriber_t){._entity_id = 0, ._zn = _z_session_weak_null()}; } #endif diff --git a/src/protocol/codec.c b/src/protocol/codec.c index 006490ae5..24f2f54e7 100644 --- a/src/protocol/codec.c +++ b/src/protocol/codec.c @@ -375,7 +375,7 @@ size_t _z_encoding_len(const _z_encoding_t *en) { } int8_t _z_encoding_encode(_z_wbuf_t *wbf, const _z_encoding_t *en) { - _Bool has_schema = _z_string_check(&en->schema); + bool has_schema = _z_string_check(&en->schema); uint32_t id = (uint32_t)(en->id) << 1; if (has_schema) { id |= _Z_ENCODING_FLAG_S; @@ -389,7 +389,7 @@ int8_t _z_encoding_encode(_z_wbuf_t *wbf, const _z_encoding_t *en) { int8_t _z_encoding_decode(_z_encoding_t *en, _z_zbuf_t *zbf) { uint32_t id = 0; - _Bool has_schema = false; + bool has_schema = false; _Z_RETURN_IF_ERR(_z_zint32_decode(&id, zbf)); if ((id & _Z_ENCODING_FLAG_S) != 0) { has_schema = true; diff --git a/src/protocol/codec/declarations.c b/src/protocol/codec/declarations.c index e91841cc8..5c298f3f9 100644 --- a/src/protocol/codec/declarations.c +++ b/src/protocol/codec/declarations.c @@ -33,7 +33,7 @@ #include "zenoh-pico/session/session.h" #include "zenoh-pico/system/platform.h" -int8_t _z_decl_ext_keyexpr_encode(_z_wbuf_t *wbf, _z_keyexpr_t ke, _Bool has_next_ext) { +int8_t _z_decl_ext_keyexpr_encode(_z_wbuf_t *wbf, _z_keyexpr_t ke, bool has_next_ext) { uint8_t header = _Z_MSG_EXT_ENC_ZBUF | _Z_MSG_EXT_FLAG_M | 0x0f | (has_next_ext ? _Z_FLAG_Z_Z : 0); _Z_RETURN_IF_ERR(_z_uint8_encode(wbf, header)); uint32_t kelen = (uint32_t)(_z_keyexpr_has_suffix(&ke) ? _z_string_len(&ke._suffix) : 0); @@ -60,8 +60,8 @@ int8_t _z_decl_kexpr_encode(_z_wbuf_t *wbf, const _z_decl_kexpr_t *decl) { return _Z_RES_OK; } -int8_t _z_decl_commons_encode(_z_wbuf_t *wbf, uint8_t header, _Bool has_extensions, uint32_t id, _z_keyexpr_t keyexpr) { - _Bool has_kesuffix = _z_keyexpr_has_suffix(&keyexpr); +int8_t _z_decl_commons_encode(_z_wbuf_t *wbf, uint8_t header, bool has_extensions, uint32_t id, _z_keyexpr_t keyexpr) { + bool has_kesuffix = _z_keyexpr_has_suffix(&keyexpr); if (has_extensions) { header |= _Z_FLAG_Z_Z; } @@ -85,7 +85,7 @@ int8_t _z_undecl_kexpr_encode(_z_wbuf_t *wbf, const _z_undecl_kexpr_t *decl) { return _z_zsize_encode(wbf, decl->_id); } int8_t _z_undecl_encode(_z_wbuf_t *wbf, uint8_t header, _z_zint_t decl_id, _z_keyexpr_t ke) { - _Bool has_keyexpr_ext = _z_keyexpr_check(&ke); + bool has_keyexpr_ext = _z_keyexpr_check(&ke); if (has_keyexpr_ext) { header |= _Z_FLAG_Z_Z; } @@ -101,7 +101,7 @@ int8_t _z_undecl_subscriber_encode(_z_wbuf_t *wbf, const _z_undecl_subscriber_t } int8_t _z_decl_queryable_encode(_z_wbuf_t *wbf, const _z_decl_queryable_t *decl) { uint8_t header = _Z_DECL_QUERYABLE_MID; - _Bool has_info_ext = decl->_ext_queryable_info._complete || (decl->_ext_queryable_info._distance != 0); + bool has_info_ext = decl->_ext_queryable_info._complete || (decl->_ext_queryable_info._distance != 0); _Z_RETURN_IF_ERR(_z_decl_commons_encode(wbf, header, has_info_ext, decl->_id, decl->_keyexpr)); if (has_info_ext) { _Z_RETURN_IF_ERR(_z_uint8_encode(wbf, _Z_MSG_EXT_ENC_ZINT | 0x01)); @@ -222,7 +222,7 @@ int8_t _z_undecl_trivial_decode(_z_zbuf_t *zbf, _z_keyexpr_t *_ext_keyexpr, uint } return _Z_RES_OK; } -int8_t _z_decl_commons_decode(_z_zbuf_t *zbf, uint8_t header, _Bool *has_extensions, uint32_t *id, _z_keyexpr_t *ke) { +int8_t _z_decl_commons_decode(_z_zbuf_t *zbf, uint8_t header, bool *has_extensions, uint32_t *id, _z_keyexpr_t *ke) { *has_extensions = _Z_HAS_FLAG(header, _Z_FLAG_Z_Z); uint16_t mapping = _Z_HAS_FLAG(header, _Z_DECL_SUBSCRIBER_FLAG_M) ? _Z_KEYEXPR_MAPPING_UNKNOWN_REMOTE : _Z_KEYEXPR_MAPPING_LOCAL; @@ -258,7 +258,7 @@ int8_t _z_decl_subscriber_decode_extensions(_z_msg_ext_t *extension, void *ctx) } int8_t _z_decl_subscriber_decode(_z_decl_subscriber_t *decl, _z_zbuf_t *zbf, uint8_t header) { - _Bool has_ext; + bool has_ext; *decl = _z_decl_subscriber_null(); _Z_RETURN_IF_ERR(_z_decl_commons_decode(zbf, header, &has_ext, &decl->_id, &decl->_keyexpr)); if (has_ext) { @@ -286,7 +286,7 @@ int8_t _z_decl_queryable_decode_extensions(_z_msg_ext_t *extension, void *ctx) { return _Z_RES_OK; } int8_t _z_decl_queryable_decode(_z_decl_queryable_t *decl, _z_zbuf_t *zbf, uint8_t header) { - _Bool has_ext; + bool has_ext; *decl = _z_decl_queryable_null(); _Z_RETURN_IF_ERR(_z_decl_commons_decode(zbf, header, &has_ext, &decl->_id, &decl->_keyexpr)); if (has_ext) { @@ -299,7 +299,7 @@ int8_t _z_undecl_queryable_decode(_z_undecl_queryable_t *decl, _z_zbuf_t *zbf, u return _z_undecl_trivial_decode(zbf, &decl->_ext_keyexpr, &decl->_id, header); } int8_t _z_decl_token_decode(_z_decl_token_t *decl, _z_zbuf_t *zbf, uint8_t header) { - _Bool has_ext; + bool has_ext; *decl = _z_decl_token_null(); _Z_RETURN_IF_ERR(_z_decl_commons_decode(zbf, header, &has_ext, &decl->_id, &decl->_keyexpr)); if (has_ext) { diff --git a/src/protocol/codec/ext.c b/src/protocol/codec/ext.c index c1188431e..2c7aab699 100644 --- a/src/protocol/codec/ext.c +++ b/src/protocol/codec/ext.c @@ -70,7 +70,7 @@ int8_t _z_msg_ext_decode_zbuf(_z_msg_ext_zbuf_t *ext, _z_zbuf_t *zbf) { int8_t _z_msg_ext_decode_zbuf_na(_z_msg_ext_zbuf_t *ext, _z_zbuf_t *zbf) { return _z_msg_ext_decode_zbuf(ext, zbf); } /*------------------ Message Extension ------------------*/ -int8_t _z_msg_ext_encode(_z_wbuf_t *wbf, const _z_msg_ext_t *ext, _Bool has_next) { +int8_t _z_msg_ext_encode(_z_wbuf_t *wbf, const _z_msg_ext_t *ext, bool has_next) { int8_t ret = _Z_RES_OK; _Z_RETURN_IF_ERR(_z_wbuf_write(wbf, _Z_EXT_FULL_ID(ext->_header) | (has_next << 7))) @@ -121,7 +121,7 @@ int8_t _z_msg_ext_unknown_body_decode(_z_msg_ext_body_t *body, uint8_t enc, _z_z return ret; } -int8_t _z_msg_ext_decode(_z_msg_ext_t *ext, _z_zbuf_t *zbf, _Bool *has_next) { +int8_t _z_msg_ext_decode(_z_msg_ext_t *ext, _z_zbuf_t *zbf, bool *has_next) { int8_t ret = _Z_RES_OK; ret |= _z_uint8_decode(&ext->_header, zbf); // Decode the header @@ -135,7 +135,7 @@ int8_t _z_msg_ext_decode(_z_msg_ext_t *ext, _z_zbuf_t *zbf, _Bool *has_next) { return ret; } -int8_t _z_msg_ext_decode_na(_z_msg_ext_t *ext, _z_zbuf_t *zbf, _Bool *has_next) { +int8_t _z_msg_ext_decode_na(_z_msg_ext_t *ext, _z_zbuf_t *zbf, bool *has_next) { return _z_msg_ext_decode(ext, zbf, has_next); } @@ -213,7 +213,7 @@ int8_t _z_msg_ext_skip_non_mandatory(_z_msg_ext_t *extension, void *ctx) { } int8_t _z_msg_ext_decode_iter(_z_zbuf_t *zbf, int8_t (*callback)(_z_msg_ext_t *, void *), void *context) { int8_t ret = _Z_RES_OK; - _Bool has_next = true; + bool has_next = true; while (has_next && ret == _Z_RES_OK) { _z_msg_ext_t ext = _z_msg_ext_make_unit(0); ret |= _z_msg_ext_decode(&ext, zbf, &has_next); diff --git a/src/protocol/codec/interest.c b/src/protocol/codec/interest.c index 5ead72645..391699b8f 100644 --- a/src/protocol/codec/interest.c +++ b/src/protocol/codec/interest.c @@ -39,7 +39,7 @@ #define _Z_INTEREST_TRACE_ID 0x13 -int8_t _z_interest_encode(_z_wbuf_t *wbf, const _z_interest_t *interest, _Bool is_final) { +int8_t _z_interest_encode(_z_wbuf_t *wbf, const _z_interest_t *interest, bool is_final) { // Set id _Z_RETURN_IF_ERR(_z_zsize_encode(wbf, interest->_id)); if (is_final) { @@ -52,7 +52,7 @@ int8_t _z_interest_encode(_z_wbuf_t *wbf, const _z_interest_t *interest, _Bool i // Process restricted flag if (_Z_HAS_FLAG(flags, _Z_INTEREST_FLAG_RESTRICTED)) { // Set Named & Mapping flags - _Bool has_kesuffix = _z_keyexpr_has_suffix(&interest->_keyexpr); + bool has_kesuffix = _z_keyexpr_has_suffix(&interest->_keyexpr); if (has_kesuffix) { _Z_SET_FLAG(flags, _Z_INTEREST_CODEC_FLAG_N); } @@ -69,7 +69,7 @@ int8_t _z_interest_encode(_z_wbuf_t *wbf, const _z_interest_t *interest, _Bool i return _Z_RES_OK; } -int8_t _z_interest_decode(_z_interest_t *interest, _z_zbuf_t *zbf, _Bool is_final, _Bool has_ext) { +int8_t _z_interest_decode(_z_interest_t *interest, _z_zbuf_t *zbf, bool is_final, bool has_ext) { // Decode id _Z_RETURN_IF_ERR(_z_zint32_decode(&interest->_id, zbf)); if (!is_final) { diff --git a/src/protocol/codec/message.c b/src/protocol/codec/message.c index 960f54498..0d1bdffdd 100644 --- a/src/protocol/codec/message.c +++ b/src/protocol/codec/message.c @@ -109,7 +109,7 @@ int8_t _z_timestamp_decode(_z_timestamp_t *ts, _z_zbuf_t *zbf) { } /*------------------ ResKey Field ------------------*/ -int8_t _z_keyexpr_encode(_z_wbuf_t *wbf, _Bool has_suffix, const _z_keyexpr_t *fld) { +int8_t _z_keyexpr_encode(_z_wbuf_t *wbf, bool has_suffix, const _z_keyexpr_t *fld) { int8_t ret = _Z_RES_OK; _Z_DEBUG("Encoding _RESKEY"); @@ -121,7 +121,7 @@ int8_t _z_keyexpr_encode(_z_wbuf_t *wbf, _Bool has_suffix, const _z_keyexpr_t *f return ret; } -int8_t _z_keyexpr_decode(_z_keyexpr_t *ke, _z_zbuf_t *zbf, _Bool has_suffix) { +int8_t _z_keyexpr_decode(_z_keyexpr_t *ke, _z_zbuf_t *zbf, bool has_suffix) { _Z_DEBUG("Decoding _RESKEY"); int8_t ret = _Z_RES_OK; @@ -249,13 +249,13 @@ int8_t _z_push_body_encode(_z_wbuf_t *wbf, const _z_push_body_t *pshb) { (void)(wbf); (void)(pshb); uint8_t header = pshb->_is_put ? _Z_MID_Z_PUT : _Z_MID_Z_DEL; - _Bool has_source_info = _z_id_check(pshb->_body._put._commons._source_info._id) || - pshb->_body._put._commons._source_info._source_sn != 0 || - pshb->_body._put._commons._source_info._entity_id != 0; + bool has_source_info = _z_id_check(pshb->_body._put._commons._source_info._id) || + pshb->_body._put._commons._source_info._source_sn != 0 || + pshb->_body._put._commons._source_info._entity_id != 0; - _Bool has_attachment = pshb->_is_put && _z_bytes_check(&pshb->_body._put._attachment); - _Bool has_timestamp = _z_timestamp_check(&pshb->_body._put._commons._timestamp); - _Bool has_encoding = false; + bool has_attachment = pshb->_is_put && _z_bytes_check(&pshb->_body._put._attachment); + bool has_timestamp = _z_timestamp_check(&pshb->_body._put._commons._timestamp); + bool has_encoding = false; if (has_source_info || has_attachment) { header |= _Z_FLAG_Z_Z; } @@ -389,11 +389,11 @@ int8_t _z_query_encode(_z_wbuf_t *wbf, const _z_msg_query_t *msg) { int8_t ret = _Z_RES_OK; uint8_t header = _Z_MID_Z_QUERY; - _Bool has_params = _z_slice_check(&msg->_parameters); + bool has_params = _z_slice_check(&msg->_parameters); if (has_params) { _Z_SET_FLAG(header, _Z_FLAG_Z_Q_P); } - _Bool has_consolidation = (msg->_consolidation != Z_CONSOLIDATION_MODE_DEFAULT); + bool has_consolidation = (msg->_consolidation != Z_CONSOLIDATION_MODE_DEFAULT); if (has_consolidation) { _Z_SET_FLAG(header, _Z_FLAG_Z_Q_C); } @@ -486,7 +486,7 @@ int8_t _z_query_decode(_z_msg_query_t *msg, _z_zbuf_t *zbf, uint8_t header) { int8_t _z_reply_encode(_z_wbuf_t *wbf, const _z_msg_reply_t *reply) { uint8_t header = _Z_MID_Z_REPLY; - _Bool has_consolidation = reply->_consolidation != Z_CONSOLIDATION_MODE_DEFAULT; + bool has_consolidation = reply->_consolidation != Z_CONSOLIDATION_MODE_DEFAULT; if (has_consolidation) { _Z_SET_FLAG(header, _Z_FLAG_Z_R_C); } @@ -528,12 +528,12 @@ int8_t _z_err_encode(_z_wbuf_t *wbf, const _z_msg_err_t *err) { uint8_t header = _Z_MID_Z_ERR; // Encode header - _Bool has_encoding = _z_encoding_check(&err->_encoding); + bool has_encoding = _z_encoding_check(&err->_encoding); if (has_encoding) { _Z_SET_FLAG(header, _Z_FLAG_Z_E_E); } - _Bool has_sinfo_ext = _z_id_check(err->_ext_source_info._id) || err->_ext_source_info._entity_id != 0 || - err->_ext_source_info._source_sn != 0; + bool has_sinfo_ext = _z_id_check(err->_ext_source_info._id) || err->_ext_source_info._entity_id != 0 || + err->_ext_source_info._source_sn != 0; if (has_sinfo_ext) { _Z_SET_FLAG(header, _Z_FLAG_Z_Z); } @@ -709,7 +709,7 @@ int8_t _z_scouting_message_decode_na(_z_scouting_message_t *msg, _z_zbuf_t *zbf) int8_t ret = _Z_RES_OK; *msg = (_z_scouting_message_t){0}; - _Bool is_last = false; + bool is_last = false; do { ret |= _z_uint8_decode(&msg->_header, zbf); // Decode the header diff --git a/src/protocol/codec/network.c b/src/protocol/codec/network.c index 37a1c9ff8..2b8d73867 100644 --- a/src/protocol/codec/network.c +++ b/src/protocol/codec/network.c @@ -40,9 +40,9 @@ int8_t _z_push_encode(_z_wbuf_t *wbf, const _z_n_msg_push_t *msg) { uint8_t header = _Z_MID_N_PUSH | (_z_keyexpr_is_local(&msg->_key) ? _Z_FLAG_N_REQUEST_M : 0); - _Bool has_suffix = _z_keyexpr_has_suffix(&msg->_key); - _Bool has_qos_ext = msg->_qos._val != _Z_N_QOS_DEFAULT._val; - _Bool has_timestamp_ext = _z_timestamp_check(&msg->_timestamp); + bool has_suffix = _z_keyexpr_has_suffix(&msg->_key); + bool has_qos_ext = msg->_qos._val != _Z_N_QOS_DEFAULT._val; + bool has_timestamp_ext = _z_timestamp_check(&msg->_timestamp); if (has_suffix) { header |= _Z_FLAG_N_REQUEST_N; } @@ -114,7 +114,7 @@ int8_t _z_push_decode(_z_n_msg_push_t *msg, _z_zbuf_t *zbf, uint8_t header) { int8_t _z_request_encode(_z_wbuf_t *wbf, const _z_n_msg_request_t *msg) { int8_t ret = _Z_RES_OK; uint8_t header = _Z_MID_N_REQUEST | (_z_keyexpr_is_local(&msg->_key) ? _Z_FLAG_N_REQUEST_M : 0); - _Bool has_suffix = _z_keyexpr_has_suffix(&msg->_key); + bool has_suffix = _z_keyexpr_has_suffix(&msg->_key); if (has_suffix) { header |= _Z_FLAG_N_REQUEST_N; } @@ -240,11 +240,11 @@ int8_t _z_response_encode(_z_wbuf_t *wbf, const _z_n_msg_response_t *msg) { int8_t ret = _Z_RES_OK; uint8_t header = _Z_MID_N_RESPONSE; _Z_DEBUG("Encoding _Z_MID_N_RESPONSE"); - _Bool has_qos_ext = msg->_ext_qos._val != _Z_N_QOS_DEFAULT._val; - _Bool has_ts_ext = _z_timestamp_check(&msg->_ext_timestamp); - _Bool has_responder_ext = _z_id_check(msg->_ext_responder._zid) || msg->_ext_responder._eid != 0; + bool has_qos_ext = msg->_ext_qos._val != _Z_N_QOS_DEFAULT._val; + bool has_ts_ext = _z_timestamp_check(&msg->_ext_timestamp); + bool has_responder_ext = _z_id_check(msg->_ext_responder._zid) || msg->_ext_responder._eid != 0; int n_ext = (has_qos_ext ? 1 : 0) + (has_ts_ext ? 1 : 0) + (has_responder_ext ? 1 : 0); - _Bool has_suffix = _z_keyexpr_has_suffix(&msg->_key); + bool has_suffix = _z_keyexpr_has_suffix(&msg->_key); if (_z_keyexpr_is_local(&msg->_key)) { _Z_SET_FLAG(header, _Z_FLAG_N_RESPONSE_M); } @@ -392,8 +392,8 @@ int8_t _z_response_final_decode(_z_n_msg_response_final_t *msg, _z_zbuf_t *zbf, int8_t _z_declare_encode(_z_wbuf_t *wbf, const _z_n_msg_declare_t *decl) { uint8_t header = _Z_MID_N_DECLARE; - _Bool has_qos_ext = decl->_ext_qos._val != _Z_N_QOS_DEFAULT._val; - _Bool has_timestamp_ext = _z_timestamp_check(&decl->_ext_timestamp); + bool has_qos_ext = decl->_ext_qos._val != _Z_N_QOS_DEFAULT._val; + bool has_timestamp_ext = _z_timestamp_check(&decl->_ext_timestamp); int n_ext = (has_qos_ext ? 1 : 0) + (has_timestamp_ext ? 1 : 0); if (n_ext != 0) { header |= _Z_FLAG_N_Z; @@ -458,7 +458,7 @@ int8_t _z_declare_decode(_z_n_msg_declare_t *decl, _z_zbuf_t *zbf, uint8_t heade int8_t _z_n_interest_encode(_z_wbuf_t *wbf, const _z_n_msg_interest_t *interest) { // Set header uint8_t header = _Z_MID_N_INTEREST; - _Bool is_final = true; + bool is_final = true; if (_Z_HAS_FLAG(interest->_interest.flags, _Z_INTEREST_FLAG_CURRENT)) { is_final = false; _Z_SET_FLAG(header, _Z_FLAG_N_INTEREST_CURRENT); @@ -473,8 +473,8 @@ int8_t _z_n_interest_encode(_z_wbuf_t *wbf, const _z_n_msg_interest_t *interest) int8_t _z_n_interest_decode(_z_n_msg_interest_t *interest, _z_zbuf_t *zbf, uint8_t header) { interest->_interest = _z_interest_null(); - _Bool is_final = true; - _Bool has_ext = false; + bool is_final = true; + bool has_ext = false; if (_Z_HAS_FLAG(header, _Z_FLAG_N_INTEREST_CURRENT)) { _Z_SET_FLAG(interest->_interest.flags, _Z_INTEREST_FLAG_CURRENT); diff --git a/src/protocol/config.c b/src/protocol/config.c index ad4440fc2..4695de3c1 100644 --- a/src/protocol/config.c +++ b/src/protocol/config.c @@ -54,7 +54,7 @@ int8_t _z_str_intmap_from_strn(_z_str_intmap_t *strint, const char *s, uint8_t a if (p_key_end != NULL) { // Verify the key is valid based on the provided mapping size_t p_key_len = _z_ptr_char_diff(p_key_end, p_key_start); - _Bool found = false; + bool found = false; uint8_t key = 0; for (uint8_t i = 0; i < argc; i++) { if (p_key_len != strlen(argv[i]._str)) { diff --git a/src/protocol/core.c b/src/protocol/core.c index 8228bc2a3..f0a8ad702 100644 --- a/src/protocol/core.c +++ b/src/protocol/core.c @@ -38,8 +38,8 @@ uint8_t _z_id_len(_z_id_t id) { } return len; } -_Bool _z_id_check(_z_id_t id) { - _Bool ret = false; +bool _z_id_check(_z_id_t id) { + bool ret = false; for (int i = 0; !ret && i < _Z_ID_LEN; i++) { ret |= id.id[i] != 0; } diff --git a/src/protocol/definitions/declarations.c b/src/protocol/definitions/declarations.c index 3f02773bd..878f14f6d 100644 --- a/src/protocol/definitions/declarations.c +++ b/src/protocol/definitions/declarations.c @@ -74,7 +74,7 @@ _z_declaration_t _z_make_undecl_subscriber(uint32_t id, _Z_OPTIONAL const _z_key ._id = id, ._ext_keyexpr = (key == NULL) ? _z_keyexpr_null() : _z_keyexpr_duplicate(*key)}}}; } -_z_declaration_t _z_make_decl_queryable(_Z_MOVE(_z_keyexpr_t) key, uint32_t id, _Bool complete, uint16_t distance) { +_z_declaration_t _z_make_decl_queryable(_Z_MOVE(_z_keyexpr_t) key, uint32_t id, bool complete, uint16_t distance) { return (_z_declaration_t){ ._tag = _Z_DECL_QUERYABLE, ._body = {._decl_queryable = {._id = id, diff --git a/src/protocol/definitions/network.c b/src/protocol/definitions/network.c index 3f254b438..177e0bc0a 100644 --- a/src/protocol/definitions/network.c +++ b/src/protocol/definitions/network.c @@ -139,7 +139,7 @@ void _z_n_msg_free(_z_network_message_t **msg) { _z_zenoh_message_t _z_msg_make_query(_Z_MOVE(_z_keyexpr_t) key, _Z_MOVE(_z_slice_t) parameters, _z_zint_t qid, z_consolidation_mode_t consolidation, _Z_MOVE(_z_value_t) value, uint64_t timeout_ms, _z_bytes_t attachment, z_congestion_control_t cong_ctrl, - z_priority_t priority, _Bool is_express) { + z_priority_t priority, bool is_express) { return (_z_zenoh_message_t){ ._tag = _Z_N_REQUEST, ._reliability = Z_RELIABILITY_DEFAULT, @@ -171,7 +171,7 @@ _z_network_message_t _z_n_msg_make_response_final(_z_zint_t rid) { ._body = {._response_final = {._request_id = rid}}, }; } -_z_network_message_t _z_n_msg_make_declare(_z_declaration_t declaration, _Bool has_interest_id, uint32_t interest_id) { +_z_network_message_t _z_n_msg_make_declare(_z_declaration_t declaration, bool has_interest_id, uint32_t interest_id) { return (_z_network_message_t){ ._tag = _Z_N_DECLARE, ._reliability = Z_RELIABILITY_DEFAULT, diff --git a/src/protocol/definitions/transport.c b/src/protocol/definitions/transport.c index 8dcba2981..2af77cb97 100644 --- a/src/protocol/definitions/transport.c +++ b/src/protocol/definitions/transport.c @@ -196,7 +196,7 @@ _z_transport_message_t _z_t_msg_make_open_ack(_z_zint_t lease, _z_zint_t initial } /*------------------ Close Message ------------------*/ -_z_transport_message_t _z_t_msg_make_close(uint8_t reason, _Bool link_only) { +_z_transport_message_t _z_t_msg_make_close(uint8_t reason, bool link_only) { _z_transport_message_t msg; msg._header = _Z_MID_T_CLOSE; @@ -247,11 +247,11 @@ _z_transport_message_t _z_t_msg_make_frame_header(_z_zint_t sn, z_reliability_t } /*------------------ Fragment Message ------------------*/ -_z_transport_message_t _z_t_msg_make_fragment_header(_z_zint_t sn, z_reliability_t reliability, _Bool is_last) { +_z_transport_message_t _z_t_msg_make_fragment_header(_z_zint_t sn, z_reliability_t reliability, bool is_last) { return _z_t_msg_make_fragment(sn, _z_slice_empty(), reliability, is_last); } _z_transport_message_t _z_t_msg_make_fragment(_z_zint_t sn, _z_slice_t payload, z_reliability_t reliability, - _Bool is_last) { + bool is_last) { _z_transport_message_t msg; msg._header = _Z_MID_T_FRAGMENT; if (is_last == false) { diff --git a/src/protocol/iobuf.c b/src/protocol/iobuf.c index aa1f0346f..9422a5453 100644 --- a/src/protocol/iobuf.c +++ b/src/protocol/iobuf.c @@ -188,7 +188,7 @@ uint8_t const *_z_zbuf_start(const _z_zbuf_t *zbf) { } size_t _z_zbuf_len(const _z_zbuf_t *zbf) { return _z_iosli_readable(&zbf->_ios); } -_Bool _z_zbuf_can_read(const _z_zbuf_t *zbf) { return _z_zbuf_len(zbf) > (size_t)0; } +bool _z_zbuf_can_read(const _z_zbuf_t *zbf) { return _z_zbuf_len(zbf) > (size_t)0; } uint8_t _z_zbuf_read(_z_zbuf_t *zbf) { return _z_iosli_read(&zbf->_ios); } @@ -258,7 +258,7 @@ _z_iosli_t *_z_wbuf_get_iosli(const _z_wbuf_t *wbf, size_t idx) { return _z_iosl size_t _z_wbuf_len_iosli(const _z_wbuf_t *wbf) { return _z_iosli_vec_len(&wbf->_ioss); } -_z_wbuf_t _z_wbuf_make(size_t capacity, _Bool is_expandable) { +_z_wbuf_t _z_wbuf_make(size_t capacity, bool is_expandable) { _z_wbuf_t wbf; if (is_expandable == true) { // Preallocate 4 slots, this is usually what we expect diff --git a/src/protocol/keyexpr.c b/src/protocol/keyexpr.c index 6d87cbd73..9b23072f3 100644 --- a/src/protocol/keyexpr.c +++ b/src/protocol/keyexpr.c @@ -96,7 +96,7 @@ void _z_keyexpr_free(_z_keyexpr_t **rk) { } } -_Bool _z_keyexpr_equals(const _z_keyexpr_t *left, const _z_keyexpr_t *right) { +bool _z_keyexpr_equals(const _z_keyexpr_t *left, const _z_keyexpr_t *right) { if (left->_id != right->_id) { return false; } @@ -115,7 +115,7 @@ _z_keyexpr_t _z_keyexpr_alias(_z_keyexpr_t src) { return alias; } -_z_keyexpr_t _z_keyexpr_alias_from_user_defined(_z_keyexpr_t src, _Bool try_declared) { +_z_keyexpr_t _z_keyexpr_alias_from_user_defined(_z_keyexpr_t src, bool try_declared) { if ((try_declared && src._id != Z_RESOURCE_ID_NONE) || !_z_keyexpr_has_suffix(&src)) { return (_z_keyexpr_t){ ._id = src._id, @@ -131,7 +131,7 @@ _z_keyexpr_t _z_keyexpr_alias_from_user_defined(_z_keyexpr_t src, _Bool try_decl zp_keyexpr_canon_status_t __zp_canon_prefix(const char *start, size_t *len) { zp_keyexpr_canon_status_t ret = Z_KEYEXPR_CANON_SUCCESS; - _Bool in_big_wild = false; + bool in_big_wild = false; char const *chunk_start = start; const char *end = _z_cptr_char_offset(start, (ptrdiff_t)(*len)); char const *next_slash; @@ -237,7 +237,7 @@ zp_keyexpr_canon_status_t __zp_canon_prefix(const char *start, size_t *len) { void __zp_singleify(char *start, size_t *len, const char *needle) { const char *end = _z_cptr_char_offset(start, (ptrdiff_t)(*len)); - _Bool right_after_needle = false; + bool right_after_needle = false; char *reader = start; while (reader < end) { @@ -287,7 +287,7 @@ void __zp_ke_write_chunk(char **writer, const char *chunk, size_t len, const cha } /*------------------ Common helpers ------------------*/ -typedef _Bool (*_z_ke_chunk_matcher)(_z_str_se_t l, _z_str_se_t r); +typedef bool (*_z_ke_chunk_matcher)(_z_str_se_t l, _z_str_se_t r); enum _zp_wildness_t { _ZP_WILDNESS_ANY = 1, _ZP_WILDNESS_SUPERCHUNKS = 2, _ZP_WILDNESS_SUBCHUNK_DSL = 4 }; int8_t _zp_ke_wildness(_z_str_se_t ke, size_t *n_segments, size_t *n_verbatims) { @@ -329,14 +329,14 @@ const char *_Z_DELIMITER = "/"; const char *_Z_DOUBLE_STAR = "**"; const char *_Z_DOLLAR_STAR = "$*"; char _Z_VERBATIM = '@'; -_Bool _z_ke_isdoublestar(_z_str_se_t s) { +bool _z_ke_isdoublestar(_z_str_se_t s) { return ((_z_ptr_char_diff(s.end, s.start) == 2) && (s.start[0] == '*') && (s.start[1] == '*')); } /*------------------ Inclusion helpers ------------------*/ -_Bool _z_ke_chunk_includes_nodsl(_z_str_se_t l, _z_str_se_t r) { +bool _z_ke_chunk_includes_nodsl(_z_str_se_t l, _z_str_se_t r) { size_t llen = (size_t)(l.end - l.start); - _Bool result = + bool result = !(r.start[0] == _Z_VERBATIM) && ((llen == (size_t)1) && (l.start[0] == '*') && (((_z_ptr_char_diff(r.end, r.start) == 2) && (r.start[0] == '*')) == false)); if ((result == false) && (llen == _z_ptr_char_diff(r.end, r.start))) { @@ -346,8 +346,8 @@ _Bool _z_ke_chunk_includes_nodsl(_z_str_se_t l, _z_str_se_t r) { return result; } -_Bool _z_ke_chunk_includes_stardsl(_z_str_se_t l1, _z_str_se_t r) { - _Bool result = _z_ke_chunk_includes_nodsl(l1, r); +bool _z_ke_chunk_includes_stardsl(_z_str_se_t l1, _z_str_se_t r) { + bool result = _z_ke_chunk_includes_nodsl(l1, r); if (result == false && l1.start[0] != _Z_VERBATIM && r.start[0] != _Z_VERBATIM) { _z_splitstr_t lcs = {.s = l1, .delimiter = _Z_DOLLAR_STAR}; _z_str_se_t split_l = _z_splitstr_next(&lcs); @@ -386,13 +386,11 @@ _Bool _z_ke_chunk_includes_stardsl(_z_str_se_t l1, _z_str_se_t r) { return result; } -_Bool _z_keyexpr_is_wild_chunk(_z_str_se_t s) { return _z_ptr_char_diff(s.end, s.start) == 1 && s.start[0] == '*'; } +bool _z_keyexpr_is_wild_chunk(_z_str_se_t s) { return _z_ptr_char_diff(s.end, s.start) == 1 && s.start[0] == '*'; } -_Bool _z_keyexpr_is_superwild_chunk(_z_str_se_t s) { - return _z_ptr_char_diff(s.end, s.start) == 2 && s.start[0] == '*'; -} +bool _z_keyexpr_is_superwild_chunk(_z_str_se_t s) { return _z_ptr_char_diff(s.end, s.start) == 2 && s.start[0] == '*'; } -_Bool _z_keyexpr_has_verbatim(_z_str_se_t s) { +bool _z_keyexpr_has_verbatim(_z_str_se_t s) { _z_splitstr_t it = {.s = s, .delimiter = _Z_DELIMITER}; _z_str_se_t chunk = _z_splitstr_next(&it); while (chunk.start != NULL) { @@ -404,11 +402,11 @@ _Bool _z_keyexpr_has_verbatim(_z_str_se_t s) { return false; } -_Bool _z_keyexpr_suffix_includes_superwild(_z_str_se_t left, _z_str_se_t right, _z_ke_chunk_matcher chunk_includer) { +bool _z_keyexpr_suffix_includes_superwild(_z_str_se_t left, _z_str_se_t right, _z_ke_chunk_matcher chunk_includer) { for (;;) { _z_str_se_t lchunk = {0}; _z_str_se_t lrest = _z_splitstr_split_once((_z_splitstr_t){.s = left, .delimiter = _Z_DELIMITER}, &lchunk); - _Bool lempty = lrest.start == NULL; + bool lempty = lrest.start == NULL; if (_z_keyexpr_is_superwild_chunk(lchunk)) { if (lempty ? !_z_keyexpr_has_verbatim(right) : _z_keyexpr_suffix_includes_superwild(lrest, right, chunk_includer)) { @@ -437,12 +435,12 @@ _Bool _z_keyexpr_suffix_includes_superwild(_z_str_se_t left, _z_str_se_t right, } /*------------------ Zenoh-Core helpers ------------------*/ -_Bool _z_keyexpr_suffix_includes(const _z_keyexpr_t *left, const _z_keyexpr_t *right) { +bool _z_keyexpr_suffix_includes(const _z_keyexpr_t *left, const _z_keyexpr_t *right) { size_t llen = _z_string_len(&left->_suffix); size_t rlen = _z_string_len(&right->_suffix); const char *lstart = _z_string_data(&left->_suffix); const char *rstart = _z_string_data(&right->_suffix); - _Bool result = ((llen == rlen) && (strncmp(lstart, rstart, llen) == 0)); + bool result = ((llen == rlen) && (strncmp(lstart, rstart, llen) == 0)); if (result == false) { _z_str_se_t l = {.start = lstart, .end = _z_cptr_char_offset(lstart, (ptrdiff_t)llen)}; @@ -479,8 +477,8 @@ _Bool _z_keyexpr_suffix_includes(const _z_keyexpr_t *left, const _z_keyexpr_t *r } /*------------------ Intersection helpers ------------------*/ -_Bool _z_ke_chunk_intersect_nodsl(_z_str_se_t l, _z_str_se_t r) { - _Bool result = +bool _z_ke_chunk_intersect_nodsl(_z_str_se_t l, _z_str_se_t r) { + bool result = ((l.start[0] == '*' && r.start[0] != _Z_VERBATIM) || (r.start[0] == '*' && l.start[0] != _Z_VERBATIM)); if (result == false) { size_t lclen = _z_ptr_char_diff(l.end, l.start); @@ -489,8 +487,8 @@ _Bool _z_ke_chunk_intersect_nodsl(_z_str_se_t l, _z_str_se_t r) { return result; } -_Bool _z_ke_chunk_intersect_rhasstardsl(_z_str_se_t l, _z_str_se_t r) { - _Bool result = true; +bool _z_ke_chunk_intersect_rhasstardsl(_z_str_se_t l, _z_str_se_t r) { + bool result = true; _z_splitstr_t rchunks = {.s = r, .delimiter = _Z_DOLLAR_STAR}; _z_str_se_t split_r = _z_splitstr_next(&rchunks); result = _z_ptr_char_diff(split_r.end, split_r.start) <= _z_ptr_char_diff(l.end, l.start); @@ -524,13 +522,13 @@ _Bool _z_ke_chunk_intersect_rhasstardsl(_z_str_se_t l, _z_str_se_t r) { return result; } -_Bool _z_ke_chunk_intersect_stardsl(_z_str_se_t l, _z_str_se_t r) { - _Bool result = _z_ke_chunk_intersect_nodsl(l, r); +bool _z_ke_chunk_intersect_stardsl(_z_str_se_t l, _z_str_se_t r) { + bool result = _z_ke_chunk_intersect_nodsl(l, r); if (result == false && !(l.start[0] == '@' || r.start[0] == '@')) { result = true; - _Bool l_has_stardsl = (_z_strstr(l.start, l.end, _Z_DOLLAR_STAR) != NULL); + bool l_has_stardsl = (_z_strstr(l.start, l.end, _Z_DOLLAR_STAR) != NULL); if (l_has_stardsl == true) { - _Bool r_has_stardsl = (_z_strstr(r.start, r.end, _Z_DOLLAR_STAR) != NULL); + bool r_has_stardsl = (_z_strstr(r.start, r.end, _Z_DOLLAR_STAR) != NULL); if (r_has_stardsl == true) { char const *lc = l.start; char const *rc = r.start; @@ -557,8 +555,8 @@ _Bool _z_ke_chunk_intersect_stardsl(_z_str_se_t l, _z_str_se_t r) { return result; } -_Bool _z_ke_intersect_rhassuperchunks(_z_str_se_t l, _z_str_se_t r, _z_ke_chunk_matcher chunk_intersector) { - _Bool result = true; +bool _z_ke_intersect_rhassuperchunks(_z_str_se_t l, _z_str_se_t r, _z_ke_chunk_matcher chunk_intersector) { + bool result = true; _z_splitstr_t lchunks = {.s = l, .delimiter = _Z_DELIMITER}; _z_splitstr_t rsplitatsuperchunks = {.s = r, .delimiter = _Z_DOUBLE_STAR}; _z_str_se_t rnosuper = _z_splitstr_next(&rsplitatsuperchunks); @@ -603,7 +601,7 @@ _Bool _z_ke_intersect_rhassuperchunks(_z_str_se_t l, _z_str_se_t r, _z_ke_chunk_ .delimiter = _Z_DELIMITER}; _z_splitstr_t haystack = lchunks; _z_str_se_t needle_start = _z_splitstr_next(&needle); - _Bool needle_found = false; + bool needle_found = false; _z_str_se_t h = _z_splitstr_next(&haystack); while ((needle_found == false) && (h.start != NULL)) { @@ -643,7 +641,7 @@ _Bool _z_ke_intersect_rhassuperchunks(_z_str_se_t l, _z_str_se_t r, _z_ke_chunk_ return result; } -_Bool _z_keyexpr_intersect_bothsuper(_z_str_se_t l, _z_str_se_t r, _z_ke_chunk_matcher chunk_intersector) { +bool _z_keyexpr_intersect_bothsuper(_z_str_se_t l, _z_str_se_t r, _z_ke_chunk_matcher chunk_intersector) { _z_splitstr_t it1 = {.s = l, .delimiter = _Z_DELIMITER}; _z_splitstr_t it2 = {.s = r, .delimiter = _Z_DELIMITER}; _z_str_se_t current1 = {0}; @@ -676,12 +674,12 @@ _Bool _z_keyexpr_intersect_bothsuper(_z_str_se_t l, _z_str_se_t r, _z_ke_chunk_m (_z_splitstr_is_empty(&it2) || _z_keyexpr_is_superwild_chunk(it2.s)); } -_Bool _z_keyexpr_suffix_intersects(const _z_keyexpr_t *left, const _z_keyexpr_t *right) { +bool _z_keyexpr_suffix_intersects(const _z_keyexpr_t *left, const _z_keyexpr_t *right) { size_t llen = _z_string_len(&left->_suffix); size_t rlen = _z_string_len(&right->_suffix); const char *lstart = _z_string_data(&left->_suffix); const char *rstart = _z_string_data(&right->_suffix); - _Bool result = ((llen == rlen) && (strncmp(lstart, rstart, llen) == 0)); + bool result = ((llen == rlen) && (strncmp(lstart, rstart, llen) == 0)); if (result == false) { _z_str_se_t l = {.start = lstart, .end = _z_cptr_char_offset(lstart, (ptrdiff_t)llen)}; @@ -746,7 +744,7 @@ zp_keyexpr_canon_status_t _z_keyexpr_canonize(char *start, size_t *len) { char *next_slash = strchr(reader, '/'); char const *chunk_end = (next_slash != NULL) ? next_slash : end; - _Bool in_big_wild = false; + bool in_big_wild = false; if ((_z_ptr_char_diff(chunk_end, reader) == 2) && (reader[1] == '*')) { if (reader[0] == '*') { in_big_wild = true; @@ -855,7 +853,7 @@ zp_keyexpr_canon_status_t _z_keyexpr_canonize(char *start, size_t *len) { zp_keyexpr_canon_status_t _z_keyexpr_is_canon(const char *start, size_t len) { return __zp_canon_prefix(start, &len); } -_Bool _z_keyexpr_suffix_equals(const _z_keyexpr_t *left, const _z_keyexpr_t *right) { +bool _z_keyexpr_suffix_equals(const _z_keyexpr_t *left, const _z_keyexpr_t *right) { size_t llen = _z_string_len(&left->_suffix); size_t rlen = _z_string_len(&right->_suffix); const char *lstart = _z_string_data(&left->_suffix); diff --git a/src/session/interest.c b/src/session/interest.c index ffdc40a15..317ec3717 100644 --- a/src/session/interest.c +++ b/src/session/interest.c @@ -31,11 +31,11 @@ #if Z_FEATURE_INTEREST == 1 void _z_declare_data_clear(_z_declare_data_t *data) { _z_keyexpr_clear(&data->_key); } -_Bool _z_declare_data_eq(const _z_declare_data_t *left, const _z_declare_data_t *right) { +bool _z_declare_data_eq(const _z_declare_data_t *left, const _z_declare_data_t *right) { return ((left->_id == right->_id) && (left->_type == right->_type)); } -_Bool _z_session_interest_eq(const _z_session_interest_t *one, const _z_session_interest_t *two) { +bool _z_session_interest_eq(const _z_session_interest_t *one, const _z_session_interest_t *two) { return one->_id == two->_id; } diff --git a/src/session/query.c b/src/session/query.c index fef9dbaa0..11251914f 100644 --- a/src/session/query.c +++ b/src/session/query.c @@ -33,7 +33,7 @@ void _z_pending_query_clear(_z_pending_query_t *pen_qry) { _z_pending_reply_list_free(&pen_qry->_pending_replies); } -_Bool _z_pending_query_eq(const _z_pending_query_t *one, const _z_pending_query_t *two) { return one->_id == two->_id; } +bool _z_pending_query_eq(const _z_pending_query_t *one, const _z_pending_query_t *two) { return one->_id == two->_id; } /*------------------ Query ------------------*/ _z_zint_t _z_get_query_id(_z_session_t *zn) { return zn->_query_id++; } @@ -115,7 +115,7 @@ int8_t _z_trigger_query_reply_partial(_z_session_t *zn, const _z_zint_t id, cons _z_reply_t reply = _z_reply_create(expanded_ke, zn->_local_zid, msg->_payload, &msg->_commons._timestamp, &msg->_encoding, kind, msg->_attachment); - _Bool drop = false; + bool drop = false; // Verify if this is a newer reply, free the old one in case it is if ((ret == _Z_RES_OK) && ((pen_qry->_consolidation == Z_CONSOLIDATION_MODE_LATEST) || (pen_qry->_consolidation == Z_CONSOLIDATION_MODE_MONOTONIC))) { diff --git a/src/session/queryable.c b/src/session/queryable.c index 1e14b69ca..45e58abd0 100644 --- a/src/session/queryable.c +++ b/src/session/queryable.c @@ -27,7 +27,7 @@ #include "zenoh-pico/utils/logging.h" #if Z_FEATURE_QUERYABLE == 1 -_Bool _z_session_queryable_eq(const _z_session_queryable_t *one, const _z_session_queryable_t *two) { +bool _z_session_queryable_eq(const _z_session_queryable_t *one, const _z_session_queryable_t *two) { return one->_id == two->_id; } diff --git a/src/session/resource.c b/src/session/resource.c index 3c165266e..b573e600a 100644 --- a/src/session/resource.c +++ b/src/session/resource.c @@ -27,7 +27,7 @@ #include "zenoh-pico/utils/logging.h" #include "zenoh-pico/utils/pointers.h" -_Bool _z_resource_eq(const _z_resource_t *other, const _z_resource_t *this_) { return this_->_id == other->_id; } +bool _z_resource_eq(const _z_resource_t *other, const _z_resource_t *this_) { return this_->_id == other->_id; } void _z_resource_clear(_z_resource_t *res) { _z_keyexpr_clear(&res->_key); } @@ -244,7 +244,7 @@ uint16_t _z_register_resource(_z_session_t *zn, _z_keyexpr_t key, uint16_t id, u } void _z_unregister_resource(_z_session_t *zn, uint16_t id, uint16_t mapping) { - _Bool is_local = mapping == _Z_KEYEXPR_MAPPING_LOCAL; + bool is_local = mapping == _Z_KEYEXPR_MAPPING_LOCAL; _Z_DEBUG("unregistering: id %d, mapping: %d", id, mapping); _zp_session_lock_mutex(zn); _z_resource_list_t **parent_mut = is_local ? &zn->_local_resources : &zn->_remote_resources; @@ -271,7 +271,7 @@ void _z_unregister_resource(_z_session_t *zn, uint16_t id, uint16_t mapping) { _zp_session_unlock_mutex(zn); } -_Bool _z_unregister_resource_for_peer_filter(const _z_resource_t *candidate, const _z_resource_t *ctx) { +bool _z_unregister_resource_for_peer_filter(const _z_resource_t *candidate, const _z_resource_t *ctx) { uint16_t mapping = ctx->_id; return _z_keyexpr_mapping_id(&candidate->_key) == mapping; } diff --git a/src/session/rx.c b/src/session/rx.c index 51ef6369d..d8c2a4537 100644 --- a/src/session/rx.c +++ b/src/session/rx.c @@ -148,7 +148,7 @@ int8_t _z_handle_network_message(_z_session_rc_t *zsrc, _z_zenoh_message_t *msg, _Z_DEBUG("Handling _Z_N_INTEREST"); _z_n_msg_interest_t *interest = &msg->_body._interest; - _Bool not_final = ((interest->_interest.flags & _Z_INTEREST_NOT_FINAL_MASK) != 0); + bool not_final = ((interest->_interest.flags & _Z_INTEREST_NOT_FINAL_MASK) != 0); if (not_final) { _z_interest_process_interest(zn, interest->_interest._keyexpr, interest->_interest._id, interest->_interest.flags); diff --git a/src/session/scout.c b/src/session/scout.c index 7f11fb0de..cc8979cbe 100644 --- a/src/session/scout.c +++ b/src/session/scout.c @@ -25,7 +25,7 @@ #error "Scouting UDP requires UDP unicast links to be enabled (Z_FEATURE_LINK_UDP_UNICAST = 1 in config.h)" #endif -_z_hello_list_t *__z_scout_loop(const _z_wbuf_t *wbf, _z_string_t *locator, unsigned long period, _Bool exit_on_first) { +_z_hello_list_t *__z_scout_loop(const _z_wbuf_t *wbf, _z_string_t *locator, unsigned long period, bool exit_on_first) { // Define an empty array _z_hello_list_t *ret = NULL; int8_t err = _Z_RES_OK; @@ -130,7 +130,7 @@ _z_hello_list_t *__z_scout_loop(const _z_wbuf_t *wbf, _z_string_t *locator, unsi } _z_hello_list_t *_z_scout_inner(const z_what_t what, _z_id_t zid, _z_string_t *locator, const uint32_t timeout, - const _Bool exit_on_first) { + const bool exit_on_first) { _z_hello_list_t *ret = NULL; // Create the buffer to serialize the scout message on diff --git a/src/session/subscription.c b/src/session/subscription.c index a85338fb5..43a578491 100644 --- a/src/session/subscription.c +++ b/src/session/subscription.c @@ -29,7 +29,7 @@ #include "zenoh-pico/utils/logging.h" #if Z_FEATURE_SUBSCRIPTION == 1 -_Bool _z_subscription_eq(const _z_subscription_t *other, const _z_subscription_t *this_) { +bool _z_subscription_eq(const _z_subscription_t *other, const _z_subscription_t *this_) { return this_->_id == other->_id; } diff --git a/src/session/utils.c b/src/session/utils.c index 7479f82e4..8b5902496 100644 --- a/src/session/utils.c +++ b/src/session/utils.c @@ -38,7 +38,7 @@ void _z_timestamp_clear(_z_timestamp_t *tstamp) { tstamp->time = 0; } -_Bool _z_timestamp_check(const _z_timestamp_t *stamp) { return _z_id_check(stamp->id); } +bool _z_timestamp_check(const _z_timestamp_t *stamp) { return _z_id_check(stamp->id); } int8_t _z_session_generate_zid(_z_id_t *bs, uint8_t size) { int8_t ret = _Z_RES_OK; diff --git a/src/system/unix/link/raweth.c b/src/system/unix/link/raweth.c index 9a97546f2..015894754 100644 --- a/src/system/unix/link/raweth.c +++ b/src/system/unix/link/raweth.c @@ -99,7 +99,7 @@ size_t _z_receive_raweth(const _z_sys_net_socket_t *sock, void *buff, size_t buf if ((bytesRead < 0) || (bytesRead < (ssize_t)sizeof(_zp_eth_header_t))) { return SIZE_MAX; } - _Bool is_valid = true; + bool is_valid = true; // Address filtering (only if there is a whitelist) if (_zp_raweth_whitelist_array_len(whitelist) > 0) { is_valid = false; diff --git a/src/transport/common/tx.c b/src/transport/common/tx.c index 15020cbe3..6821bedaa 100644 --- a/src/transport/common/tx.c +++ b/src/transport/common/tx.c @@ -139,7 +139,7 @@ int8_t __unsafe_z_serialize_zenoh_fragment(_z_wbuf_t *dst, _z_wbuf_t *src, z_rel int8_t ret = _Z_RES_OK; // Assume first that this is not the final fragment - _Bool is_final = false; + bool is_final = false; do { size_t w_pos = _z_wbuf_get_wpos(dst); // Mark the buffer for the writing operation diff --git a/src/transport/multicast/rx.c b/src/transport/multicast/rx.c index cf239fa4e..73e40dee1 100644 --- a/src/transport/multicast/rx.c +++ b/src/transport/multicast/rx.c @@ -192,7 +192,7 @@ int8_t _z_multicast_handle_transport_message(_z_transport_multicast_t *ztm, _z_t ? &entry->_dbuf_reliable : &entry->_dbuf_best_effort; // Select the right defragmentation buffer - _Bool drop = false; + bool drop = false; if ((_z_wbuf_len(dbuf) + t_msg->_body._fragment._payload.len) > Z_FRAG_MAX_SIZE) { // Filling the wbuf capacity as a way to signaling the last fragment to reset the dbuf // Otherwise, last (smaller) fragments can be understood as a complete message diff --git a/src/transport/multicast/transport.c b/src/transport/multicast/transport.c index 3630a5f30..75835cdd2 100644 --- a/src/transport/multicast/transport.c +++ b/src/transport/multicast/transport.c @@ -166,7 +166,7 @@ int8_t _z_multicast_open_client(_z_transport_multicast_establish_param_t *param, return ret; } -int8_t _z_multicast_send_close(_z_transport_multicast_t *ztm, uint8_t reason, _Bool link_only) { +int8_t _z_multicast_send_close(_z_transport_multicast_t *ztm, uint8_t reason, bool link_only) { int8_t ret = _Z_RES_OK; // Send and clear message _z_transport_message_t cm = _z_t_msg_make_close(reason, link_only); @@ -232,7 +232,7 @@ int8_t _z_multicast_open_client(_z_transport_multicast_establish_param_t *param, return _Z_ERR_TRANSPORT_NOT_AVAILABLE; } -int8_t _z_multicast_send_close(_z_transport_multicast_t *ztm, uint8_t reason, _Bool link_only) { +int8_t _z_multicast_send_close(_z_transport_multicast_t *ztm, uint8_t reason, bool link_only) { _ZP_UNUSED(ztm); _ZP_UNUSED(reason); _ZP_UNUSED(link_only); diff --git a/src/transport/multicast/tx.c b/src/transport/multicast/tx.c index 3f7726db0..d51f4b3cf 100644 --- a/src/transport/multicast/tx.c +++ b/src/transport/multicast/tx.c @@ -79,7 +79,7 @@ int8_t _z_multicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_m _z_transport_multicast_t *ztm = &zn->_tp._transport._multicast; // Acquire the lock and drop the message if needed - _Bool drop = false; + bool drop = false; if (cong_ctrl == Z_CONGESTION_CONTROL_BLOCK) { #if Z_FEATURE_MULTI_THREAD == 1 _z_mutex_lock(&ztm->_mutex_tx); @@ -121,7 +121,7 @@ int8_t _z_multicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_m ret = _z_network_message_encode(&fbf, n_msg); // Encode the message on the expandable wbuf if (ret == _Z_RES_OK) { - _Bool is_first = true; // Fragment and send the message + bool is_first = true; // Fragment and send the message while (_z_wbuf_len(&fbf) > 0) { if (is_first == false) { // Get the fragment sequence number sn = __unsafe_z_multicast_get_sn(ztm, reliability); diff --git a/src/transport/peer_entry.c b/src/transport/peer_entry.c index 013c8c6de..7d72604e3 100644 --- a/src/transport/peer_entry.c +++ b/src/transport/peer_entry.c @@ -48,8 +48,8 @@ size_t _z_transport_peer_entry_size(const _z_transport_peer_entry_t *src) { return sizeof(_z_transport_peer_entry_t); } -_Bool _z_transport_peer_entry_eq(const _z_transport_peer_entry_t *left, const _z_transport_peer_entry_t *right) { - _Bool ret = true; +bool _z_transport_peer_entry_eq(const _z_transport_peer_entry_t *left, const _z_transport_peer_entry_t *right) { + bool ret = true; if (memcmp(left->_remote_zid.id, right->_remote_zid.id, 16) != 0) { ret = false; } diff --git a/src/transport/raweth/link.c b/src/transport/raweth/link.c index 4c6a82b85..75ebdfac0 100644 --- a/src/transport/raweth/link.c +++ b/src/transport/raweth/link.c @@ -65,18 +65,18 @@ const uint8_t _ZP_RAWETH_DEFAULT_SMAC[_ZP_MAC_ADDR_LENGTH] = {0x30, 0x03, 0xc8, const _zp_raweth_mapping_entry_t _ZP_RAWETH_DEFAULT_MAPPING = { {0, {0}, {{0, NULL, {NULL, NULL}}}}, 0x0000, {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, false}; -static _Bool _z_valid_iface_raweth(_z_str_intmap_t *config); +static bool _z_valid_iface_raweth(_z_str_intmap_t *config); static const char *_z_get_iface_raweth(_z_str_intmap_t *config); -static _Bool _z_valid_ethtype_raweth(_z_str_intmap_t *config); +static bool _z_valid_ethtype_raweth(_z_str_intmap_t *config); static long _z_get_ethtype_raweth(_z_str_intmap_t *config); static size_t _z_valid_mapping_raweth(_z_str_intmap_t *config); static int8_t _z_get_mapping_raweth(_z_str_intmap_t *config, _zp_raweth_mapping_array_t *array, size_t size); static size_t _z_valid_whitelist_raweth(_z_str_intmap_t *config); static int8_t _z_get_whitelist_raweth(_z_str_intmap_t *config, _zp_raweth_whitelist_array_t *array, size_t size); static int8_t _z_get_mapping_entry(char *entry, _zp_raweth_mapping_entry_t *storage); -static _Bool _z_valid_mapping_entry(char *entry); -static _Bool _z_valid_address_raweth_inner(const _z_string_t *address); -static _Bool _z_valid_address_raweth(const char *address); +static bool _z_valid_mapping_entry(char *entry); +static bool _z_valid_address_raweth_inner(const _z_string_t *address); +static bool _z_valid_address_raweth(const char *address); static uint8_t *_z_parse_address_raweth(const char *address); static int8_t _z_f_link_open_raweth(_z_link_t *self); static int8_t _z_f_link_listen_raweth(_z_link_t *self); @@ -88,7 +88,7 @@ static size_t _z_f_link_read_raweth(const _z_link_t *self, uint8_t *ptr, size_t static size_t _z_f_link_read_exact_raweth(const _z_link_t *self, uint8_t *ptr, size_t len, _z_slice_t *addr); static uint16_t _z_get_link_mtu_raweth(void); -static _Bool _z_valid_iface_raweth(_z_str_intmap_t *config) { +static bool _z_valid_iface_raweth(_z_str_intmap_t *config) { const char *iface = _z_str_intmap_get(config, RAWETH_CONFIG_IFACE_KEY); return (iface != NULL); } @@ -97,7 +97,7 @@ static const char *_z_get_iface_raweth(_z_str_intmap_t *config) { return _z_str_intmap_get(config, RAWETH_CONFIG_IFACE_KEY); } -static _Bool _z_valid_ethtype_raweth(_z_str_intmap_t *config) { +static bool _z_valid_ethtype_raweth(_z_str_intmap_t *config) { const char *s_ethtype = _z_str_intmap_get(config, RAWETH_CONFIG_ETHTYPE_KEY); if (s_ethtype == NULL) { return false; @@ -282,7 +282,7 @@ static int8_t _z_get_mapping_entry(char *entry, _zp_raweth_mapping_entry_t *stor } return _Z_RES_OK; } -static _Bool _z_valid_mapping_entry(char *entry) { +static bool _z_valid_mapping_entry(char *entry) { size_t len = strlen(entry); const char *entry_end = &entry[len - (size_t)1]; @@ -311,7 +311,7 @@ static _Bool _z_valid_mapping_entry(char *entry) { return true; } -static _Bool _z_valid_address_raweth_inner(const _z_string_t *address) { +static bool _z_valid_address_raweth_inner(const _z_string_t *address) { // Check if the string has the correct length size_t len = _z_string_len(address); const char *str_data = _z_string_data(address); @@ -336,7 +336,7 @@ static _Bool _z_valid_address_raweth_inner(const _z_string_t *address) { return true; } -static _Bool _z_valid_address_raweth(const char *address) { +static bool _z_valid_address_raweth(const char *address) { _z_string_t addr_str = _z_string_alias_str(address); return _z_valid_address_raweth_inner(&addr_str); } diff --git a/src/transport/raweth/rx.c b/src/transport/raweth/rx.c index a1fdb9d1e..b186c4b9b 100644 --- a/src/transport/raweth/rx.c +++ b/src/transport/raweth/rx.c @@ -36,7 +36,7 @@ static size_t _z_raweth_link_recv_zbuf(const _z_link_t *link, _z_zbuf_t *zbf, _z return SIZE_MAX; } // Check if header has vlan - _Bool has_vlan = false; + bool has_vlan = false; _zp_eth_header_t *header = (_zp_eth_header_t *)buff; if (header->ethtype == _ZP_ETH_TYPE_VLAN) { has_vlan = true; diff --git a/src/transport/raweth/tx.c b/src/transport/raweth/tx.c index 7e21ff6a6..ecfc26fd1 100644 --- a/src/transport/raweth/tx.c +++ b/src/transport/raweth/tx.c @@ -286,7 +286,7 @@ int8_t _z_raweth_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_msg, // Encode the message on the expandable wbuf _Z_CLEAN_RETURN_IF_ERR(_z_network_message_encode(&fbf, n_msg), _zp_raweth_unlock_tx_mutex(ztm)); // Fragment and send the message - _Bool is_first = true; + bool is_first = true; while (_z_wbuf_len(&fbf) > 0) { if (is_first) { // Get the fragment sequence number diff --git a/src/transport/transport.c b/src/transport/transport.c index a53b7e364..d81574201 100644 --- a/src/transport/transport.c +++ b/src/transport/transport.c @@ -32,7 +32,7 @@ #include "zenoh-pico/transport/utils.h" #include "zenoh-pico/utils/logging.h" -int8_t _z_send_close(_z_transport_t *zt, uint8_t reason, _Bool link_only) { +int8_t _z_send_close(_z_transport_t *zt, uint8_t reason, bool link_only) { int8_t ret = _Z_RES_OK; // Call transport function switch (zt->_type) { diff --git a/src/transport/unicast/rx.c b/src/transport/unicast/rx.c index 2ce613ab4..be2884af9 100644 --- a/src/transport/unicast/rx.c +++ b/src/transport/unicast/rx.c @@ -145,7 +145,7 @@ int8_t _z_unicast_handle_transport_message(_z_transport_unicast_t *ztu, _z_trans ? &ztu->_dbuf_reliable : &ztu->_dbuf_best_effort; // Select the right defragmentation buffer - _Bool drop = false; + bool drop = false; if ((_z_wbuf_len(dbuf) + t_msg->_body._fragment._payload.len) > Z_FRAG_MAX_SIZE) { // Filling the wbuf capacity as a way to signal the last fragment to reset the dbuf // Otherwise, last (smaller) fragments can be understood as a complete message diff --git a/src/transport/unicast/transport.c b/src/transport/unicast/transport.c index 7003e3055..c43c2c85a 100644 --- a/src/transport/unicast/transport.c +++ b/src/transport/unicast/transport.c @@ -53,7 +53,7 @@ int8_t _z_unicast_transport_create(_z_transport_t *zt, _z_link_t *zl, _z_transpo size_t dbuf_size = 0; size_t wbuf_size = mtu; size_t zbuf_size = param->_batch_size; - _Bool expandable = false; + bool expandable = false; // Set expandable on stream link if (zl->_cap._flow == Z_LINK_CAP_FLOW_STREAM) { @@ -261,7 +261,7 @@ int8_t _z_unicast_open_peer(_z_transport_unicast_establish_param_t *param, const return ret; } -int8_t _z_unicast_send_close(_z_transport_unicast_t *ztu, uint8_t reason, _Bool link_only) { +int8_t _z_unicast_send_close(_z_transport_unicast_t *ztu, uint8_t reason, bool link_only) { int8_t ret = _Z_RES_OK; // Send and clear message _z_transport_message_t cm = _z_t_msg_make_close(reason, link_only); @@ -330,7 +330,7 @@ int8_t _z_unicast_open_peer(_z_transport_unicast_establish_param_t *param, const return _Z_ERR_TRANSPORT_NOT_AVAILABLE; } -int8_t _z_unicast_send_close(_z_transport_unicast_t *ztu, uint8_t reason, _Bool link_only) { +int8_t _z_unicast_send_close(_z_transport_unicast_t *ztu, uint8_t reason, bool link_only) { _ZP_UNUSED(ztu); _ZP_UNUSED(reason); _ZP_UNUSED(link_only); diff --git a/src/transport/unicast/tx.c b/src/transport/unicast/tx.c index 78c8bb125..4fc097770 100644 --- a/src/transport/unicast/tx.c +++ b/src/transport/unicast/tx.c @@ -82,7 +82,7 @@ int8_t _z_unicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_msg _z_transport_unicast_t *ztu = &zn->_tp._transport._unicast; // Acquire the lock and drop the message if needed - _Bool drop = false; + bool drop = false; if (cong_ctrl == Z_CONGESTION_CONTROL_BLOCK) { #if Z_FEATURE_MULTI_THREAD == 1 _z_mutex_lock(&ztu->_mutex_tx); @@ -130,7 +130,7 @@ int8_t _z_unicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_msg ret = _z_network_message_encode(&fbf, n_msg); // Encode the message on the expandable wbuf if (ret == _Z_RES_OK) { - _Bool is_first = true; // Fragment and send the message + bool is_first = true; // Fragment and send the message while (_z_wbuf_len(&fbf) > 0) { if (is_first == false) { // Get the fragment sequence number sn = __unsafe_z_unicast_get_sn(ztu, reliability); diff --git a/src/transport/utils.c b/src/transport/utils.c index a1cad92db..510a0f19c 100644 --- a/src/transport/utils.c +++ b/src/transport/utils.c @@ -77,7 +77,7 @@ _z_zint_t _z_sn_modulo_mask(uint8_t bits) { return ret; } -_Bool _z_sn_precedes(const _z_zint_t sn_resolution, const _z_zint_t sn_left, const _z_zint_t sn_right) { +bool _z_sn_precedes(const _z_zint_t sn_resolution, const _z_zint_t sn_left, const _z_zint_t sn_right) { _z_zint_t distance = (sn_right - sn_left) & sn_resolution; return ((distance <= _z_sn_half(sn_resolution)) && (distance != 0)); } diff --git a/src/utils/string.c b/src/utils/string.c index 512ae2310..2611d56db 100644 --- a/src/utils/string.c +++ b/src/utils/string.c @@ -54,7 +54,7 @@ char const *_z_bstrstr(_z_str_se_t haystack, _z_str_se_t needle) { char const *result = NULL; for (; (result == false) && (haystack.start <= haystack.end); haystack.start = _z_cptr_char_offset(haystack.start, 1)) { - _Bool found = true; + bool found = true; char const *n = needle.start; char const *h = haystack.start; while (_z_ptr_char_diff(needle.end, n) > 0) { @@ -91,7 +91,7 @@ char const *_z_bstrstr_skipneedle(_z_str_se_t haystack, _z_str_se_t needle) { return result; } -_Bool _z_splitstr_is_empty(const _z_splitstr_t *src) { return src->s.start == NULL; } +bool _z_splitstr_is_empty(const _z_splitstr_t *src) { return src->s.start == NULL; } _z_str_se_t _z_splitstr_next(_z_splitstr_t *str) { _z_str_se_t result = str->s; if (str->s.start != NULL) { diff --git a/tests/z_api_alignment_test.c b/tests/z_api_alignment_test.c index 1943defb1..17b5101d2 100644 --- a/tests/z_api_alignment_test.c +++ b/tests/z_api_alignment_test.c @@ -139,7 +139,7 @@ int main(int argc, char **argv) { z_view_keyexpr_from_str(&key_demo_example_a, "demo/example/a"); z_view_keyexpr_from_str(&key_demo_example_starstar, "demo/example/**"); - _Bool _ret_bool = z_keyexpr_includes(z_loan(key_demo_example_starstar), z_loan(key_demo_example_a)); + bool _ret_bool = z_keyexpr_includes(z_loan(key_demo_example_starstar), z_loan(key_demo_example_a)); assert(_ret_bool); _ret_bool = z_keyexpr_intersects(z_loan(key_demo_example_starstar), z_loan(key_demo_example_a)); assert(_ret_bool); diff --git a/tests/z_api_bytes_test.c b/tests/z_api_bytes_test.c index ae1812137..0393302e5 100644 --- a/tests/z_api_bytes_test.c +++ b/tests/z_api_bytes_test.c @@ -174,11 +174,11 @@ void custom_deleter(void *data, void *context) { (*cnt)++; } -_Bool z_check_and_drop_payload(z_owned_bytes_t *payload, uint8_t *data, size_t len) { +bool z_check_and_drop_payload(z_owned_bytes_t *payload, uint8_t *data, size_t len) { z_owned_slice_t out; z_bytes_deserialize_into_slice(z_bytes_loan(payload), &out); z_bytes_drop(z_bytes_move(payload)); - _Bool res = memcmp(data, z_slice_data(z_slice_loan(&out)), len) == 0; + bool res = memcmp(data, z_slice_data(z_slice_loan(&out)), len) == 0; z_slice_drop(z_slice_move(&out)); return res; @@ -299,7 +299,7 @@ void test_pair(void) { assert(d == 123.45); } -_Bool check_slice(const z_loaned_bytes_t *b, const uint8_t *data, size_t len) { +bool check_slice(const z_loaned_bytes_t *b, const uint8_t *data, size_t len) { z_bytes_slice_iterator_t it = z_bytes_get_slice_iterator(b); uint8_t *data_out = (uint8_t *)malloc(len); z_view_slice_t v; diff --git a/tests/z_iobuf_test.c b/tests/z_iobuf_test.c index 3a851efc0..8ad9be44c 100644 --- a/tests/z_iobuf_test.c +++ b/tests/z_iobuf_test.c @@ -59,7 +59,7 @@ size_t gen_size_t(void) { _z_zbuf_t gen_zbuf(size_t len) { return _z_zbuf_make(len); } _z_wbuf_t gen_wbuf(size_t len) { - _Bool is_expandable = false; + bool is_expandable = false; if (gen_bool() == true) { is_expandable = true; diff --git a/tests/z_keyexpr_test.c b/tests/z_keyexpr_test.c index ff5a01a86..96fc7df93 100644 --- a/tests/z_keyexpr_test.c +++ b/tests/z_keyexpr_test.c @@ -341,7 +341,7 @@ void test_equals(void) { TEST_TRUE_EQUAL("greetings/hello/there", "greetings/hello/there"); } -_Bool keyexpr_equals_string(const z_loaned_keyexpr_t *ke, const char *s) { +bool keyexpr_equals_string(const z_loaned_keyexpr_t *ke, const char *s) { z_view_string_t vs; z_keyexpr_as_view_string(ke, &vs); _z_string_t str = _z_string_alias_str(s); diff --git a/tests/z_msgcodec_test.c b/tests/z_msgcodec_test.c index a94688ed4..1a7cefcc4 100644 --- a/tests/z_msgcodec_test.c +++ b/tests/z_msgcodec_test.c @@ -135,7 +135,7 @@ void print_scouting_message_type(uint8_t header) { /*=============================*/ /* Generating functions */ /*=============================*/ -_Bool gen_bool(void) { return z_random_u8() % 2; } +bool gen_bool(void) { return z_random_u8() % 2; } uint8_t gen_uint8(void) { return z_random_u8(); } @@ -160,7 +160,7 @@ _z_zint_t gen_zint(void) { } _z_wbuf_t gen_wbuf(size_t len) { - _Bool is_expandable = false; + bool is_expandable = false; if (gen_bool()) { is_expandable = true; @@ -647,7 +647,7 @@ _z_keyexpr_t gen_keyexpr(void) { _z_keyexpr_t key; key._id = gen_uint16(); key._mapping._val = gen_uint8(); - _Bool is_numerical = gen_bool(); + bool is_numerical = gen_bool(); if (is_numerical == true) { key._suffix = _z_string_null(); } else { @@ -1037,7 +1037,7 @@ void assert_eq_declaration(const _z_declaration_t *left, const _z_declaration_t /*------------------ Declare message ------------------*/ _z_network_message_t gen_declare_message(void) { _z_declaration_t declaration = gen_declaration(); - _Bool has_id = gen_bool(); + bool has_id = gen_bool(); uint32_t id = gen_uint32(); return _z_n_msg_make_declare(declaration, has_id, id); } @@ -1084,7 +1084,7 @@ void declare_message(void) { _z_interest_t gen_interest(void) { _z_interest_t i = {0}; - _Bool is_final = gen_bool(); // To determine if interest is final or not + bool is_final = gen_bool(); // To determine if interest is final or not // Generate interest id i._id = gen_uint32(); printf("Gen interest %d\n", is_final); @@ -1093,7 +1093,7 @@ _z_interest_t gen_interest(void) { // Generate base flags i.flags = gen_uint8() & _Z_MSGCODEC_INTEREST_BASE_FLAGS_MASK; // Generate test cases - _Bool is_restricted = gen_bool(); + bool is_restricted = gen_bool(); uint8_t cf_type = gen_uint8() % 3; // Flags must be c, f or cf switch (cf_type) { default: @@ -1157,7 +1157,7 @@ void interest_message(void) { /*=============================*/ /*------------------ Push message ------------------*/ _z_push_body_t gen_push_body(void) { - _Bool isput = gen_bool(); + bool isput = gen_bool(); _z_timestamp_t ts = gen_bool() ? gen_timestamp() : _z_timestamp_null(); _z_source_info_t sinfo = gen_bool() ? gen_source_info() : _z_source_info_null(); _z_m_push_commons_t commons = {._source_info = sinfo, ._timestamp = ts}; diff --git a/tests/z_peer_multicast_test.c b/tests/z_peer_multicast_test.c index 23e477ec4..9548c5b9f 100644 --- a/tests/z_peer_multicast_test.c +++ b/tests/z_peer_multicast_test.c @@ -65,7 +65,7 @@ int main(int argc, char **argv) { assert(argc == 2); (void)(argc); - _Bool is_reliable = strncmp(argv[1], "tcp", 3) == 0; + bool is_reliable = strncmp(argv[1], "tcp", 3) == 0; z_owned_config_t config; z_config_default(&config); diff --git a/zenohpico.pc b/zenohpico.pc index 8c92f5f98..d3ac867e5 100644 --- a/zenohpico.pc +++ b/zenohpico.pc @@ -3,6 +3,6 @@ prefix=/usr/local Name: zenohpico Description: URL: -Version: 1.0.20240905dev +Version: 1.0.20240917dev Cflags: -I${prefix}/include Libs: -L${prefix}/lib -lzenohpico From 0b3cf9f44577575c61c24ebc732ba216bfac4442 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Tue, 17 Sep 2024 11:42:27 +0200 Subject: [PATCH 2/7] rename asm stub argument for windows --- include/zenoh-pico/system/platform/windows.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zenoh-pico/system/platform/windows.h b/include/zenoh-pico/system/platform/windows.h index 57513e20a..cb41f243d 100644 --- a/include/zenoh-pico/system/platform/windows.h +++ b/include/zenoh-pico/system/platform/windows.h @@ -46,6 +46,6 @@ typedef struct { } _ep; } _z_sys_net_endpoint_t; -inline void __asm__(char *asm) { (void)(asm); } +inline void __asm__(char *instruction) { (void)(instruction); } #endif /* ZENOH_PICO_SYSTEM_VOID_H */ From 1f2612857f207ce414e7269fb48d2cbbd1464feb Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Tue, 17 Sep 2024 15:32:49 +0200 Subject: [PATCH 3/7] allow shared libs on windows --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e224af3d..8ca37bba7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,9 +63,7 @@ if(CMAKE_EXPORT_COMPILE_COMMANDS) ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) endif() -if(CMAKE_SYSTEM_NAME MATCHES "Windows") - set(BUILD_SHARED_LIBS "OFF") -elseif(CMAKE_SYSTEM_NAME MATCHES "Generic") +if(CMAKE_SYSTEM_NAME MATCHES "Generic") if(WITH_ZEPHYR) set(BUILD_SHARED_LIBS "OFF") endif() From 44f7b3ebd4801076b3325a3d7acf169e26e8612f Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Tue, 17 Sep 2024 16:01:40 +0200 Subject: [PATCH 4/7] export all symbols for windows dll --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ca37bba7..593119f93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,11 @@ if(CMAKE_EXPORT_COMPILE_COMMANDS) ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) endif() -if(CMAKE_SYSTEM_NAME MATCHES "Generic") +if(CMAKE_SYSTEM_NAME MATCHES "Windows") + if (BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + endif() +elseif(CMAKE_SYSTEM_NAME MATCHES "Generic") if(WITH_ZEPHYR) set(BUILD_SHARED_LIBS "OFF") endif() From 9845b4e7a547d1c9765a1d199b30d3cb7e686057 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Tue, 17 Sep 2024 16:47:39 +0200 Subject: [PATCH 5/7] use NOMINMAX --- include/zenoh-pico/system/platform-common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/zenoh-pico/system/platform-common.h b/include/zenoh-pico/system/platform-common.h index 15f2440aa..de614c5da 100644 --- a/include/zenoh-pico/system/platform-common.h +++ b/include/zenoh-pico/system/platform-common.h @@ -25,6 +25,7 @@ #if defined(ZENOH_LINUX) || defined(ZENOH_MACOS) || defined(ZENOH_BSD) #include "zenoh-pico/system/platform/unix.h" #elif defined(ZENOH_WINDOWS) +#define NOMINMAX #include "zenoh-pico/system/platform/windows.h" #elif defined(ZENOH_ESPIDF) #include "zenoh-pico/system/platform/espidf.h" From 5690cfa25db2fa0fd6698a44cbcd714c65f47fcd Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Tue, 17 Sep 2024 17:29:15 +0200 Subject: [PATCH 6/7] install dll on windows --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 593119f93..3333e38bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -339,6 +339,7 @@ install(TARGETS ${Libname} EXPORT zenohpicoTargets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin COMPONENT Library ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/zenoh-pico.h From 94bb578d21e89044e6d10ffa6ed678dc6987c0db Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Wed, 18 Sep 2024 10:33:13 +0200 Subject: [PATCH 7/7] reset Z_FEATURE_UNSTABLE_API to 0 in config.h --- include/zenoh-pico/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zenoh-pico/config.h b/include/zenoh-pico/config.h index 7cdc80718..1230a0a4b 100644 --- a/include/zenoh-pico/config.h +++ b/include/zenoh-pico/config.h @@ -21,7 +21,7 @@ #define Z_BATCH_MULTICAST_SIZE 2048 #define Z_CONFIG_SOCKET_TIMEOUT 100 -#define Z_FEATURE_UNSTABLE_API 1 +#define Z_FEATURE_UNSTABLE_API 0 #define Z_FEATURE_MULTI_THREAD 1 #define Z_FEATURE_PUBLICATION 1 #define Z_FEATURE_SUBSCRIPTION 1