Skip to content

Commit

Permalink
Revert const for z_id_t
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Sep 12, 2024
1 parent 0733d7c commit 55642b1
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/unix/c11/z_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <unistd.h>
#include <zenoh-pico.h>

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--) {
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <unistd.h>
#include <zenoh-pico.h>

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--) {
Expand Down
2 changes: 1 addition & 1 deletion examples/windows/z_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <stdlib.h>
#include <zenoh-pico.h>

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--) {
Expand Down
4 changes: 2 additions & 2 deletions include/zenoh-pico/api/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions include/zenoh-pico/api/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/z_api_alignment_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
const char *value = "Test value";

volatile unsigned int zids = 0;
void zid_handler(z_id_t *id, void *arg) {
void zid_handler(const z_id_t *id, void *arg) {
(void)(arg);
(void)(id);
printf("%s\n", __func__);
Expand Down

0 comments on commit 55642b1

Please sign in to comment.