From 26772a8ef7affe5ed96c831eddfb6b69146cc2d2 Mon Sep 17 00:00:00 2001 From: Bernt Johan Damslora Date: Thu, 17 Oct 2019 14:03:15 +0200 Subject: [PATCH] Add const qualifier to cJSON_CreateStringArray Adds a const qualifier to the strings in the array to avoid discarding it from arguments. --- cJSON.c | 2 +- cJSON.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cJSON.c b/cJSON.c index 85e8ba6..96b65f1 100644 --- a/cJSON.c +++ b/cJSON.c @@ -2524,7 +2524,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count) return a; } -CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count) +CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count) { size_t i = 0; cJSON *n = NULL; diff --git a/cJSON.h b/cJSON.h index 42c1cc6..0ecd179 100644 --- a/cJSON.h +++ b/cJSON.h @@ -213,7 +213,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child); CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count); CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count); CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count); -CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count); +CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count); /* Append item to the specified array/object. */ CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item);