diff options
author | Werner Koch <[email protected]> | 2018-03-23 10:26:36 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2018-03-23 10:26:36 +0000 |
commit | 6525d78d0a1d303c449762082942e71d3002b9ca (patch) | |
tree | 8127ce3f943a0658534d77ef2b46b7820864049d | |
parent | json: Use gpgrt_argparse instead of argsparse.c (diff) | |
download | gpgme-6525d78d0a1d303c449762082942e71d3002b9ca.tar.gz gpgme-6525d78d0a1d303c449762082942e71d3002b9ca.zip |
json: Add a new function to cJSON.
* src/cJSON.c (cJSON_CreateStringConvey): New.
-rw-r--r-- | src/cJSON.c | 12 | ||||
-rw-r--r-- | src/cJSON.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/cJSON.c b/src/cJSON.c index 1941d114..cf0cb132 100644 --- a/src/cJSON.c +++ b/src/cJSON.c @@ -1200,6 +1200,18 @@ cJSON_CreateString (const char *string) } cJSON * +cJSON_CreateStringConvey (char *string) +{ + cJSON *item = cJSON_New_Item (); + if (item) + { + item->type = cJSON_String; + item->valuestring = string; + } + return item; +} + +cJSON * cJSON_CreateArray (void) { cJSON *item = cJSON_New_Item (); diff --git a/src/cJSON.h b/src/cJSON.h index 69c3056a..a200c318 100644 --- a/src/cJSON.h +++ b/src/cJSON.h @@ -113,6 +113,7 @@ extern cJSON *cJSON_CreateFalse(void); extern cJSON *cJSON_CreateBool(int b); extern cJSON *cJSON_CreateNumber(double num); extern cJSON *cJSON_CreateString(const char *string); +extern cJSON *cJSON_CreateStringConvey (char *string); extern cJSON *cJSON_CreateArray(void); extern cJSON *cJSON_CreateObject(void); |