Skip to content

Commit

Permalink
feat: switch Z_FEATURE_UNSTABLE_API to #ifdef (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Sep 19, 2024
1 parent 98c2283 commit c30a787
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 @@ -1681,7 +1681,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 @@ -1031,7 +1031,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 @@ -1096,7 +1096,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 @@ -1106,7 +1106,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 @@ -1121,7 +1121,7 @@ z_result_t z_put(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 Down Expand Up @@ -1154,7 +1154,7 @@ z_result_t z_delete(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keye
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 @@ -1169,7 +1169,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 @@ -1197,7 +1197,7 @@ z_result_t z_declare_publisher(z_owned_publisher_t *pub, const z_loaned_session_
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 @@ -1240,7 +1240,7 @@ z_result_t z_publisher_put(const z_loaned_publisher_t *pub, z_moved_bytes_t *pay
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 @@ -1289,7 +1289,7 @@ z_result_t z_publisher_delete(const z_loaned_publisher_t *pub, const z_publisher
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 c30a787

Please sign in to comment.