File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,17 @@ JsonbInitBinary(JsonbValue *jbv, Jsonb *jb)
159159 return jbv ;
160160}
161161
162+ static inline JsonbValue *
163+ JsonbWrapInBinary (JsonbValue * jbv , JsonbValue * out )
164+ {
165+ Jsonb * jb = JsonbValueToJsonb (jbv );
166+
167+ if (!out )
168+ out = palloc (sizeof (* out ));
169+
170+ return JsonbInitBinary (out , jb );
171+ }
172+
162173/********************Execute functions for JsonPath***************************/
163174
164175/*
@@ -1967,7 +1978,6 @@ static inline JsonbValue *
19671978wrapItem (JsonbValue * jbv )
19681979{
19691980 JsonbParseState * ps = NULL ;
1970- Jsonb * jb ;
19711981 JsonbValue jbvbuf ;
19721982
19731983 switch (JsonbType (jbv ))
@@ -1999,14 +2009,7 @@ wrapItem(JsonbValue *jbv)
19992009 pushJsonbValue (& ps , WJB_ELEM , jbv );
20002010 jbv = pushJsonbValue (& ps , WJB_END_ARRAY , NULL );
20012011
2002- jb = JsonbValueToJsonb (jbv );
2003-
2004- jbv = palloc (sizeof (* jbv ));
2005- jbv -> type = jbvBinary ;
2006- jbv -> val .binary .data = & jb -> root ;
2007- jbv -> val .binary .len = VARSIZE (jb ) - VARHDRSZ ;
2008-
2009- return jbv ;
2012+ return JsonbWrapInBinary (jbv , NULL );
20102013}
20112014
20122015static inline JsonPathExecResult
You can’t perform that action at this time.
0 commit comments