From 2678e06c64b1af4c7262db0fdc7b2093d1bd675d Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Thu, 8 Dec 2022 15:04:46 +0800 Subject: [PATCH] fix: update to_json ffi --- src/common/json.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/json.c b/src/common/json.c index 1b303dd..4264824 100644 --- a/src/common/json.c +++ b/src/common/json.c @@ -17,8 +17,8 @@ uint8_t is_json_suffix(const char *file_name) { // whether file name end with `. return FALSE; } -char* to_json(const char *content) { // convert JSON / TOML / YAML to json format (if failed -> return NULL) - const char *json_string = to_json_rust(content); // convert to json format +char* to_json(const char *content) { // convert JSON / TOML / YAML to json format (failed -> NULL) + const char *json_string = to_json_ffi(content); // convert to json format char *json_content = strdup(json_string); // load string into owner heap free_rust_string(json_string); // free rust string if (strlen(json_content) == 0) { // empty string -> convert error @@ -30,6 +30,7 @@ char* to_json(const char *content) { // convert JSON / TOML / YAML to json forma return json_content; } + cJSON* json_field_get(cJSON *entry, const char *key) { // fetch key from json map (create when key not exist) cJSON *sub = entry->child; while (sub != NULL) { // traverse all keys