712 if (v == NULL) return NULL; |
712 if (v == NULL) return NULL; |
713 v->allocator = allocator; |
713 v->allocator = allocator; |
714 v->type = CX_JSON_STRING; |
714 v->type = CX_JSON_STRING; |
715 cxmutstr s = cx_strdup_a(allocator, str); |
715 cxmutstr s = cx_strdup_a(allocator, str); |
716 if (s.ptr == NULL) { cxFree(allocator, v); return NULL; } |
716 if (s.ptr == NULL) { cxFree(allocator, v); return NULL; } |
|
717 v->value.string = s; |
717 return v; |
718 return v; |
718 } |
719 } |
719 |
720 |
720 CxJsonValue* cxJsonCreateLiteral(const CxAllocator* allocator, CxJsonLiteral lit) { |
721 CxJsonValue* cxJsonCreateLiteral(const CxAllocator* allocator, CxJsonLiteral lit) { |
721 CxJsonValue* v = cxMalloc(allocator, sizeof(CxJsonValue)); |
722 CxJsonValue* v = cxMalloc(allocator, sizeof(CxJsonValue)); |