Skip to content

Commit

Permalink
Fix modular build
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Jan 24, 2025
1 parent 5788439 commit 746e2b0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 44 deletions.
50 changes: 25 additions & 25 deletions include/zenoh-pico/net/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,31 @@ void _z_query_free(_z_query_t **query);

_Z_REFCOUNT_DEFINE(_z_query, _z_query)

/**
* Return type when declaring a querier.
*/
typedef struct _z_querier_t {
_z_keyexpr_t _key;
_z_zint_t _id;
_z_session_weak_t _zn;
_z_encoding_t _encoding;
z_consolidation_mode_t _consolidation_mode;
z_query_target_t _target;
z_congestion_control_t _congestion_control;
z_priority_t _priority;
z_reliability_t reliability;
bool _is_express;
uint64_t _timeout_ms;
} _z_querier_t;

#if Z_FEATURE_QUERY == 1
// Warning: None of the sub-types require a non-0 initialization. Add a init function if it changes.
static inline _z_querier_t _z_querier_null(void) { return (_z_querier_t){0}; }
static inline bool _z_querier_check(const _z_querier_t *querier) { return !_Z_RC_IS_NULL(&querier->_zn); }
void _z_querier_clear(_z_querier_t *querier);
void _z_querier_free(_z_querier_t **querier);
#endif

/**
* Return type when declaring a queryable.
*/
Expand Down Expand Up @@ -81,31 +106,6 @@ void _z_queryable_free(_z_queryable_t **qbl);

#endif

/**
* Return type when declaring a querier.
*/
typedef struct _z_querier_t {
_z_keyexpr_t _key;
_z_zint_t _id;
_z_session_weak_t _zn;
_z_encoding_t _encoding;
z_consolidation_mode_t _consolidation_mode;
z_query_target_t _target;
z_congestion_control_t _congestion_control;
z_priority_t _priority;
z_reliability_t reliability;
bool _is_express;
uint64_t _timeout_ms;
} _z_querier_t;

#if Z_FEATURE_QUERY == 1
// Warning: None of the sub-types require a non-0 initialization. Add a init function if it changes.
static inline _z_querier_t _z_querier_null(void) { return (_z_querier_t){0}; }
static inline bool _z_querier_check(const _z_querier_t *querier) { return !_Z_RC_IS_NULL(&querier->_zn); }
void _z_querier_clear(_z_querier_t *querier);
void _z_querier_free(_z_querier_t **querier);
#endif

#ifdef __cplusplus
}
#endif
Expand Down
38 changes: 19 additions & 19 deletions src/net/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,6 @@
#include "zenoh-pico/transport/common/tx.h"
#include "zenoh-pico/utils/logging.h"

#if Z_FEATURE_QUERY == 1
void _z_querier_clear(_z_querier_t *querier) {
_z_keyexpr_clear(&querier->_key);
_z_session_weak_drop(&querier->_zn);
_z_encoding_clear(&querier->_encoding);
*querier = _z_querier_null();
}

void _z_querier_free(_z_querier_t **querier) {
_z_querier_t *ptr = *querier;

if (ptr != NULL) {
_z_querier_clear(ptr);

z_free(ptr);
*querier = NULL;
}
}

static void _z_query_clear_inner(_z_query_t *q) {
_z_keyexpr_clear(&q->_key);
_z_value_clear(&q->_value);
Expand Down Expand Up @@ -74,6 +55,25 @@ void _z_query_free(_z_query_t **query) {
*query = NULL;
}
}

#if Z_FEATURE_QUERY == 1
void _z_querier_clear(_z_querier_t *querier) {
_z_keyexpr_clear(&querier->_key);
_z_session_weak_drop(&querier->_zn);
_z_encoding_clear(&querier->_encoding);
*querier = _z_querier_null();
}

void _z_querier_free(_z_querier_t **querier) {
_z_querier_t *ptr = *querier;

if (ptr != NULL) {
_z_querier_clear(ptr);

z_free(ptr);
*querier = NULL;
}
}
#endif

#if Z_FEATURE_QUERYABLE == 1
Expand Down

0 comments on commit 746e2b0

Please sign in to comment.