Skip to content

Commit

Permalink
Replace exit with return in zephyr examples (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc authored Nov 5, 2024
1 parent 35f60d6 commit 0fd9d9e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions examples/zephyr/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int argc, char **argv) {
z_owned_session_t s;
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
return -1;
}
printf("OK\n");

Expand All @@ -92,7 +92,7 @@ int main(int argc, char **argv) {
z_view_keyexpr_from_str_unchecked(&ke, KEYEXPR);
if (z_get(z_loan(s), z_loan(ke), "", z_move(callback), &opts) < 0) {
printf("Unable to send query.\n");
exit(-1);
return -1;
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/zephyr/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int main(int argc, char **argv) {
z_owned_session_t s;
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
return -1;
}
printf("OK\n");

Expand All @@ -62,7 +62,7 @@ int main(int argc, char **argv) {
z_owned_publisher_t pub;
if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL) < 0) {
printf("Unable to declare publisher for key expression!\n");
exit(-1);
return -1;
}
printf("OK\n");

Expand Down
6 changes: 3 additions & 3 deletions examples/zephyr/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ int main(int argc, char **argv) {
z_owned_session_t s;
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
return -1;
}
printf("OK\n");

// Start read and lease tasks for zenoh-pico
if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) {
printf("Unable to start read and lease tasks\n");
z_session_drop(z_session_move(&s));
exit(-1);
return -1;
}

printf("Declaring Subscriber on '%s'...\n", KEYEXPR);
Expand All @@ -68,7 +68,7 @@ int main(int argc, char **argv) {
z_view_keyexpr_from_str(&ke, KEYEXPR);
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(closure), NULL) < 0) {
printf("Unable to declare subscriber.\n");
exit(-1);
return -1;
}

printf("Pulling data every %zu ms... Ring size: %zd\n", INTERVAL, SIZE);
Expand Down
4 changes: 2 additions & 2 deletions examples/zephyr/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main(int argc, char **argv) {
z_owned_session_t s;
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
return -1;
}
printf("OK\n");

Expand All @@ -88,7 +88,7 @@ int main(int argc, char **argv) {
z_view_keyexpr_from_str_unchecked(&ke, KEYEXPR);
if (z_declare_queryable(z_loan(s), &qable, z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to declare queryable.\n");
exit(-1);
return -1;
}
printf("OK\n");
printf("Zenoh setup finished!\n");
Expand Down
4 changes: 2 additions & 2 deletions examples/zephyr/z_sub.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 s;
if (z_open(&s, z_move(config), NULL) < 0) {
printf("Unable to open session!\n");
exit(-1);
return -1;
}
printf("OK\n");

Expand All @@ -71,7 +71,7 @@ int main(int argc, char **argv) {
z_owned_subscriber_t sub;
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to declare subscriber.\n");
exit(-1);
return -1;
}
printf("OK!\n");

Expand Down

0 comments on commit 0fd9d9e

Please sign in to comment.