Skip to content

Commit 1fcd37f

Browse files
authored
Merge pull request #2 from jean-roland/ft_reply_rc
Switch query callback replies to rc
2 parents eb95230 + 9315dba commit 1fcd37f

File tree

24 files changed

+244
-152
lines changed

24 files changed

+244
-152
lines changed

examples/arduino/z_get.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void reply_dropper(void *ctx) {
4242
Serial.println(" >> Received query final notification");
4343
}
4444

45-
void reply_handler(z_owned_reply_t *oreply, void *ctx) {
45+
void reply_handler(const z_loaned_reply_t *oreply, void *ctx) {
4646
(void)(ctx);
4747
if (z_reply_is_ok(oreply)) {
4848
const z_loaned_sample_t *sample = z_reply_ok(oreply);

examples/espidf/z_get.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void wifi_init_sta(void) {
103103

104104
void reply_dropper(void *ctx) { printf(" >> Received query final notification\n"); }
105105

106-
void reply_handler(z_owned_reply_t *oreply, void *ctx) {
106+
void reply_handler(const z_loaned_reply_t *oreply, void *ctx) {
107107
if (z_reply_is_ok(oreply)) {
108108
const z_loaned_sample_t *sample = z_reply_ok(oreply);
109109
z_owned_str_t keystr;

examples/freertos_plus_tcp/z_get.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void reply_dropper(void *ctx) {
3636
printf(">> Received query final notification\n");
3737
}
3838

39-
void reply_handler(z_owned_reply_t *reply, void *ctx) {
39+
void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
4040
(void)(ctx);
4141
if (z_reply_is_ok(reply)) {
4242
const z_loaned_sample_t *sample = z_reply_ok(reply);

examples/mbed/z_get.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
void reply_dropper(void *ctx) { printf(" >> Received query final notification\n"); }
3535

36-
void reply_handler(z_owned_reply_t *oreply, void *ctx) {
36+
void reply_handler(const z_loaned_reply_t *oreply, void *ctx) {
3737
if (z_reply_is_ok(oreply)) {
3838
const z_loaned_sample_t *sample = z_reply_ok(oreply);
3939
z_owned_str_t keystr;

examples/unix/c11/z_get.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int8_t attachment_handler(z_bytes_t key, z_bytes_t att_value, void *ctx) {
3737
}
3838
#endif
3939

40-
void reply_handler(z_owned_reply_t *reply, void *ctx) {
40+
void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
4141
(void)(ctx);
4242
if (z_reply_is_ok(reply)) {
4343
const z_loaned_sample_t *sample = z_reply_ok(reply);

examples/unix/c11/z_get_channel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ int main(int argc, char **argv) {
103103
z_owned_reply_t reply;
104104
z_null(&reply);
105105
for (z_call(channel.recv, &reply); z_check(reply); z_call(channel.recv, &reply)) {
106-
if (z_reply_is_ok(&reply)) {
107-
const z_loaned_sample_t *sample = z_reply_ok(&reply);
106+
if (z_reply_is_ok(z_loan(reply))) {
107+
const z_loaned_sample_t *sample = z_reply_ok(z_loan(reply));
108108
z_owned_str_t keystr;
109109
z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
110110
printf(">> Received ('%s': '%.*s')\n", z_str_data(z_loan(keystr)), (int)z_sample_payload(sample)->len,

examples/unix/c99/z_get.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void reply_dropper(void *ctx) {
2929
z_condvar_free(&cond);
3030
}
3131

32-
void reply_handler(z_owned_reply_t *reply, void *ctx) {
32+
void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
3333
(void)(ctx);
3434
if (z_reply_is_ok(reply)) {
3535
const z_loaned_sample_t *sample = z_reply_ok(reply);

examples/windows/z_get.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void reply_dropper(void *ctx) {
2828
z_condvar_free(&cond);
2929
}
3030

31-
void reply_handler(z_owned_reply_t *reply, void *ctx) {
31+
void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
3232
(void)(ctx);
3333
if (z_reply_is_ok(reply)) {
3434
const z_loaned_sample_t *sample = z_reply_ok(reply);

examples/zephyr/z_get.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
void reply_dropper(void *ctx) { printf(" >> Received query final notification\n"); }
3535

36-
void reply_handler(z_owned_reply_t *oreply, void *ctx) {
36+
void reply_handler(const z_loaned_reply_t *oreply, void *ctx) {
3737
if (z_reply_is_ok(oreply)) {
3838
const z_loaned_sample_t *sample = z_reply_ok(oreply);
3939
z_owned_str_t keystr;

include/zenoh-pico/api/handlers.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ z_owned_query_t *_z_query_to_owned_ptr(const z_loaned_query_t *src);
3333

3434
// -- Reply handler
3535
void _z_owned_reply_move(z_owned_reply_t *dst, z_owned_reply_t *src);
36-
z_owned_reply_t *_z_reply_clone(const z_owned_reply_t *src);
36+
z_owned_reply_t *_z_reply_to_owned_ptr(const z_loaned_reply_t *src);
3737

3838
// -- Channel
3939
#define _Z_CHANNEL_DEFINE(name, send_closure_name, recv_closure_name, send_type, recv_type, collection_type, \
@@ -112,13 +112,13 @@ _Z_CHANNEL_DEFINE(query_fifo_channel, closure_query, closure_owned_query, const
112112
_z_owned_query_move, _z_query_to_owned_ptr, z_query_drop)
113113

114114
// z_owned_reply_ring_channel_t
115-
_Z_CHANNEL_DEFINE(reply_ring_channel, closure_reply, closure_reply, z_owned_reply_t, z_owned_reply_t, _z_ring_mt_t,
116-
_z_ring_mt_new, _z_ring_mt_free, _z_ring_mt_push, _z_ring_mt_pull, _z_ring_mt_try_pull,
117-
_z_owned_reply_move, _z_reply_clone, z_reply_drop)
115+
_Z_CHANNEL_DEFINE(reply_ring_channel, closure_reply, closure_owned_reply, const z_loaned_reply_t, z_owned_reply_t,
116+
_z_ring_mt_t, _z_ring_mt_new, _z_ring_mt_free, _z_ring_mt_push, _z_ring_mt_pull, _z_ring_mt_try_pull,
117+
_z_owned_reply_move, _z_reply_to_owned_ptr, z_reply_drop)
118118

119119
// z_owned_reply_fifo_channel_t
120-
_Z_CHANNEL_DEFINE(reply_fifo_channel, closure_reply, closure_reply, z_owned_reply_t, z_owned_reply_t, _z_fifo_mt_t,
121-
_z_fifo_mt_new, _z_fifo_mt_free, _z_fifo_mt_push, _z_fifo_mt_pull, _z_fifo_mt_try_pull,
122-
_z_owned_reply_move, _z_reply_clone, z_reply_drop)
120+
_Z_CHANNEL_DEFINE(reply_fifo_channel, closure_reply, closure_owned_reply, const z_loaned_reply_t, z_owned_reply_t,
121+
_z_fifo_mt_t, _z_fifo_mt_new, _z_fifo_mt_free, _z_fifo_mt_push, _z_fifo_mt_pull, _z_fifo_mt_try_pull,
122+
_z_owned_reply_move, _z_reply_to_owned_ptr, z_reply_drop)
123123

124124
#endif // INCLUDE_ZENOH_PICO_API_HANDLERS_H

0 commit comments

Comments
 (0)