Skip to content

Commit

Permalink
Merge pull request #667 from eclipse-zenoh/open_options
Browse files Browse the repository at this point in the history
options for z_open, z_close
  • Loading branch information
milyin authored Sep 12, 2024
2 parents da3936d + 508752f commit bf606f4
Show file tree
Hide file tree
Showing 42 changed files with 161 additions and 111 deletions.
4 changes: 2 additions & 2 deletions examples/z_delete.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand All @@ -43,7 +43,7 @@ int main(int argc, char** argv) {
printf("Delete failed...\n");
}

z_close(z_move(s));
z_close(z_move(s), NULL);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config))) {
if (z_open(&s, z_move(config), NULL)) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -80,7 +80,7 @@ int main(int argc, char** argv) {
}

z_drop(z_move(handler));
z_close(z_move(s));
z_close(z_move(s), NULL);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/z_get_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int argc, char** argv) {

z_owned_session_t s;
printf("Opening session...\n");
if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand All @@ -60,7 +60,7 @@ int main(int argc, char** argv) {

z_drop(z_move(reply));
z_drop(z_move(handler));
z_close(z_move(s));
z_close(z_move(s), NULL);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/z_get_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config))) {
if (z_open(&s, z_move(config), NULL)) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -119,7 +119,7 @@ int main(int argc, char** argv) {
}

z_drop(z_move(handler));
z_close(z_move(s));
z_close(z_move(s), NULL);

z_drop(z_move(shm));
z_drop(z_move(provider));
Expand Down
4 changes: 2 additions & 2 deletions examples/z_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand All @@ -52,7 +52,7 @@ int main(int argc, char** argv) {
z_closure(&callback2, print_zid, NULL, NULL);
z_info_peers_zid(z_loan(s), z_move(callback2));

z_close(z_move(s));
z_close(z_move(s), NULL);
}

void print_help() {
Expand Down
4 changes: 2 additions & 2 deletions examples/z_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config))) {
if (z_open(&s, z_move(config), NULL)) {
printf("Unable to open session!\n");
exit(-1);
}
Expand All @@ -58,7 +58,7 @@ int main(int argc, char** argv) {
printf("Undeclaring liveliness token...\n");
z_drop(z_move(token));

z_close(z_move(s));
z_close(z_move(s), NULL);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/z_non_blocking_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config))) {
if (z_open(&s, z_move(config), NULL)) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -72,7 +72,7 @@ int main(int argc, char** argv) {
}
z_drop(z_move(reply));
z_drop(z_move(handler));
z_close(z_move(s));
z_close(z_move(s), NULL);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/z_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(int argc, char** argv) {
z_mutex_init(&mutex);
z_condvar_init(&cond);
z_owned_session_t session;
z_open(&session, z_move(config));
z_open(&session, z_move(config), NULL);
z_view_keyexpr_t ping;
z_view_keyexpr_from_str_unchecked(&ping, "test/ping");
z_view_keyexpr_t pong;
Expand Down Expand Up @@ -91,7 +91,7 @@ int main(int argc, char** argv) {
z_undeclare_subscriber(z_move(sub));
z_undeclare_publisher(z_move(pub));
z_drop(z_move(mutex));
z_close(z_move(session));
z_close(z_move(session), NULL);
}

void print_help() {
Expand Down
4 changes: 2 additions & 2 deletions examples/z_ping_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int main(int argc, char** argv) {
}

z_owned_session_t session;
z_open(&session, z_move(config));
z_open(&session, z_move(config), NULL);
z_view_keyexpr_t ping;
z_view_keyexpr_from_str_unchecked(&ping, "test/ping");
z_view_keyexpr_t pong;
Expand Down Expand Up @@ -133,7 +133,7 @@ int main(int argc, char** argv) {
z_undeclare_subscriber(z_move(sub));
z_undeclare_publisher(z_move(pub));
z_drop(z_move(mutex));
z_close(z_move(session));
z_close(z_move(session), NULL);

z_drop(z_move(shm));
z_drop(z_move(provider));
Expand Down
4 changes: 2 additions & 2 deletions examples/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main(int argc, char** argv) {
parse_args(argc, argv, &config);

z_owned_session_t session;
z_open(&session, z_move(config));
z_open(&session, z_move(config), NULL);
z_view_keyexpr_t ping;
z_view_keyexpr_from_str_unchecked(&ping, "test/ping");
z_view_keyexpr_t pong;
Expand All @@ -42,7 +42,7 @@ int main(int argc, char** argv) {
z_sleep_s(1);
}
z_undeclare_subscriber(z_move(sub));
z_close(z_move(session));
z_close(z_move(session), NULL);
}

void print_help() {
Expand Down
4 changes: 2 additions & 2 deletions examples/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -92,7 +92,7 @@ int main(int argc, char** argv) {
#endif

z_undeclare_publisher(z_move(pub));
z_close(z_move(s));
z_close(z_move(s), NULL);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/z_pub_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -101,7 +101,7 @@ int main(int argc, char** argv) {

z_undeclare_publisher(z_move(pub));

z_close(z_move(s));
z_close(z_move(s), NULL);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/z_pub_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -72,7 +72,7 @@ int main(int argc, char** argv) {
}

ze_undeclare_publication_cache(z_move(pub_cache));
z_close(z_move(s));
z_close(z_move(s), NULL);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/z_pub_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -114,7 +114,7 @@ int main(int argc, char** argv) {
#endif

z_undeclare_publisher(z_move(pub));
z_close(z_move(s));
z_close(z_move(s), NULL);

z_drop(z_move(provider));
z_drop(z_move(layout));
Expand Down
4 changes: 2 additions & 2 deletions examples/z_pub_shm_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int main(int argc, char **argv) {
}

z_owned_session_t s;
if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -87,7 +87,7 @@ int main(int argc, char **argv) {
}

z_undeclare_publisher(z_move(pub));
z_close(z_move(s));
z_close(z_move(s), NULL);

z_drop(z_move(shm));
z_drop(z_move(provider));
Expand Down
4 changes: 2 additions & 2 deletions examples/z_pub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main(int argc, char** argv) {
memset(value, 1, args.size);

z_owned_session_t s;
if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand All @@ -56,7 +56,7 @@ int main(int argc, char** argv) {
}

z_undeclare_publisher(z_move(pub));
z_close(z_move(s));
z_close(z_move(s), NULL);
}

void print_help() {
Expand Down
4 changes: 2 additions & 2 deletions examples/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int main(int argc, char** argv) {
printf("Opening session...\n");
z_owned_session_t s;

if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -79,7 +79,7 @@ int main(int argc, char** argv) {
}
}
z_undeclare_subscriber(z_move(sub));
z_close(z_move(s));
z_close(z_move(s), NULL);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/z_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -60,7 +60,7 @@ int main(int argc, char** argv) {
printf("Put failed...\n");
}

z_close(z_move(s));
z_close(z_move(s), NULL);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/z_query_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config))) {
if (z_open(&s, z_move(config), NULL)) {
printf("Unable to open session!\n");
exit(-1);
}
Expand All @@ -68,7 +68,7 @@ int main(int argc, char** argv) {
}

ze_undeclare_querying_subscriber(z_move(sub));
z_close(z_move(s));
z_close(z_move(s), NULL);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int main(int argc, char **argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config))) {
if (z_open(&s, z_move(config), NULL)) {
printf("Unable to open session!\n");
exit(-1);
}
Expand All @@ -95,7 +95,7 @@ int main(int argc, char **argv) {
}

z_undeclare_queryable(z_move(qable));
z_close(z_move(s));
z_close(z_move(s), NULL);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/z_queryable_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int main(int argc, char **argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config))) {
if (z_open(&s, z_move(config), NULL)) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -131,7 +131,7 @@ int main(int argc, char **argv) {
}

z_undeclare_queryable(z_move(qable));
z_close(z_move(s));
z_close(z_move(s), NULL);
z_drop(z_move(layout));
z_drop(z_move(provider));
return 0;
Expand Down
4 changes: 2 additions & 2 deletions examples/z_queryable_with_channels.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main(int argc, char** argv) {

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config)) < 0) {
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
}
Expand Down Expand Up @@ -90,7 +90,7 @@ int main(int argc, char** argv) {

z_undeclare_queryable(z_move(qable));
z_drop(z_move(handler));
z_close(z_move(s));
z_close(z_move(s), NULL);
return 0;
}

Expand Down
Loading

0 comments on commit bf606f4

Please sign in to comment.