This is an automated email from the ASF dual-hosted git repository. kasjer pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 630404f11a7992dbdf029aff89c18f931dff9dfa Author: Jerzy Kasenberg <[email protected]> AuthorDate: Thu Jun 18 12:09:57 2026 +0200 json/selftest: Fix const usage in test When const is applied to test_jbuf fields buffer can be used with constant string. Signed-off-by: Jerzy Kasenberg <[email protected]> --- encoding/json/hosttest/src/test_json_priv.h | 6 +++--- encoding/json/hosttest/src/test_json_utils.c | 2 +- encoding/json/selftest/src/test_json_priv.h | 6 +++--- encoding/json/selftest/src/test_json_utils.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/encoding/json/hosttest/src/test_json_priv.h b/encoding/json/hosttest/src/test_json_priv.h index 69ace9353..b0292bb3c 100644 --- a/encoding/json/hosttest/src/test_json_priv.h +++ b/encoding/json/hosttest/src/test_json_priv.h @@ -42,8 +42,8 @@ extern int buf_index; struct test_jbuf { /* json_buffer must be first element in the structure */ struct json_buffer json_buf; - char * start_buf; - char * end_buf; + const char *start_buf; + const char *end_buf; int current_position; }; @@ -51,7 +51,7 @@ char test_jbuf_read_next(struct json_buffer *jb); char test_jbuf_read_prev(struct json_buffer *jb); int test_jbuf_readn(struct json_buffer *jb, char *buf, int size); int test_write(void *buf, char* data, int len); -void test_buf_init(struct test_jbuf *ptjb, char *string); +void test_buf_init(struct test_jbuf *ptjb, const char *string); #ifdef __cplusplus } diff --git a/encoding/json/hosttest/src/test_json_utils.c b/encoding/json/hosttest/src/test_json_utils.c index bffbdabdc..9a1e24b2c 100644 --- a/encoding/json/hosttest/src/test_json_utils.c +++ b/encoding/json/hosttest/src/test_json_utils.c @@ -93,7 +93,7 @@ test_jbuf_readn(struct json_buffer *jb, char *buf, int size) } void -test_buf_init(struct test_jbuf *ptjb, char *string) +test_buf_init(struct test_jbuf *ptjb, const char *string) { /* initialize the decode */ ptjb->json_buf.jb_read_next = test_jbuf_read_next; diff --git a/encoding/json/selftest/src/test_json_priv.h b/encoding/json/selftest/src/test_json_priv.h index 69ace9353..b0292bb3c 100644 --- a/encoding/json/selftest/src/test_json_priv.h +++ b/encoding/json/selftest/src/test_json_priv.h @@ -42,8 +42,8 @@ extern int buf_index; struct test_jbuf { /* json_buffer must be first element in the structure */ struct json_buffer json_buf; - char * start_buf; - char * end_buf; + const char *start_buf; + const char *end_buf; int current_position; }; @@ -51,7 +51,7 @@ char test_jbuf_read_next(struct json_buffer *jb); char test_jbuf_read_prev(struct json_buffer *jb); int test_jbuf_readn(struct json_buffer *jb, char *buf, int size); int test_write(void *buf, char* data, int len); -void test_buf_init(struct test_jbuf *ptjb, char *string); +void test_buf_init(struct test_jbuf *ptjb, const char *string); #ifdef __cplusplus } diff --git a/encoding/json/selftest/src/test_json_utils.c b/encoding/json/selftest/src/test_json_utils.c index 67cce2734..9c631a5c0 100644 --- a/encoding/json/selftest/src/test_json_utils.c +++ b/encoding/json/selftest/src/test_json_utils.c @@ -94,7 +94,7 @@ test_jbuf_readn(struct json_buffer *jb, char *buf, int size) } void -test_buf_init(struct test_jbuf *ptjb, char *string) +test_buf_init(struct test_jbuf *ptjb, const char *string) { /* initialize the decode */ ptjb->json_buf.jb_read_next = test_jbuf_read_next;
