Skip to content

Commit

Permalink
fix: conditional compilation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Sep 6, 2024
1 parent 67ded42 commit 2f6d549
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 1 addition & 7 deletions src/api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1539,13 +1539,7 @@ void _z_subscriber_drop(_z_subscriber_t *sub) { _z_undeclare_and_clear_subscribe
_Z_OWNED_FUNCTIONS_VALUE_NO_COPY_IMPL(_z_subscriber_t, subscriber, _z_subscriber_check, _z_subscriber_null,
_z_subscriber_drop)

void z_subscriber_options_default(z_subscriber_options_t *options) {
#if Z_FEATURE_UNSTABLE_API == 1
options->reliability = Z_RELIABILITY_DEFAULT;
#else
options->__dummy = 0;
#endif
}
void z_subscriber_options_default(z_subscriber_options_t *options) { options->__dummy = 0; }

int8_t z_declare_subscriber(z_owned_subscriber_t *sub, const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr,
z_moved_closure_sample_t *callback, const z_subscriber_options_t *options) {
Expand Down
10 changes: 7 additions & 3 deletions src/session/push.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#include "zenoh-pico/session/subscription.h"
#include "zenoh-pico/utils/logging.h"

#if Z_FEATURE_SUBSCRIPTION == 1
int8_t _z_trigger_push(_z_session_t *zn, _z_n_msg_push_t *push, z_reliability_t reliability) {
int8_t ret = _Z_RES_OK;

// TODO check body to know where to dispatch
#if Z_FEATURE_SUBSCRIPTION == 1

size_t kind = push->_body._is_put ? Z_SAMPLE_KIND_PUT : Z_SAMPLE_KIND_DELETE;
if (push->_body._is_put) {
Expand All @@ -39,9 +39,13 @@ int8_t _z_trigger_push(_z_session_t *zn, _z_n_msg_push_t *push, z_reliability_t
ret = _z_trigger_subscriptions(zn, push->_key, payload, &encoding, kind, &del->_commons._timestamp, push->_qos,
del->_attachment, reliability);
}
return ret;
}
#else
int8_t _z_trigger_push(_z_session_t *zn, _z_n_msg_push_t *push, z_reliability_t reliability) {
_ZP_UNUSED(zn);
_ZP_UNUSED(push);
#endif
return ret;
_ZP_UNUSED(reliability);
return _Z_RES_OK;
}
#endif

0 comments on commit 2f6d549

Please sign in to comment.