Skip to content

Commit

Permalink
make z_undeclare_publisher/subscriber/queryable take their argument b…
Browse files Browse the repository at this point in the history
…y reference
  • Loading branch information
DenisBiryukov91 committed Oct 7, 2024
1 parent 61f7061 commit 5b84342
Show file tree
Hide file tree
Showing 56 changed files with 98 additions and 92 deletions.
2 changes: 1 addition & 1 deletion examples/espidf/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void app_main() {
}

printf("Closing Zenoh Session...");
z_undeclare_publisher(z_move(pub));
z_drop(z_move(pub));

z_drop(z_move(s));
printf("OK!\n");
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 @@ -178,7 +178,7 @@ void app_main() {
}
}

z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));
z_drop(z_move(handler));

z_drop(z_move(s));
Expand Down
2 changes: 1 addition & 1 deletion examples/espidf/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void app_main() {
}

printf("Closing Zenoh Session...");
z_undeclare_queryable(z_move(qable));
z_drop(z_move(qable));

z_drop(z_move(s));
printf("OK!\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/espidf/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void app_main() {
}

printf("Closing Zenoh Session...");
z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));

z_drop(z_move(s));
printf("OK!\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void app_main(void) {
}

// Clean-up
z_undeclare_publisher(z_move(pub));
z_drop(z_move(pub));
z_drop(z_move(s));
}
#else
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void app_main(void) {
zp_send_join(z_loan(s), NULL);
}

z_undeclare_publisher(z_move(pub));
z_drop(z_move(pub));

z_drop(z_move(s));
}
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 @@ -87,7 +87,7 @@ void app_main(void) {
}
}

z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));
z_drop(z_move(handler));

z_drop(z_move(s));
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 @@ -96,7 +96,7 @@ void app_main(void) {
z_sleep_s(1);
}

z_undeclare_queryable(z_move(qable));
z_drop(z_move(qable));

z_drop(z_move(s));
}
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void app_main(void) {
z_sleep_s(1);
}

z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));

z_drop(z_move(s));
}
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_sub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void app_main(void) {
zp_send_join(z_loan(s), NULL);
}

z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));

z_drop(z_move(s));
}
Expand Down
2 changes: 1 addition & 1 deletion examples/mbed/z_pub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int main(int argc, char **argv) {
}

printf("Closing Zenoh Session...");
z_undeclare_publisher(z_publisher_move(&pub));
z_publisher_drop(z_publisher_move(&pub));

z_session_drop(z_session_move(&s));
printf("OK!\n");
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 @@ -101,7 +101,7 @@ int main(int argc, char **argv) {
}
}

z_undeclare_subscriber(z_subscriber_move(&sub));
z_subscriber_drop(z_subscriber_move(&sub));
z_ring_handler_sample_drop(z_ring_handler_sample_move(&handler));

z_session_drop(z_session_move(&s));
Expand Down
2 changes: 1 addition & 1 deletion examples/mbed/z_queryable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ int main(int argc, char **argv) {
}

printf("Closing Zenoh Session...");
z_undeclare_queryable(z_queryable_move(&qable));
z_queryable_drop(z_queryable_move(&qable));

z_session_drop(z_session_move(&s));
printf("OK!\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/mbed/z_sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int main(int argc, char **argv) {
}

printf("Closing Zenoh Session...");
z_undeclare_subscriber(z_subscriber_move(&sub));
z_subscriber_drop(z_subscriber_move(&sub));

z_session_drop(z_session_move(&s));
printf("OK!\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ int main(int argc, char **argv) {
z_publisher_put(z_loan(pub), z_move(payload), NULL);
}
// Clean up
z_undeclare_publisher(z_move(pub));
z_drop(z_move(pub));
z_drop(z_move(s));
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pub_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int main(int argc, char **argv) {
z_publisher_put(z_loan(pub), z_move(payload), &options);
}
// Clean up
z_undeclare_publisher(z_move(pub));
z_drop(z_move(pub));
z_drop(z_move(s));
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int main(int argc, char **argv) {
zp_send_keep_alive(z_loan(s), NULL);
zp_send_join(z_loan(s), NULL);
}
z_undeclare_publisher(z_move(pub));
z_drop(z_move(pub));
z_drop(z_move(s));
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int main(int argc, char **argv) {
z_publisher_put(z_loan(pub), z_move(p), NULL);
}
// Clean up
z_undeclare_publisher(z_move(pub));
z_drop(z_move(pub));
z_drop(z_move(s));
z_drop(z_move(payload));
exit(0);
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int main(int argc, char **argv) {
}
}

z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));
z_drop(z_move(handler));

z_drop(z_move(s));
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 @@ -161,7 +161,7 @@ int main(int argc, char **argv) {
sleep(1);
}

z_undeclare_queryable(z_move(qable));
z_drop(z_move(qable));

z_drop(z_move(s));

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 @@ -201,7 +201,7 @@ int main(int argc, char **argv) {
sleep(1);
}

z_undeclare_queryable(z_move(qable));
z_drop(z_move(qable));

z_drop(z_move(s));

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 @@ -126,7 +126,7 @@ int main(int argc, char **argv) {
}

z_drop(z_move(handler));
z_undeclare_queryable(z_move(qable));
z_drop(z_move(qable));

