Skip to content

Commit

Permalink
Rename z_str_data to z_string_data
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed May 30, 2024
1 parent 0b9017f commit a8c236d
Show file tree
Hide file tree
Showing 42 changed files with 63 additions and 54 deletions.
4 changes: 2 additions & 2 deletions examples/arduino/z_get.ino
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ void reply_handler(const z_loaned_reply_t *oreply, void *ctx) {
z_bytes_decode_into_string(z_sample_payload(sample), &replystr);

Serial.print(" >> [Get listener] Received (");
Serial.print(z_str_data(z_string_loan(&keystr)));
Serial.print(z_string_data(z_string_loan(&keystr)));
Serial.print(", ");
Serial.print(z_str_data(z_string_loan(&replystr)));
Serial.print(z_string_data(z_string_loan(&replystr)));
Serial.println(")");

z_string_drop(z_string_move(&keystr));
Expand Down
2 changes: 1 addition & 1 deletion examples/arduino/z_pull.ino
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
// std::string val((const char *)sample->payload.start, sample->payload.len);

// Serial.print(" >> [Subscription listener] Received (");
// Serial.print(z_str_data(z_string_loan(&keystr)));
// Serial.print(z_string_data(z_string_loan(&keystr)));
// Serial.print(", ");
// Serial.print(val.c_str());
// Serial.println(")");
Expand Down
4 changes: 2 additions & 2 deletions examples/arduino/z_queryable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void query_handler(const z_loaned_query_t *query, void *arg) {
z_owned_string_t keystr;
z_keyexpr_to_string(z_query_keyexpr(query), &keystr);
Serial.print(" >> [Queryable handler] Received Query '");
Serial.print(z_str_data(z_string_loan(&keystr)));
Serial.print(z_string_data(z_string_loan(&keystr)));
Serial.println("'");

// Process value
Expand All @@ -48,7 +48,7 @@ void query_handler(const z_loaned_query_t *query, void *arg) {
z_owned_string_t payload_string;
z_bytes_decode_into_string(payload, &payload_string);
Serial.print(" with value '");
Serial.print(z_str_data(z_string_loan(&payload_string)));
Serial.print(z_string_data(z_string_loan(&payload_string)));
Serial.println("'");
z_string_drop(z_string_move(&payload_string));
}
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 @@ -40,7 +40,7 @@ void data_handler(const z_loaned_sample_t *sample, void *arg) {
std::string val((const char *)z_sample_payload(sample)->start, z_sample_payload(sample)->len);

Serial.print(" >> [Subscription listener] Received (");
Serial.print(z_str_data(z_string_loan(&keystr)));
Serial.print(z_string_data(z_string_loan(&keystr)));
Serial.print(", ");
Serial.print(val.c_str());
Serial.println(")");
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 @@ -111,7 +111,7 @@ void reply_handler(const z_loaned_reply_t *oreply, void *ctx) {
z_owned_string_t replystr;
z_bytes_decode_into_string(z_sample_payload(sample), &replystr);

printf(" >> Received ('%s': '%s')\n", z_str_data(z_loan(keystr)), z_str_data(z_loan(replystr)));
printf(" >> Received ('%s': '%s')\n", z_string_data(z_loan(keystr)), z_string_data(z_loan(replystr)));
z_drop(z_move(keystr));
z_drop(z_move(replystr));
} else {
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 @@ -104,7 +104,7 @@ void wifi_init_sta(void) {
// void data_handler(const z_loaned_sample_t* sample, void* arg) {
// z_owned_string_t keystr;
// z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
// printf(" >> [Subscriber handler] Received ('%s': '%.*s')\n", z_str_data(z_loan(keystr)),
// printf(" >> [Subscriber handler] Received ('%s': '%.*s')\n", z_string_data(z_loan(keystr)),
// (int)sample->payload.len,
// sample->payload.start);
// z_drop(z_move(keystr));
Expand Down
4 changes: 2 additions & 2 deletions examples/espidf/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ void query_handler(const z_loaned_query_t *query, void *ctx) {
z_keyexpr_to_string(z_query_keyexpr(query), &keystr);
z_view_string_t params;
z_query_parameters(query, &params);
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_str_data(z_loan(keystr)), (int)z_loan(params)->len,
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_string_data(z_loan(keystr)), (int)z_loan(params)->len,
z_loan(params)->val);
// Process value
const z_loaned_bytes_t *payload = z_value_payload(z_query_value(query));
if (z_bytes_len(payload) > 0) {
z_owned_string_t payload_string;
z_bytes_decode_into_string(payload, &payload_string);
printf(" with value '%s'\n", z_str_data(z_loan(payload_string)));
printf(" with value '%s'\n", z_string_data(z_loan(payload_string)));
z_drop(z_move(payload_string));
}
z_view_keyexpr_t ke;
Expand Down
4 changes: 2 additions & 2 deletions examples/espidf/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ void data_handler(const z_loaned_sample_t* sample, void* arg) {
z_owned_string_t keystr;
z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
const z_loaned_bytes_t* payload = z_sample_payload(sample);
printf(" >> [Subscriber handler] Received ('%s': '%.*s')\n", z_str_data(z_string_loan(&keystr)), (int)payload->len,
payload->start);
printf(" >> [Subscriber handler] Received ('%s': '%.*s')\n", z_string_data(z_string_loan(&keystr)),
(int)payload->len, payload->start);
z_string_drop(z_string_move(&keystr));
}

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 @@ -45,7 +45,7 @@ void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
z_owned_string_t replystr;
z_bytes_decode_into_string(z_sample_payload(sample), &replystr);

printf(">> Received ('%s': '%s')\n", z_str_data(z_loan(keystr)), z_str_data(z_loan(replystr)));
printf(">> Received ('%s': '%s')\n", z_string_data(z_loan(keystr)), z_string_data(z_loan(replystr)));
z_drop(z_move(keystr));
z_drop(z_move(replystr));
} else {
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 @@ -33,7 +33,7 @@
// (void)(ctx);
// z_owned_string_t keystr;
// z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
// printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_str_data(z_loan(keystr)), (int)sample->payload.len,
// printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_string_data(z_loan(keystr)), (int)sample->payload.len,
// sample->payload.start);
// z_drop(z_move(keystr));
// }
Expand Down
4 changes: 2 additions & 2 deletions examples/freertos_plus_tcp/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ void query_handler(const z_loaned_query_t *query, void *ctx) {
z_keyexpr_to_string(z_query_keyexpr(query), &keystr);
z_view_string_t params;
z_query_parameters(query, &params);
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_str_data(z_loan(keystr)), (int)z_loan(params)->len,
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_string_data(z_loan(keystr)), (int)z_loan(params)->len,
z_loan(params)->val);
// Process value
const z_loaned_bytes_t *payload = z_value_payload(z_query_value(query));
if (z_bytes_len(payload) > 0) {
z_owned_string_t payload_string;
z_bytes_decode_into_string(payload, &payload_string);
printf(" with value '%s'\n", z_str_data(z_loan(payload_string)));
printf(" with value '%s'\n", z_string_data(z_loan(payload_string)));
z_drop(z_move(payload_string));
}
z_query_reply_options_t options;
Expand Down
3 changes: 2 additions & 1 deletion examples/freertos_plus_tcp/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ void data_handler(const z_loaned_sample_t *sample, void *ctx) {
z_owned_string_t keystr;
z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
const z_loaned_bytes_t *payload = z_sample_payload(sample);
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_str_data(z_loan(keystr)), (int)payload->len, payload->start);
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_string_data(z_loan(keystr)), (int)payload->len,
payload->start);
z_drop(z_move(keystr));
}

Expand Down
3 changes: 2 additions & 1 deletion examples/freertos_plus_tcp/z_sub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ void data_handler(const z_loaned_sample_t *sample, void *ctx) {
z_owned_string_t keystr;
z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
const z_loaned_bytes_t *payload = z_sample_payload(sample);
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_str_data(z_loan(keystr)), (int)payload->len, payload->start);
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_string_data(z_loan(keystr)), (int)payload->len,
payload->start);
z_drop(z_move(keystr));
z_drop(z_move(keystr));
msg_nb++;
Expand Down
3 changes: 2 additions & 1 deletion examples/mbed/z_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ void reply_handler(const z_loaned_reply_t *oreply, void *ctx) {
z_owned_string_t replystr;
z_bytes_decode_into_string(z_sample_payload(sample), &replystr);

printf(" >> Received ('%s': '%s')\n", z_str_data(z_string_loan(&keystr)), z_str_data(z_string_loan(&replystr)));
printf(" >> Received ('%s': '%s')\n", z_string_data(z_string_loan(&keystr)),
z_string_data(z_string_loan(&replystr)));
z_string_drop(z_string_move(&keystr));
z_string_drop(z_string_move(&replystr));
} else {
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 @@ -34,7 +34,7 @@
// void data_handler(const z_loaned_sample_t *sample, void *arg) {
// z_owned_string_t keystr;
// z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
// printf(" >> [Subscriber handler] Received ('%s': '%.*s')\n", z_str_data(z_string_loan(&keystr)),
// printf(" >> [Subscriber handler] Received ('%s': '%.*s')\n", z_string_data(z_string_loan(&keystr)),
// (int)sample->payload.len,
// sample->payload.start);
// z_string_drop(z_string_move(&keystr));
Expand Down
4 changes: 2 additions & 2 deletions examples/mbed/z_queryable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ void query_handler(const z_loaned_query_t *query, void *ctx) {
z_keyexpr_to_string(z_query_keyexpr(query), &keystr);
z_view_string_t pred;
z_query_parameters(query, &pred);
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_str_data(z_string_loan(&keystr)),
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_string_data(z_string_loan(&keystr)),
(int)z_view_string_loan(&pred)->len, z_view_string_loan(&pred)->val);
// Process value
const z_loaned_bytes_t *payload = z_value_payload(z_query_value(query));
if (z_bytes_len(payload) > 0) {
z_owned_string_t payload_string;
z_bytes_decode_into_string(payload, &payload_string);
printf(" with value '%s'\n", z_str_data(z_string_loan(&payload_string)));
printf(" with value '%s'\n", z_string_data(z_string_loan(&payload_string)));
z_string_drop(z_string_move(&payload_string));
}
// Reply value encoding
Expand Down
4 changes: 2 additions & 2 deletions examples/mbed/z_sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ void data_handler(const z_loaned_sample_t *sample, void *arg) {
z_owned_string_t keystr;
z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
const z_loaned_bytes_t *payload = z_sample_payload(sample);
printf(" >> [Subscriber handler] Received ('%s': '%.*s')\n", z_str_data(z_string_loan(&keystr)), (int)payload->len,
payload->start);
printf(" >> [Subscriber handler] Received ('%s': '%.*s')\n", z_string_data(z_string_loan(&keystr)),
(int)payload->len, payload->start);
z_string_drop(z_string_move(&keystr));
}

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 @@ -46,7 +46,7 @@ void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
z_owned_string_t replystr;
z_bytes_decode_into_string(z_sample_payload(sample), &replystr);

printf(">> Received ('%s': '%s')\n", z_str_data(z_loan(keystr)), z_str_data(z_loan(replystr)));
printf(">> Received ('%s': '%s')\n", z_string_data(z_loan(keystr)), z_string_data(z_loan(replystr)));
#if Z_FEATURE_ATTACHMENT == 1
if (z_attachment_check(&sample.attachment)) {
printf("Attachement found\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/unix/c11/z_get_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ int main(int argc, char **argv) {
z_owned_string_t replystr;
z_bytes_decode_into_string(z_sample_payload(sample), &replystr);

printf(">> Received ('%s': '%s')\n", z_str_data(z_loan(keystr)), z_str_data(z_loan(replystr)));
printf(">> Received ('%s': '%s')\n", z_string_data(z_loan(keystr)), z_string_data(z_loan(replystr)));
z_drop(z_move(keystr));
z_drop(z_move(replystr));
} else {
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 @@ -90,7 +90,7 @@ int main(int argc, char **argv) {
for (z_call(channel.try_recv, &sample); z_check(sample); z_call(channel.try_recv, &sample)) {
z_owned_string_t keystr;
z_keyexpr_to_string(z_sample_keyexpr(z_loan(sample)), &keystr);
printf(">> [Subscriber] Pulled ('%s': '%.*s')\n", z_str_data(z_loan(keystr)),
printf(">> [Subscriber] Pulled ('%s': '%.*s')\n", z_string_data(z_loan(keystr)),
(int)z_sample_payload(z_loan(sample))->len, z_sample_payload(z_loan(sample))->start);
z_drop(z_move(keystr));
z_drop(z_move(sample));
Expand Down
4 changes: 2 additions & 2 deletions examples/unix/c11/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ void query_handler(const z_loaned_query_t *query, void *ctx) {
z_keyexpr_to_string(z_query_keyexpr(query), &keystr);
z_view_string_t params;
z_query_parameters(query, &params);
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_str_data(z_loan(keystr)), (int)z_loan(params)->len,
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_string_data(z_loan(keystr)), (int)z_loan(params)->len,
z_loan(params)->val);
// Process value
const z_loaned_bytes_t *payload = z_value_payload(z_query_value(query));
if (z_bytes_len(payload) > 0) {
z_owned_string_t payload_string;
z_bytes_decode_into_string(payload, &payload_string);
printf(" with value '%s'\n", z_str_data(z_loan(payload_string)));
printf(" with value '%s'\n", z_string_data(z_loan(payload_string)));
z_drop(z_move(payload_string));
}
#if Z_FEATURE_ATTACHMENT == 1
Expand Down
4 changes: 2 additions & 2 deletions examples/unix/c11/z_queryable_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ int main(int argc, char **argv) {
z_keyexpr_to_string(z_query_keyexpr(q), &keystr);
z_view_string_t params;
z_query_parameters(q, &params);
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_str_data(z_loan(keystr)),
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_string_data(z_loan(keystr)),
(int)z_loan(params)->len, z_loan(params)->val);
const z_loaned_bytes_t *payload = z_value_payload(z_query_value(z_loan(query)));
if (z_bytes_len(payload) > 0) {
z_owned_string_t payload_string;
z_bytes_decode_into_string(payload, &payload_string);
printf(" with value '%s'\n", z_str_data(z_loan(payload_string)));
printf(" with value '%s'\n", z_string_data(z_loan(payload_string)));
z_drop(z_move(payload_string));
}
z_query_reply_options_t options;
Expand Down
3 changes: 2 additions & 1 deletion examples/unix/c11/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ void data_handler(const z_loaned_sample_t *sample, void *ctx) {
z_owned_string_t keystr;
z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
const z_loaned_bytes_t *payload = z_sample_payload(sample);
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_str_data(z_loan(keystr)), (int)payload->len, payload->start);
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_string_data(z_loan(keystr)), (int)payload->len,
payload->start);
#if Z_FEATURE_ATTACHMENT == 1
z_attachment_t attachment = z_sample_attachment(sample);
if (z_attachment_check(&attachment)) {
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 @@ -80,7 +80,7 @@ int main(int argc, char **argv) {
for (z_call(channel.recv, &sample); z_check(sample); z_call(channel.recv, &sample)) {
z_owned_string_t keystr;
z_keyexpr_to_string(z_sample_keyexpr(z_loan(sample)), &keystr);
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_str_data(z_loan(keystr)),
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_string_data(z_loan(keystr)),
(int)z_sample_payload(z_loan(sample))->len, z_sample_payload(z_loan(sample))->start);
z_drop(z_move(keystr));
z_drop(z_move(sample));
Expand Down
3 changes: 2 additions & 1 deletion examples/unix/c11/z_sub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ void data_handler(const z_loaned_sample_t *sample, void *ctx) {
z_owned_string_t keystr;
z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
const z_loaned_bytes_t *payload = z_sample_payload(sample);
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_str_data(z_loan(keystr)), (int)payload->len, payload->start);
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_string_data(z_loan(keystr)), (int)payload->len,
payload->start);
z_drop(z_move(keystr));
msg_nb++;
}
Expand Down
3 changes: 2 additions & 1 deletion examples/unix/c99/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
z_owned_string_t replystr;
z_bytes_decode_into_string(z_sample_payload(sample), &replystr);

printf(">> Received ('%s': '%s')\n", z_str_data(z_string_loan(&keystr)), z_str_data(z_string_loan(&replystr)));
printf(">> Received ('%s': '%s')\n", z_string_data(z_string_loan(&keystr)),
z_string_data(z_string_loan(&replystr)));
z_string_drop(z_string_move(&keystr));
z_string_drop(z_string_move(&replystr));
} else {
Expand Down
3 changes: 2 additions & 1 deletion examples/unix/c99/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
// (void)(ctx);
// z_owned_string_t keystr;
// z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
// printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_str_data(z_string_loan(&keystr)), (int)sample->payload.len,
// printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_string_data(z_string_loan(&keystr)),
// (int)sample->payload.len,
// sample->payload.start);
// z_string_drop(z_string_move(&keystr));
// }
Expand Down
4 changes: 2 additions & 2 deletions examples/unix/c99/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ void query_handler(const z_loaned_query_t *query, void *ctx) {
z_keyexpr_to_string(z_query_keyexpr(query), &keystr);
z_view_string_t params;
z_query_parameters(query, &params);
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_str_data(z_string_loan(&keystr)),
printf(" >> [Queryable handler] Received Query '%s%.*s'\n", z_string_data(z_string_loan(&keystr)),
(int)z_view_string_loan(&params)->len, z_view_string_loan(&params)->val);
// Process value
const z_loaned_bytes_t *payload = z_value_payload(z_query_value(query));
if (z_bytes_len(payload) > 0) {
z_owned_string_t payload_string;
z_bytes_decode_into_string(payload, &payload_string);
printf(" with value '%s'\n", z_str_data(z_string_loan(&payload_string)));
printf(" with value '%s'\n", z_string_data(z_string_loan(&payload_string)));
z_string_drop(z_string_move(&payload_string));
}
z_query_reply_options_t options;
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 @@ -25,7 +25,7 @@ void data_handler(const z_loaned_sample_t *sample, void *arg) {
z_owned_string_t keystr;
z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
const z_loaned_bytes_t *payload = z_sample_payload(sample);
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_str_data(z_string_loan(&keystr)), (int)payload->len,
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_string_data(z_string_loan(&keystr)), (int)payload->len,
payload->start);
z_string_drop(z_string_move(&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 @@ -28,7 +28,7 @@ void data_handler(const z_loaned_sample_t *sample, void *arg) {
z_owned_string_t keystr;
z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
const z_loaned_bytes_t *payload = z_sample_payload(sample);
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_str_data(z_string_loan(&keystr)), (int)payload->len,
printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_string_data(z_string_loan(&keystr)), (int)payload->len,
payload->start);
z_string_drop(z_string_move(&keystr));
msg_nb++;
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 @@ -37,7 +37,7 @@ void reply_handler(const z_loaned_reply_t *reply, void *ctx) {
z_owned_string_t replystr;
z_bytes_decode_into_string(z_sample_payload(sample), &replystr);

printf(">> Received ('%s': '%s')\n", z_str_data(z_loan(keystr)), z_str_data(z_loan(replystr)));
printf(">> Received ('%s': '%s')\n", z_string_data(z_loan(keystr)), z_string_data(z_loan(replystr)));
z_drop(z_move(keystr));
z_drop(z_move(replystr));
} else {
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 @@ -23,7 +23,7 @@
// (void)(ctx);
// z_owned_string_t keystr;
// z_keyexpr_to_string(z_sample_keyexpr(sample), &keystr);
// printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_str_data(z_loan(keystr)), (int)sample->payload.len,
// printf(">> [Subscriber] Received ('%s': '%.*s')\n", z_string_data(z_loan(keystr)), (int)sample->payload.len,
// sample->payload.start);
// z_drop(z_move(keystr));
// }
Expand Down
Loading

0 comments on commit a8c236d

Please sign in to comment.