forked from bblanchon/ArduinoJson
Reduced size by 22 bytes by removing writeEmptyArray() and writeEmptyObject()
This commit is contained in:
@ -30,11 +30,9 @@ class JsonWriter {
|
||||
|
||||
void beginArray() { write('['); }
|
||||
void endArray() { write(']'); }
|
||||
void writeEmptyArray() { write("[]"); }
|
||||
|
||||
void beginObject() { write('{'); }
|
||||
void endObject() { write('}'); }
|
||||
void writeEmptyObject() { write("{}"); }
|
||||
|
||||
void writeColon() { write(':'); }
|
||||
void writeComma() { write(','); }
|
||||
|
@ -44,12 +44,10 @@ JsonObject &JsonArray::createNestedObject() {
|
||||
}
|
||||
|
||||
void JsonArray::writeTo(JsonWriter &writer) const {
|
||||
node_type *child = _firstNode;
|
||||
|
||||
if (child) {
|
||||
writer.beginArray();
|
||||
|
||||
for (;;) {
|
||||
const node_type *child = _firstNode;
|
||||
while (child) {
|
||||
child->content.writeTo(writer);
|
||||
|
||||
child = child->next;
|
||||
@ -59,7 +57,4 @@ void JsonArray::writeTo(JsonWriter &writer) const {
|
||||
}
|
||||
|
||||
writer.endArray();
|
||||
} else {
|
||||
writer.writeEmptyArray();
|
||||
}
|
||||
}
|
||||
|
@ -68,12 +68,10 @@ JsonObject::node_type *JsonObject::getNodeAt(const char *key) const {
|
||||
}
|
||||
|
||||
void JsonObject::writeTo(JsonWriter &writer) const {
|
||||
node_type *node = _firstNode;
|
||||
|
||||
if (node) {
|
||||
writer.beginObject();
|
||||
|
||||
for (;;) {
|
||||
const node_type *node = _firstNode;
|
||||
while (node) {
|
||||
writer.writeString(node->content.key);
|
||||
writer.writeColon();
|
||||
node->content.value.writeTo(writer);
|
||||
@ -85,7 +83,4 @@ void JsonObject::writeTo(JsonWriter &writer) const {
|
||||
}
|
||||
|
||||
writer.endObject();
|
||||
} else {
|
||||
writer.writeEmptyObject();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user