forked from Telodendria/Cytoplasm
parent
bc67393036
commit
29070c8f41
2 changed files with 8 additions and 2 deletions
|
@ -12,6 +12,8 @@ releases. Final change log entries are published as [Releases](releases).
|
||||||
- Added an option to `j2s` to allow additional fields in structures and ignore them in
|
- Added an option to `j2s` to allow additional fields in structures and ignore them in
|
||||||
encoding and decoding. Note that additional fields are totally untouched—they
|
encoding and decoding. Note that additional fields are totally untouched—they
|
||||||
are not even initialized to a default value.
|
are not even initialized to a default value.
|
||||||
|
- Fixed a memory leak that would occur in code generated by `j2s` under
|
||||||
|
specific circumstances.
|
||||||
- Added `JsonMerge()` to the JSON API to merge two JSON objects together.
|
- Added `JsonMerge()` to the JSON API to merge two JSON objects together.
|
||||||
|
|
||||||
## v0.4.0
|
## v0.4.0
|
||||||
|
|
|
@ -660,11 +660,15 @@ Main(Array * args)
|
||||||
StreamPrintf(implFile, " }\n\n");
|
StreamPrintf(implFile, " }\n\n");
|
||||||
if (StrEquals(fieldType, "array"))
|
if (StrEquals(fieldType, "array"))
|
||||||
{
|
{
|
||||||
StreamPrintf(implFile, " out->%s = JsonValueAsArray(JsonValueDuplicate(val));\n", key);
|
StreamPrintf(implFile, " val = JsonValueDuplicate(val);\n");
|
||||||
|
StreamPrintf(implFile, " out->%s = JsonValueAsArray(val);\n", key);
|
||||||
|
StreamPrintf(implFile, " Free(val); /* Not JsonValueFree() because we want the inner value. */\n");
|
||||||
}
|
}
|
||||||
else if (StrEquals(fieldType, "object"))
|
else if (StrEquals(fieldType, "object"))
|
||||||
{
|
{
|
||||||
StreamPrintf(implFile, " out->%s = JsonValueAsObject(JsonValueDuplicate(val));\n", key);
|
StreamPrintf(implFile, " val = JsonValueDuplicate(val);\n");
|
||||||
|
StreamPrintf(implFile, " out->%s = JsonValueAsObject(val);\n", key);
|
||||||
|
StreamPrintf(implFile, " Free(val); /* Not JsonValueFree() because we want the inner value. */\n");
|
||||||
}
|
}
|
||||||
else if (*fieldType == '[' && fieldType[strlen(fieldType) - 1] == ']')
|
else if (*fieldType == '[' && fieldType[strlen(fieldType) - 1] == ']')
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue