Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch Z_FEATURE_UNSTABLE_API to #ifdef #659

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/zenoh-pico/api/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,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 @@ -1027,7 +1027,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 @@ -1092,7 +1092,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 @@ -1102,7 +1102,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 @@ -1117,7 +1117,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 @@ -1150,7 +1150,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 @@ -1165,7 +1165,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 @@ -1193,7 +1193,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 @@ -1236,7 +1236,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 @@ -1285,7 +1285,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
Loading