Test that adding the same value twice doesn't increase the size of the object

This commit is contained in:
Benoit Blanchon
2014-09-27 14:43:19 +02:00
parent 166bdd6919
commit a2fc188526
10 changed files with 146 additions and 32 deletions

View File

@ -1,15 +1,21 @@
#include "JsonBuffer.h"
//#include "JsonNode.h"
#include "JsonNode.h"
#include "JsonObject.h"
#include <string.h> // for memset
JsonObject JsonBuffer::createObject()
{
allocateNode();
return JsonObject(this);
JsonNode* node = createNode(JSON_OBJECT);
return JsonObject(this, node);
}
void JsonBuffer::createNode()
JsonNode* JsonBuffer::createNode(JsonNodeType type)
{
allocateNode();
JsonNode* node = allocateNode();
if (!node) return 0;
memset(node, 0, sizeof(JsonNode));
node->type = type;
return node;
}