JsonArray::remove() and JsonObject::remove() now release the memory of strings

This commit is contained in:
Benoit Blanchon
2018-11-09 17:27:32 +01:00
parent e842838a23
commit f375459d53
68 changed files with 1504 additions and 740 deletions

View File

@@ -26,13 +26,13 @@ enum JsonVariantType {
};
struct JsonObjectData {
struct Slot *head;
struct Slot *tail;
struct VariantSlot *head;
struct VariantSlot *tail;
};
struct JsonArrayData {
struct Slot *head;
struct Slot *tail;
struct VariantSlot *head;
struct VariantSlot *tail;
};
struct RawData {
@@ -48,6 +48,8 @@ union JsonVariantContent {
JsonArrayData asArray;
JsonObjectData asObject;
const char *asString;
struct StringSlot *asOwnedString;
struct StringSlot *asOwnedRaw;
struct {
const char *data;
size_t size;
@@ -56,7 +58,7 @@ union JsonVariantContent {
// this struct must be a POD type to prevent error calling offsetof on clang
struct JsonVariantData {
bool keyIsStatic : 1;
bool keyIsOwned : 1;
JsonVariantType type : 7;
JsonVariantContent content;
};