From bb15e3e84b18c3c33b254e7f7b756fe74ff74e86 Mon Sep 17 00:00:00 2001 From: Alexander Bushnev Date: Thu, 12 Sep 2024 15:56:57 +0200 Subject: [PATCH] Revert const for z_id_t --- examples/unix/c11/z_info.c | 2 +- examples/unix/c99/z_info.c | 2 +- examples/windows/z_info.c | 2 +- include/zenoh-pico/api/macros.h | 4 ++-- include/zenoh-pico/api/types.h | 6 +++--- src/api/api.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/unix/c11/z_info.c b/examples/unix/c11/z_info.c index 701789bdb..303a134ef 100644 --- a/examples/unix/c11/z_info.c +++ b/examples/unix/c11/z_info.c @@ -18,7 +18,7 @@ #include #include -void print_zid(z_id_t *id, void *ctx) { +void print_zid(const z_id_t *id, void *ctx) { (void)(ctx); printf(" "); for (int i = 15; i >= 0; i--) { diff --git a/examples/unix/c99/z_info.c b/examples/unix/c99/z_info.c index c5b0c3c2b..4474b1467 100644 --- a/examples/unix/c99/z_info.c +++ b/examples/unix/c99/z_info.c @@ -18,7 +18,7 @@ #include #include -void print_zid(z_id_t *id, void *ctx) { +void print_zid(const z_id_t *id, void *ctx) { (void)(ctx); printf(" "); for (int i = 15; i >= 0; i--) { diff --git a/examples/windows/z_info.c b/examples/windows/z_info.c index 5c9adc141..2cb405257 100644 --- a/examples/windows/z_info.c +++ b/examples/windows/z_info.c @@ -17,7 +17,7 @@ #include #include -void print_zid(z_id_t *id, void *ctx) { +void print_zid(const z_id_t *id, void *ctx) { (void)(ctx); printf(" "); for (int i = 15; i >= 0; i--) { diff --git a/include/zenoh-pico/api/macros.h b/include/zenoh-pico/api/macros.h index 65f886eb3..541203ad5 100644 --- a/include/zenoh-pico/api/macros.h +++ b/include/zenoh-pico/api/macros.h @@ -511,7 +511,7 @@ inline void z_call(const z_loaned_closure_reply_t &closure, z_loaned_reply_t *re { z_closure_reply_call(&closure, reply); } inline void z_call(const z_loaned_closure_hello_t &closure, z_loaned_hello_t *hello) { z_closure_hello_call(&closure, hello); } -inline void z_call(const z_loaned_closure_zid_t &closure, z_id_t *zid) +inline void z_call(const z_loaned_closure_zid_t &closure, const z_id_t *zid) { z_closure_zid_call(&closure, zid); } inline void z_closure( @@ -552,7 +552,7 @@ inline void z_closure( }; inline void z_closure( z_owned_closure_zid_t* closure, - void (*call)(z_id_t*, void*), + void (*call)(const z_id_t*, void*), void (*drop)(void*) = NULL, void *context = NULL) { closure->_val.context = context; diff --git a/include/zenoh-pico/api/types.h b/include/zenoh-pico/api/types.h index 252c52152..fed282823 100644 --- a/include/zenoh-pico/api/types.h +++ b/include/zenoh-pico/api/types.h @@ -579,7 +579,7 @@ _Z_OWNED_TYPE_VALUE(_z_closure_hello_t, closure_hello) void z_closure_hello_call(const z_loaned_closure_hello_t *closure, z_loaned_hello_t *hello); -typedef void (*z_id_handler_t)(z_id_t *id, void *arg); +typedef void (*z_id_handler_t)(const z_id_t *id, void *arg); typedef struct { void *context; @@ -593,13 +593,13 @@ typedef struct { * * Members: * void *context: a pointer to an arbitrary state. - * z_id_handler_t call: `void (*z_id_handler_t)(z_id_t *id, void *arg)` is the callback function. + * z_id_handler_t call: `void (*z_id_handler_t)(const z_id_t *id, void *arg)` is the callback function. * z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed. * void *context: a pointer to an arbitrary state. */ _Z_OWNED_TYPE_VALUE(_z_closure_zid_t, closure_zid) -void z_closure_zid_call(const z_loaned_closure_zid_t *closure, z_id_t *id); +void z_closure_zid_call(const z_loaned_closure_zid_t *closure, const z_id_t *id); #ifdef __cplusplus } diff --git a/src/api/api.c b/src/api/api.c index 6faab5736..9f12a9d49 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -736,7 +736,7 @@ void z_closure_hello_call(const z_loaned_closure_hello_t *closure, z_loaned_hell } } -void z_closure_zid_call(const z_loaned_closure_zid_t *closure, z_id_t *id) { +void z_closure_zid_call(const z_loaned_closure_zid_t *closure, const z_id_t *id) { if (closure->call != NULL) { (closure->call)(id, closure->context); }