From 8198aa8953d48c3174cccd4b7664aba09c9c378a Mon Sep 17 00:00:00 2001 From: Jean-Roland Date: Fri, 26 Apr 2024 10:47:22 +0200 Subject: [PATCH] fix: compilation error when attachment is off --- include/zenoh-pico/api/primitives.h | 2 ++ src/api/api.c | 2 ++ src/session/subscription.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/include/zenoh-pico/api/primitives.h b/include/zenoh-pico/api/primitives.h index 1431ee9f2..51ee18c2d 100644 --- a/include/zenoh-pico/api/primitives.h +++ b/include/zenoh-pico/api/primitives.h @@ -526,6 +526,7 @@ z_bytes_t z_query_parameters(const z_query_t *query); */ z_value_t z_query_value(const z_query_t *query); +#if Z_FEATURE_ATTACHMENT == 1 /** * Get a query's attachment value by aliasing it. * Note: This API has been marked as unstable: it works as advertised, but we may change it in a future release. @@ -537,6 +538,7 @@ z_value_t z_query_value(const z_query_t *query); * Returns the attachment wrapped as a :c:type:`z_attachment_t`, since attachment is a user-defined representation. */ z_attachment_t z_query_attachment(const z_query_t *query); +#endif /** * Get a query's key by aliasing it. diff --git a/src/api/api.c b/src/api/api.c index d901b2588..fa80589ec 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -298,7 +298,9 @@ z_bytes_t z_query_parameters(const z_query_t *query) { z_value_t z_query_value(const z_query_t *query) { return query->_val._rc.in->val._value; } +#if Z_FEATURE_ATTACHMENT == 1 z_attachment_t z_query_attachment(const z_query_t *query) { return query->_val._rc.in->val.attachment; } +#endif z_keyexpr_t z_query_keyexpr(const z_query_t *query) { return query->_val._rc.in->val._key; } diff --git a/src/session/subscription.c b/src/session/subscription.c index bb7d3fb8a..28670ba29 100644 --- a/src/session/subscription.c +++ b/src/session/subscription.c @@ -192,7 +192,9 @@ int8_t _z_trigger_subscriptions(_z_session_t *zn, const _z_keyexpr_t keyexpr, co sub->in->val._callback(&s, sub->in->val._arg); xs = _z_subscription_rc_list_tail(xs); } +#if Z_FEEATURE_ATTACHMENT == 1 _z_attachment_drop(&s.attachment); +#endif _z_keyexpr_clear(&key); _z_subscription_rc_list_free(&subs); } else {