Skip to content

Commit

Permalink
fix: update view_ke_from_str in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Feb 4, 2025
1 parent acf8d41 commit 0d4143c
Show file tree
Hide file tree
Showing 49 changed files with 122 additions and 50 deletions.
2 changes: 1 addition & 1 deletion examples/arduino/z_pull.ino
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void setup() {
z_owned_closure_sample_t closure;
z_ring_channel_sample_new(&closure, &handler, SIZE);
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, KEYEXPR);
z_view_keyexpr_from_str_unchecked(&ke, KEYEXPR);
if (z_declare_subscriber(z_session_loan(&s), &sub, z_view_keyexpr_loan(&ke), z_closure_sample_move(&closure),
NULL) < 0) {
Serial.println("Unable to declare subscriber.");
Expand Down
2 changes: 1 addition & 1 deletion examples/espidf/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void app_main() {
z_ring_channel_sample_new(&closure, &handler, SIZE);
z_owned_subscriber_t sub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, KEYEXPR);
z_view_keyexpr_from_str_unchecked(&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);
Expand Down
4 changes: 2 additions & 2 deletions examples/freertos_plus_tcp/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ void app_main(void) {
}

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, KEYEXPR) < 0) {
printf("%s is not a valid key expression", KEYEXPR);
if (z_view_keyexpr_from_str_unchecked(&ke, KEYEXPR) < 0) {
printf("%s is not a valid key expression\n", KEYEXPR);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void app_main(void) {
z_ring_channel_sample_new(&closure, &handler, SIZE);
z_owned_subscriber_t sub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, KEYEXPR);
z_view_keyexpr_from_str_unchecked(&ke, KEYEXPR);
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(closure), NULL) < 0) {
printf("Unable to declare subscriber.\n");
return;
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void app_main(void) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, KEYEXPR) < 0) {
printf("%s is not a valid key expression", KEYEXPR);
printf("%s is not a valid key expression\n", KEYEXPR);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/mbed/z_pull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int main(int argc, char **argv) {
z_ring_channel_sample_new(&closure, &handler, SIZE);
z_owned_subscriber_t sub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, KEYEXPR);
z_view_keyexpr_from_str_unchecked(&ke, KEYEXPR);
if (z_declare_subscriber(z_session_loan(&s), &sub, z_view_keyexpr_loan(&ke), z_closure_sample_move(&closure),
NULL) < 0) {
printf("Unable to declare subscriber.\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/rpi_pico/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void app_main(void) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, KEYEXPR) < 0) {
printf("%s is not a valid key expression", KEYEXPR);
printf("%s is not a valid key expression\n", KEYEXPR);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/rpi_pico/z_pub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void app_main(void) {
// Declare publisher
z_owned_publisher_t pub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, KEYEXPR);
z_view_keyexpr_from_str_unchecked(&ke, KEYEXPR);
if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL) < 0) {
printf("Unable to declare publisher for key expression!\n");
return;
Expand Down
2 changes: 1 addition & 1 deletion examples/rpi_pico/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void app_main(void) {
z_ring_channel_sample_new(&closure, &handler, SIZE);
z_owned_subscriber_t sub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, KEYEXPR);
z_view_keyexpr_from_str_unchecked(&ke, KEYEXPR);
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(closure), NULL) < 0) {
printf("Unable to declare subscriber.\n");
return;
Expand Down
2 changes: 1 addition & 1 deletion examples/rpi_pico/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void app_main(void) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, KEYEXPR) < 0) {
printf("%s is not a valid key expression", KEYEXPR);
printf("%s is not a valid key expression\n", KEYEXPR);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/rpi_pico/z_sub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void app_main(void) {
z_owned_closure_sample_t callback;
z_closure(&callback, on_sample, drop_stats, (void *)context);
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, KEYEXPR);
z_view_keyexpr_from_str_unchecked(&ke, KEYEXPR);
if (z_declare_background_subscriber(z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to declare subscriber.\n");
return;
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ int main(int argc, char **argv) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression", keyexpr);
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_get_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ int main(int argc, char **argv) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression", keyexpr);
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_get_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int main(int argc, char **argv) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression", keyexpr);
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_get_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int main(int argc, char **argv) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression", keyexpr);
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int main(int argc, char **argv) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression", keyexpr);
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}

Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ int main(int argc, char **argv) {
printf("Declaring publisher for '%s'...\n", keyexpr);
z_owned_publisher_t pub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL) < 0) {
printf("Unable to declare publisher for key expression!\n");
return -1;
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_pub_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ int main(int argc, char **argv) {
// Declare publisher
printf("Declaring publisher for '%s'...\n", keyexpr);
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
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");
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ int main(int argc, char **argv) {
printf("Declaring publisher for '%s'...\n", keyexpr);
z_owned_publisher_t pub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL) < 0) {
printf("Unable to declare publisher for key expression!\n");
return -1;
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_pub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ int main(int argc, char **argv) {
// Declare publisher
z_owned_publisher_t pub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL) < 0) {
printf("Unable to declare publisher for key expression!\n");
exit(-1);
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ int main(int argc, char **argv) {
z_ring_channel_sample_new(&closure, &handler, size);
z_owned_subscriber_t sub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(closure), NULL) < 0) {
printf("Unable to declare subscriber.\n");
return -1;
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ int main(int argc, char **argv) {

printf("Declaring key expression '%s'...\n", keyexpr);
z_view_keyexpr_t vke;
z_view_keyexpr_from_str(&vke, keyexpr);
if (z_view_keyexpr_from_str(&vke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
z_owned_keyexpr_t ke;
if (z_declare_keyexpr(z_loan(s), &ke, z_loan(vke)) < 0) {
z_drop(z_move(s));
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_querier.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int main(int argc, char **argv) {

z_view_keyexpr_t keyexpr;
if (z_view_keyexpr_from_substr(&keyexpr, ke, ke_len) < 0) {
printf("%.*s is not a valid key expression", (int)ke_len, ke);
printf("%.*s is not a valid key expression\n", (int)ke_len, ke);
exit(-1);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ int main(int argc, char **argv) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression", keyexpr);
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_queryable_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ int main(int argc, char **argv) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression", keyexpr);
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_queryable_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int main(int argc, char **argv) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression", keyexpr);
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}

Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ int main(int argc, char **argv) {
printf("Declaring Subscriber on '%s'...\n", keyexpr);
z_owned_subscriber_t sub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to declare subscriber.\n");
return -1;
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_sub_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ int main(int argc, char **argv) {
printf("Declaring Subscriber on '%s'...\n", keyexpr);
z_owned_subscriber_t sub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to declare subscriber.\n");
return -1;
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_sub_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ int main(int argc, char **argv) {

z_owned_subscriber_t sub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(closure), NULL) < 0) {
printf("Unable to declare subscriber.\n");
return -1;
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_sub_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ int main(int argc, char **argv) {
sub_opt.history = history;

z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_liveliness_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), &sub_opt) < 0) {
printf("Unable to declare liveliness subscriber.\n");
exit(-1);
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_sub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ int main(int argc, char **argv) {
printf("Declaring Subscriber on '%s'...\n", keyexpr);
z_owned_subscriber_t sub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to declare subscriber.\n");
return -1;
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c11/z_sub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ int main(int argc, char **argv) {
z_owned_closure_sample_t callback;
z_closure(&callback, on_sample, drop_stats, (void *)context);
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_background_subscriber(z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to create subscriber.\n");
exit(-1);
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int main(int argc, char **argv) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression", keyexpr);
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}

Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c99/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ int main(int argc, char **argv) {
printf("Declaring publisher for '%s'...\n", keyexpr);
z_owned_publisher_t pub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_publisher(z_session_loan(&s), &pub, z_view_keyexpr_loan(&ke), NULL) < 0) {
printf("Unable to declare publisher for key expression!\n");
return -1;
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c99/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ int main(int argc, char **argv) {
printf("Declaring publisher for '%s'...\n", keyexpr);
z_owned_publisher_t pub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_publisher(z_session_loan(&s), &pub, z_view_keyexpr_loan(&ke), NULL) < 0) {
printf("Unable to declare publisher for key expression!\n");
return -1;
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c99/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ int main(int argc, char **argv) {
z_ring_channel_sample_new(&closure, &handler, size);
z_owned_subscriber_t sub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
if (z_declare_subscriber(z_session_loan(&s), &sub, z_view_keyexpr_loan(&ke), z_closure_sample_move(&closure),
NULL) < 0) {
printf("Unable to declare subscriber.\n");
Expand Down
5 changes: 4 additions & 1 deletion examples/unix/c99/z_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ int main(int argc, char **argv) {

printf("Declaring key expression '%s'...\n", keyexpr);
z_view_keyexpr_t vke;
z_view_keyexpr_from_str(&vke, keyexpr);
if (z_view_keyexpr_from_str(&vke, keyexpr) < 0) {
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}
z_owned_keyexpr_t ke;
if (z_declare_keyexpr(z_session_loan(&s), &ke, z_view_keyexpr_loan(&vke)) < 0) {
printf("Unable to declare key expression!\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int main(int argc, char **argv) {

z_view_keyexpr_t ke;
if (z_view_keyexpr_from_str(&ke, keyexpr) < 0) {
printf("%s is not a valid key expression", keyexpr);
printf("%s is not a valid key expression\n", keyexpr);
return -1;
}

Expand Down
Loading

0 comments on commit 0d4143c

Please sign in to comment.