Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove const from closure params #653

Merged
merged 4 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/arduino/z_get.ino
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void reply_dropper(void *ctx) {
Serial.println(" >> Received query final notification");
}

void reply_handler(const z_loaned_reply_t *oreply, void *ctx) {
void reply_handler(z_loaned_reply_t *oreply, void *ctx) {
(void)(ctx);
if (z_reply_is_ok(oreply)) {
const z_loaned_sample_t *sample = z_reply_ok(oreply);
Expand Down
2 changes: 1 addition & 1 deletion examples/arduino/z_queryable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
z_owned_session_t s;
z_owned_queryable_t qable;

void query_handler(const z_loaned_query_t *query, void *arg) {
void query_handler(z_loaned_query_t *query, void *arg) {
z_view_string_t keystr;
z_keyexpr_as_view_string(z_query_keyexpr(query), &keystr);
Serial.print(" >> [Queryable handler] Received Query '");
Expand Down
2 changes: 1 addition & 1 deletion examples/arduino/z_scout.ino
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void fprinthello(const z_loaned_hello_t *hello) {
Serial.println(" }");
}

void callback(const z_loaned_hello_t *hello, void *context) {
void callback(z_loaned_hello_t *hello, void *context) {
fprinthello(hello);
Serial.println("");
(*(int *)context)++;
Expand Down
2 changes: 1 addition & 1 deletion examples/arduino/z_sub.ino
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
z_owned_session_t s;
z_owned_subscriber_t sub;

void data_handler(const z_loaned_sample_t *sample, void *arg) {
void data_handler(z_loaned_sample_t *sample, void *arg) {
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
z_owned_string_t value;
Expand Down
2 changes: 1 addition & 1 deletion examples/espidf/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void wifi_init_sta(void) {

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

void reply_handler(const z_loaned_reply_t *oreply, void *ctx) {
void reply_handler(z_loaned_reply_t *oreply, void *ctx) {
if (z_reply_is_ok(oreply)) {
const z_loaned_sample_t *sample = z_reply_ok(oreply);
z_view_string_t keystr;
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 @@ -101,7 +101,7 @@ void wifi_init_sta(void) {
vEventGroupDelete(s_event_group_handler);
}

void query_handler(const z_loaned_query_t *query, void *ctx) {
void query_handler(z_loaned_query_t *query, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_query_keyexpr(query), &keystr);
Expand Down
2 changes: 1 addition & 1 deletion examples/espidf/z_scout.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void fprinthello(FILE *stream, const z_loaned_hello_t *hello) {
fprintf(stream, " }");
}

void callback(const z_loaned_hello_t *hello, void *context) {
void callback(z_loaned_hello_t *hello, void *context) {
fprinthello(stdout, hello);
fprintf(stdout, "\n");
(*(int *)context)++;
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 @@ -100,7 +100,7 @@ void wifi_init_sta(void) {
vEventGroupDelete(s_event_group_handler);
}

void data_handler(const z_loaned_sample_t* sample, void* arg) {
void data_handler(z_loaned_sample_t* sample, void* arg) {
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
z_owned_string_t value;
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void reply_dropper(void *ctx) {
printf(">> Received query final notification\n");
}

void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
void reply_handler(z_loaned_reply_t *reply, void *ctx) {
(void)(ctx);
if (z_reply_is_ok(reply)) {
const z_loaned_sample_t *sample = z_reply_ok(reply);
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 @@ -29,7 +29,7 @@
#define KEYEXPR "demo/example/zenoh-pico-queryable"
#define VALUE "[FreeRTOS-Plus-TCP] Queryable from Zenoh-Pico!"

void query_handler(const z_loaned_query_t *query, void *ctx) {
void query_handler(z_loaned_query_t *query, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_query_keyexpr(query), &keystr);
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos_plus_tcp/z_scout.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void fprinthello(FILE *stream, const z_loaned_hello_t *hello) {
fprintf(stream, " }");
}

void callback(const z_loaned_hello_t *hello, void *context) {
void callback(z_loaned_hello_t *hello, void *context) {
fprinthello(stdout, hello);
fprintf(stdout, "\n");
(*(int *)context)++;
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 @@ -28,7 +28,7 @@

#define KEYEXPR "demo/example/**"

void data_handler(const z_loaned_sample_t *sample, void *ctx) {
void data_handler(z_loaned_sample_t *sample, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
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 @@ -31,7 +31,7 @@

int msg_nb = 0;

void data_handler(const z_loaned_sample_t *sample, void *ctx) {
void data_handler(z_loaned_sample_t *sample, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
Expand Down
2 changes: 1 addition & 1 deletion examples/mbed/z_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

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

void reply_handler(const z_loaned_reply_t *oreply, void *ctx) {
void reply_handler(z_loaned_reply_t *oreply, void *ctx) {
if (z_reply_is_ok(oreply)) {
const z_loaned_sample_t *sample = z_reply_ok(oreply);
z_view_string_t keystr;
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 @@ -31,7 +31,7 @@
#define KEYEXPR "demo/example/zenoh-pico-queryable"
#define VALUE "[MBedOS]{nucleo-F767ZI} Queryable from Zenoh-Pico!"

void query_handler(const z_loaned_query_t *query, void *ctx) {
void query_handler(z_loaned_query_t *query, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_query_keyexpr(query), &keystr);
Expand Down
2 changes: 1 addition & 1 deletion examples/mbed/z_scout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void fprinthello(FILE *stream, const z_loaned_hello_t *hello) {
fprintf(stream, " }");
}

void callback(const z_loaned_hello_t *hello, void *context) {
void callback(z_loaned_hello_t *hello, void *context) {
fprinthello(stdout, hello);
fprintf(stdout, "\n");
(*(int *)context)++;
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 @@ -30,7 +30,7 @@

#define KEYEXPR "demo/example/**"

void data_handler(const z_loaned_sample_t *sample, void *arg) {
void data_handler(z_loaned_sample_t *sample, void *arg) {
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
z_owned_string_t value;
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void reply_dropper(void *ctx) {
z_drop(z_move(cond));
}

void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
void reply_handler(z_loaned_reply_t *reply, void *ctx) {
(void)(ctx);
if (z_reply_is_ok(reply)) {
const z_loaned_sample_t *sample = z_reply_ok(reply);
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_get_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void reply_dropper(void *ctx) {
z_drop(z_move(cond));
}

void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
void reply_handler(z_loaned_reply_t *reply, void *ctx) {
(void)(ctx);
if (z_reply_is_ok(reply)) {
const z_loaned_sample_t *sample = z_reply_ok(reply);
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
static z_owned_condvar_t cond;
static z_owned_mutex_t mutex;

void callback(const z_loaned_sample_t* sample, void* context) {
void callback(z_loaned_sample_t* sample, void* context) {
(void)sample;
(void)context;
z_condvar_signal(z_loan_mut(cond));
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "zenoh-pico.h"

#if Z_FEATURE_SUBSCRIPTION == 1 && Z_FEATURE_PUBLICATION == 1
void callback(const z_loaned_sample_t* sample, void* context) {
void callback(z_loaned_sample_t* sample, void* context) {
const z_loaned_publisher_t* pub = z_loan(*(z_owned_publisher_t*)context);
z_owned_bytes_t payload;
z_bytes_clone(&payload, z_sample_payload(sample));
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 @@ -26,7 +26,7 @@ static int msg_nb = 0;
static enum { REPLY_DATA, REPLY_DELETE, REPLY_ERR } reply_kind = REPLY_DATA;
bool reply_err = false;

void query_handler(const z_loaned_query_t *query, void *ctx) {
void query_handler(z_loaned_query_t *query, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_query_keyexpr(query), &keystr);
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 @@ -104,7 +104,7 @@ void drop_attachment(kv_pairs_rx_t *kvp) {
z_free(kvp->data);
}

void query_handler(const z_loaned_query_t *query, void *ctx) {
void query_handler(z_loaned_query_t *query, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_query_keyexpr(query), &keystr);
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_scout.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void fprinthello(FILE *stream, const z_loaned_hello_t *hello) {
fprintf(stream, " }");
}

void callback(const z_loaned_hello_t *hello, void *context) {
void callback(z_loaned_hello_t *hello, void *context) {
fprinthello(stdout, hello);
fprintf(stdout, "\n");
(*(int *)context)++;
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 @@ -24,7 +24,7 @@

static int msg_nb = 0;

void data_handler(const z_loaned_sample_t *sample, void *ctx) {
void data_handler(z_loaned_sample_t *sample, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
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 @@ -70,7 +70,7 @@ void drop_attachment(kv_pairs_t *kvp) {
z_free(kvp->data);
}

void data_handler(const z_loaned_sample_t *sample, void *ctx) {
void data_handler(z_loaned_sample_t *sample, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
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 @@ -23,7 +23,7 @@

static int msg_nb = 0;

void data_handler(const z_loaned_sample_t *sample, void *ctx) {
void data_handler(z_loaned_sample_t *sample, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
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 @@ -39,7 +39,7 @@ z_stats_t *z_stats_make(void) {
return stats;
}

void on_sample(const z_loaned_sample_t *sample, void *context) {
void on_sample(z_loaned_sample_t *sample, void *context) {
(void)sample;
z_stats_t *stats = (z_stats_t *)context;
stats->count++;
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void reply_dropper(void *ctx) {
z_condvar_drop(z_condvar_move(&cond));
}

void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
void reply_handler(z_loaned_reply_t *reply, void *ctx) {
(void)(ctx);
if (z_reply_is_ok(reply)) {
const z_loaned_sample_t *sample = z_reply_ok(reply);
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
static z_owned_condvar_t cond;
static z_owned_mutex_t mutex;

void callback(const z_loaned_sample_t* sample, void* context) {
void callback(z_loaned_sample_t* sample, void* context) {
(void)sample;
(void)context;
z_condvar_signal(z_condvar_loan_mut(&cond));
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "zenoh-pico/api/primitives.h"

#if Z_FEATURE_SUBSCRIPTION == 1 && Z_FEATURE_PUBLICATION == 1
void callback(const z_loaned_sample_t* sample, void* context) {
void callback(z_loaned_sample_t* sample, void* context) {
const z_loaned_publisher_t* pub = z_publisher_loan((z_owned_publisher_t*)context);
z_owned_bytes_t payload;
z_bytes_clone(&payload, z_sample_payload(sample));
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 @@ -22,7 +22,7 @@
const char *keyexpr = "demo/example/zenoh-pico-queryable";
const char *value = "Queryable from Pico!";

void query_handler(const z_loaned_query_t *query, void *ctx) {
void query_handler(z_loaned_query_t *query, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_query_keyexpr(query), &keystr);
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c99/z_scout.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void fprinthello(FILE *stream, const z_loaned_hello_t *hello) {
fprintf(stream, " }");
}

void callback(const z_loaned_hello_t *hello, void *context) {
void callback(z_loaned_hello_t *hello, void *context) {
fprinthello(stdout, hello);
fprintf(stdout, "\n");
(*(int *)context)++;
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 @@ -20,7 +20,7 @@
#include <zenoh-pico.h>

#if Z_FEATURE_SUBSCRIPTION == 1
void data_handler(const z_loaned_sample_t *sample, void *arg) {
void data_handler(z_loaned_sample_t *sample, void *arg) {
(void)(arg);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
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 @@ -23,7 +23,7 @@

static int msg_nb = 0;

void data_handler(const z_loaned_sample_t *sample, void *arg) {
void data_handler(z_loaned_sample_t *sample, void *arg) {
(void)(arg);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
Expand Down
2 changes: 1 addition & 1 deletion examples/windows/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void reply_dropper(void *ctx) {
z_drop(z_move(cond));
}

void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
void reply_handler(z_loaned_reply_t *reply, void *ctx) {
(void)(ctx);
if (z_reply_is_ok(reply)) {
const z_loaned_sample_t *sample = z_reply_ok(reply);
Expand Down
2 changes: 1 addition & 1 deletion examples/windows/z_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
static z_owned_condvar_t cond;
static z_owned_mutex_t mutex;

void callback(const z_loaned_sample_t* sample, void* context) {
void callback(z_loaned_sample_t* sample, void* context) {
(void)sample;
(void)context;
z_condvar_signal(z_loan_mut(cond));
Expand Down
2 changes: 1 addition & 1 deletion examples/windows/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "zenoh-pico.h"

#if Z_FEATURE_SUBSCRIPTION == 1 && Z_FEATURE_PUBLICATION == 1
void callback(const z_loaned_sample_t* sample, void* context) {
void callback(z_loaned_sample_t* sample, void* context) {
const z_loaned_publisher_t* pub = z_loan(*(z_owned_publisher_t*)context);
z_owned_bytes_t payload;
z_bytes_clone(&payload, z_sample_payload(sample));
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 @@ -21,7 +21,7 @@
const char *keyexpr = "demo/example/zenoh-pico-queryable";
const char *value = "Queryable from Pico!";

void query_handler(const z_loaned_query_t *query, void *ctx) {
void query_handler(z_loaned_query_t *query, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_query_keyexpr(query), &keystr);
Expand Down
2 changes: 1 addition & 1 deletion examples/windows/z_scout.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void fprinthello(FILE *stream, const z_loaned_hello_t *hello) {
fprintf(stream, " }");
}

void callback(const z_loaned_hello_t *hello, void *context) {
void callback(z_loaned_hello_t *hello, void *context) {
fprinthello(stdout, hello);
fprintf(stdout, "\n");
(*(int *)context)++;
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 @@ -19,7 +19,7 @@
#include <zenoh-pico.h>

#if Z_FEATURE_SUBSCRIPTION == 1
void data_handler(const z_loaned_sample_t *sample, void *ctx) {
void data_handler(z_loaned_sample_t *sample, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
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 @@ -22,7 +22,7 @@
int msg_nb = 0;

#if Z_FEATURE_SUBSCRIPTION == 1
void data_handler(const z_loaned_sample_t *sample, void *ctx) {
void data_handler(z_loaned_sample_t *sample, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr);
Expand Down
2 changes: 1 addition & 1 deletion examples/zephyr/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

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

void reply_handler(const z_loaned_reply_t *oreply, void *ctx) {
void reply_handler(z_loaned_reply_t *oreply, void *ctx) {
if (z_reply_is_ok(oreply)) {
const z_loaned_sample_t *sample = z_reply_ok(oreply);
z_view_string_t keystr;
Expand Down
2 changes: 1 addition & 1 deletion examples/zephyr/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define KEYEXPR "demo/example/zenoh-pico-queryable"
#define VALUE "[STSTM32]{nucleo-F767ZI} Queryable from Zenoh-Pico!"

void query_handler(const z_loaned_query_t *query, void *ctx) {
void query_handler(z_loaned_query_t *query, void *ctx) {
(void)(ctx);
z_view_string_t keystr;
z_keyexpr_as_view_string(z_query_keyexpr(query), &keystr);
Expand Down
Loading
Loading