src/json.c

changeset 1556
afdaa70034f8
parent 1551
f3ba964dc8d5
equal deleted inserted replaced
1555:8972247f54e8 1556:afdaa70034f8
788 } 788 }
789 789
790 return result; 790 return result;
791 } 791 }
792 792
793 CxJsonStatus cx_json_from_string(const CxAllocator *allocator,
794 cxstring str, CxJsonValue **value) {
795 *value = NULL;
796 CxJson parser;
797 cxJsonInit(&parser, allocator);
798 if (cxJsonFill(&parser, str)) {
799 // LCOV_EXCL_START
800 cxJsonDestroy(&parser);
801 return CX_JSON_BUFFER_ALLOC_FAILED;
802 // LCOV_EXCL_STOP
803 }
804 CxJsonStatus status = cxJsonNext(&parser, value);
805 cxJsonDestroy(&parser);
806 return status;
807 }
808
793 void cxJsonValueFree(CxJsonValue *value) { 809 void cxJsonValueFree(CxJsonValue *value) {
794 if (value == NULL || value->type == CX_JSON_NOTHING) return; 810 if (value == NULL || value->type == CX_JSON_NOTHING) return;
795 switch (value->type) { 811 switch (value->type) {
796 case CX_JSON_OBJECT: { 812 case CX_JSON_OBJECT: {
797 json_free_object_map(value->object); 813 json_free_object_map(value->object);

mercurial