Skip to content

Commit

Permalink
feat: switch Z_FEATURE_UNSTABLE_API to #ifdef
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Sep 13, 2024
1 parent c5106ac commit 9c7f1c2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion include/zenoh-pico/api/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ z_sample_kind_t z_sample_kind(const z_loaned_sample_t *sample);
* Return:
* The reliability wrapped as a :c:type:`z_reliability_t`.
*/
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
z_reliability_t z_sample_reliability(const z_loaned_sample_t *sample);
#endif

Expand Down
6 changes: 3 additions & 3 deletions include/zenoh-pico/api/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ typedef struct {
z_congestion_control_t congestion_control;
z_priority_t priority;
_Bool is_express;
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
z_reliability_t reliability;
#endif
} z_publisher_options_t;
Expand Down Expand Up @@ -318,7 +318,7 @@ typedef struct {
z_timestamp_t *timestamp;
_Bool is_express;
z_moved_bytes_t *attachment;
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
z_reliability_t reliability;
#endif
} z_put_options_t;
Expand All @@ -338,7 +338,7 @@ typedef struct {
z_priority_t priority;
_Bool is_express;
z_timestamp_t *timestamp;
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
z_reliability_t reliability;
#endif
} z_delete_options_t;
Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define Z_BATCH_MULTICAST_SIZE 2048
#define Z_CONFIG_SOCKET_TIMEOUT 100

#define Z_FEATURE_UNSTABLE_API 0
/* #undef Z_FEATURE_UNSTABLE_API */
#define Z_FEATURE_MULTI_THREAD 1
#define Z_FEATURE_PUBLICATION 1
#define Z_FEATURE_SUBSCRIPTION 1
Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define Z_BATCH_MULTICAST_SIZE @BATCH_MULTICAST_SIZE@
#define Z_CONFIG_SOCKET_TIMEOUT @Z_CONFIG_SOCKET_TIMEOUT@

#define Z_FEATURE_UNSTABLE_API @Z_FEATURE_UNSTABLE_API@
#cmakedefine Z_FEATURE_UNSTABLE_API
#define Z_FEATURE_MULTI_THREAD @Z_FEATURE_MULTI_THREAD@
#define Z_FEATURE_PUBLICATION @Z_FEATURE_PUBLICATION@
#define Z_FEATURE_SUBSCRIPTION @Z_FEATURE_SUBSCRIPTION@
Expand Down
18 changes: 9 additions & 9 deletions src/api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ z_result_t z_id_to_string(const z_id_t *id, z_owned_string_t *str) {

const z_loaned_keyexpr_t *z_sample_keyexpr(const z_loaned_sample_t *sample) { return &sample->keyexpr; }
z_sample_kind_t z_sample_kind(const z_loaned_sample_t *sample) { return sample->kind; }
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
z_reliability_t z_sample_reliability(const z_loaned_sample_t *sample) { return sample->reliability; }
#endif
const z_loaned_bytes_t *z_sample_payload(const z_loaned_sample_t *sample) { return &sample->payload; }
Expand Down Expand Up @@ -1065,7 +1065,7 @@ void z_put_options_default(z_put_options_t *options) {
options->is_express = false;
options->timestamp = NULL;
options->attachment = NULL;
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
options->reliability = Z_RELIABILITY_DEFAULT;
#endif
}
Expand All @@ -1075,7 +1075,7 @@ void z_delete_options_default(z_delete_options_t *options) {
options->is_express = false;
options->timestamp = NULL;
options->priority = Z_PRIORITY_DEFAULT;
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
options->reliability = Z_RELIABILITY_DEFAULT;
#endif
}
Expand All @@ -1090,7 +1090,7 @@ int8_t z_put(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr, z_
opt = *options;
}
z_reliability_t reliability = Z_RELIABILITY_DEFAULT;
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
reliability = opt.reliability;
#endif

Expand Down Expand Up @@ -1122,7 +1122,7 @@ int8_t z_delete(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr,
opt = *options;
}
z_reliability_t reliability = Z_RELIABILITY_DEFAULT;
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
reliability = opt.reliability;
#endif

Expand All @@ -1137,7 +1137,7 @@ void z_publisher_options_default(z_publisher_options_t *options) {
options->congestion_control = Z_CONGESTION_CONTROL_DEFAULT;
options->priority = Z_PRIORITY_DEFAULT;
options->is_express = false;
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
options->reliability = Z_RELIABILITY_DEFAULT;
#endif
}
Expand Down Expand Up @@ -1165,7 +1165,7 @@ int8_t z_declare_publisher(z_owned_publisher_t *pub, const z_loaned_session_t *z
opt = *options;
}
z_reliability_t reliability = Z_RELIABILITY_DEFAULT;
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
reliability = opt.reliability;
#endif

Expand Down Expand Up @@ -1208,7 +1208,7 @@ int8_t z_publisher_put(const z_loaned_publisher_t *pub, z_moved_bytes_t *payload
opt = *options;
}
z_reliability_t reliability = Z_RELIABILITY_DEFAULT;
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
reliability = pub->reliability;
#endif

Expand Down Expand Up @@ -1257,7 +1257,7 @@ int8_t z_publisher_delete(const z_loaned_publisher_t *pub, const z_publisher_del
opt = *options;
}
z_reliability_t reliability = Z_RELIABILITY_DEFAULT;
#if Z_FEATURE_UNSTABLE_API == 1
#ifdef Z_FEATURE_UNSTABLE_API
reliability = pub->reliability;
#endif
// Remove potentially redundant ke suffix
Expand Down

0 comments on commit 9c7f1c2

Please sign in to comment.