Skip to content

Commit

Permalink
Merge pull request #75 from DenisBiryukov91/zenoh-c-pico-fix-declare-…
Browse files Browse the repository at this point in the history
…arguments-order

docs: zenoh-c/pico: fix z_declare_subscriber arguments order
  • Loading branch information
DenisBiryukov91 authored Oct 14, 2024
2 parents 77df048 + 89985ce commit 0ff9d33
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions content/docs/migration_1.0/C_Pico.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const char *keyexpr = "example/demo/*";
z_owned_subscriber_t sub;
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, keyexpr);
if (z_declare_subscriber(&sub, z_loan(session), z_loan(ke), z_move(callback), NULL) < 0) {
if (z_declare_subscriber(z_loan(session), &sub, z_loan(ke), z_move(callback), NULL) < 0) {
return -1;
}
```
Expand Down Expand Up @@ -392,15 +392,14 @@ The same now also works for `Subscriber` and `Queryable` :

```c
// callback
// callback
void data_handler(const z_loaned_sample_t *sample, void *context) {
// do something with sample
}

z_owned_closure_sample_t callback;
z_closure(&callback, data_handler, NULL, NULL);
z_owned_subscriber_t sub;
if (z_declare_subscriber(&sub, z_loan(session), z_loan(keyexpr), z_move(callback), NULL) < 0) {
if (z_declare_subscriber(z_loan(session), &sub, z_loan(keyexpr), z_move(callback), NULL) < 0) {
printf("Unable to declare subscriber.\n");
exit(-1);
}
Expand All @@ -410,7 +409,7 @@ z_owned_fifo_handler_sample_t handler;
z_owned_closure_sample_t closure;
z_fifo_channel_reply_new(&closure, &handler, 16);
z_owned_subscriber_t sub;
if (z_declare_subscriber(&sub, z_loan(session), z_loan(keyexpr), z_move(closure), NULL) < 0) {
if (z_declare_subscriber(z_loan(session), &sub, z_loan(keyexpr), z_move(closure), NULL) < 0) {
printf("Unable to declare subscriber.\n");
exit(-1);
}
Expand Down

0 comments on commit 0ff9d33

Please sign in to comment.