z_drop(z_move(s));

Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int main(int argc, char **argv) {
sleep(1);
}
// Clean up
z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));
z_drop(z_move(s));
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_sub_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ int main(int argc, char **argv) {
sleep(1);
}
// Clean up
z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));
z_drop(z_move(s));
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_sub_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int main(int argc, char **argv) {
z_drop(z_move(sample));
}

z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));
z_drop(z_move(handler));

z_drop(z_move(s));
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_sub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int main(int argc, char **argv) {
zp_send_keep_alive(z_loan(s), NULL);
zp_send_join(z_loan(s), NULL);
}
z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));
z_drop(z_move(s));
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_sub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ int main(int argc, char **argv) {
}

// Clean up
z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));
z_drop(z_move(s));
exit(0);
}
Expand Down
4 changes: 2 additions & 2 deletions examples/unix/c99/z_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ int main(int argc, char** argv) {
z_mutex_unlock(z_mutex_loan_mut(&mutex));
z_free(results);
z_free(data);
z_undeclare_subscriber(z_subscriber_move(&sub));
z_undeclare_publisher(z_publisher_move(&pub));
z_subscriber_drop(z_subscriber_move(&sub));
z_publisher_drop(z_publisher_move(&pub));

z_session_drop(z_session_move(&session));
}
Expand Down
4 changes: 2 additions & 2 deletions examples/unix/c99/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void callback(z_loaned_sample_t* sample, void* context) {

void drop(void* context) {
z_owned_publisher_t* pub = (z_owned_publisher_t*)context;
z_undeclare_publisher(z_publisher_move(pub));
z_publisher_drop(z_publisher_move(pub));
// A note on lifetimes:
// here, `sub` takes ownership of `pub` and will drop it before returning from its own `drop`,
// which makes passing a pointer to the stack safe as long as `sub` is dropped in a scope where `pub` is still
Expand Down Expand Up @@ -73,7 +73,7 @@ int main(int argc, char** argv) {
while (getchar() != 'q') {
}

z_undeclare_subscriber(z_subscriber_move(&sub));
z_subscriber_drop(z_subscriber_move(&sub));

z_session_drop(z_session_move(&session));
}
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ int main(int argc, char **argv) {
z_publisher_put(z_publisher_loan(&pub), z_bytes_move(&payload), NULL);
}
// Clean up
z_undeclare_publisher(z_publisher_move(&pub));
z_publisher_drop(z_publisher_move(&pub));
z_session_drop(z_session_move(&s));
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int main(int argc, char **argv) {
zp_send_join(z_session_loan(&s), NULL);
}

z_undeclare_publisher(z_publisher_move(&pub));
z_publisher_drop(z_publisher_move(&pub));
z_session_drop(z_session_move(&s));
free(buf);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int main(int argc, char **argv) {
}
}

z_undeclare_subscriber(z_subscriber_move(&sub));
z_subscriber_drop(z_subscriber_move(&sub));
z_ring_handler_sample_drop(z_ring_handler_sample_move(&handler));

z_session_drop(z_session_move(&s));
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 @@ -128,7 +128,7 @@ int main(int argc, char **argv) {
sleep(1);
}

z_undeclare_queryable(z_queryable_move(&qable));
z_queryable_drop(z_queryable_move(&qable));

z_session_drop(z_session_move(&s));

Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int main(int argc, char **argv) {
sleep(1);
}

z_undeclare_subscriber(z_subscriber_move(&sub));
z_subscriber_drop(z_subscriber_move(&sub));

z_session_drop(z_session_move(&s));

Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_sub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ int main(int argc, char **argv) {
zp_send_keep_alive(z_session_loan(&s), NULL);
zp_send_join(z_session_loan(&s), NULL);
}
z_undeclare_subscriber(z_subscriber_move(&sub));
z_subscriber_drop(z_subscriber_move(&sub));
z_session_drop(z_session_move(&s));
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/windows/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int main(int argc, char **argv) {
}

// Clean-up
z_undeclare_publisher(z_move(pub));
z_drop(z_move(pub));
zp_stop_read_task(z_loan_mut(s));
zp_stop_lease_task(z_loan_mut(s));
z_drop(z_move(s));
Expand Down
2 changes: 1 addition & 1 deletion examples/windows/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int main(int argc, char **argv) {
zp_send_join(z_loan(s), NULL);
}

z_undeclare_publisher(z_move(pub));
z_drop(z_move(pub));

z_drop(z_move(s));

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

z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));
z_drop(z_move(handler));

z_drop(z_move(s));
Expand Down
2 changes: 1 addition & 1 deletion examples/windows/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int main(int argc, char **argv) {
Sleep(1);
}

z_undeclare_queryable(z_move(qable));
z_drop(z_move(qable));

z_drop(z_move(s));

Expand Down
2 changes: 1 addition & 1 deletion examples/windows/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int main(int argc, char **argv) {
Sleep(1);
}

z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));

z_drop(z_move(s));

Expand Down
2 changes: 1 addition & 1 deletion examples/windows/z_sub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int main(int argc, char **argv) {
zp_send_join(z_loan(s), NULL);
}

z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));

z_drop(z_move(s));

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

printf("Closing Zenoh Session...");
z_undeclare_publisher(z_move(pub));
z_drop(z_move(pub));

z_drop(z_move(s));
printf("OK!\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/zephyr/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int main(int argc, char **argv) {
}
}

z_undeclare_subscriber(z_move(sub));
z_drop(z_move(sub));
z_drop(z_move(handler));

z_drop(z_move(s));
Expand Down
Loading

0 comments on commit 5b84342

Please sign in to comment.