@@ -743,7 +743,7 @@ JsonInit(Json *json)
743
743
json -> root .ops -> init (& json -> root , json -> obj .value );
744
744
}
745
745
746
- static Json *
746
+ Json *
747
747
JsonExpand (Json * tmp , Datum value , bool freeValue , JsonContainerOps * ops )
748
748
{
749
749
Json * json ;
@@ -799,7 +799,8 @@ JsonExpandDatum(Datum value, JsonContainerOps *ops, Json *tmp)
799
799
Json *
800
800
DatumGetJson (Datum value , JsonContainerOps * ops , Json * tmp )
801
801
{
802
- Json * json = JsonExpandDatum (value , ops , tmp );
802
+ Json * json = JsonExpandDatum (value , ops , tmp );
803
+
803
804
JsonInit (json );
804
805
805
806
return json ;
@@ -832,17 +833,21 @@ JsonValueToJson(JsonValue *val)
832
833
{
833
834
if (val -> type == jbvBinary )
834
835
{
835
- JsonContainer * jc = val -> val .binary .data ;
836
- Json * json = JsonExpand (NULL , PointerGetDatum (NULL ), false,
837
- jc -> ops );
836
+ JsonContainer * jc = val -> val .binary .data ;
837
+ Json * json = JsonExpand (NULL , PointerGetDatum (NULL ), false,
838
+ jc -> ops );
839
+
838
840
json -> root = * jc ;
841
+
839
842
return json ;
840
843
}
841
844
else
842
845
{
843
- Json * json = JsonExpand (NULL , PointerGetDatum (NULL ), false,
844
- & jsonvContainerOps );
846
+ Json * json = JsonExpand (NULL , PointerGetDatum (NULL ), false,
847
+ & jsonvContainerOps );
848
+
845
849
jsonvInitContainer (& json -> root , val );
850
+
846
851
return json ;
847
852
}
848
853
}
0 commit comments