@@ -42,7 +42,7 @@ static inline JsonPathExecResult recursiveExecute(JsonPathExecContext *cxt,
42
42
JsonPathItem * jsp , JsonbValue * jb ,
43
43
JsonValueList * found );
44
44
45
- static JsonPathExecResult recursiveExecuteUnwrap (JsonPathExecContext * cxt ,
45
+ static inline JsonPathExecResult recursiveExecuteUnwrap (JsonPathExecContext * cxt ,
46
46
JsonPathItem * jsp , JsonbValue * jb , JsonValueList * found );
47
47
48
48
static inline JsonbValue * wrapItemsInArray (const JsonValueList * items );
@@ -1985,51 +1985,56 @@ recursiveExecuteNoUnwrap(JsonPathExecContext *cxt, JsonPathItem *jsp,
1985
1985
}
1986
1986
1987
1987
static JsonPathExecResult
1988
- recursiveExecuteUnwrap (JsonPathExecContext * cxt , JsonPathItem * jsp ,
1989
- JsonbValue * jb , JsonValueList * found )
1988
+ recursiveExecuteUnwrapArray (JsonPathExecContext * cxt , JsonPathItem * jsp ,
1989
+ JsonbValue * jb , JsonValueList * found )
1990
1990
{
1991
- if (cxt -> lax && JsonbType (jb ) == jbvArray )
1991
+ JsonPathExecResult res = jperNotFound ;
1992
+
1993
+ if (jb -> type == jbvArray )
1992
1994
{
1993
- JsonPathExecResult res = jperNotFound ;
1995
+ JsonbValue * elem = jb -> val .array .elems ;
1996
+ JsonbValue * last = elem + jb -> val .array .nElems ;
1994
1997
1995
- if ( jb -> type == jbvArray )
1998
+ for (; elem < last ; elem ++ )
1996
1999
{
1997
- JsonbValue * elem = jb -> val .array .elems ;
1998
- JsonbValue * last = elem + jb -> val .array .nElems ;
2000
+ res = recursiveExecuteNoUnwrap (cxt , jsp , elem , found );
1999
2001
2000
- for (; elem < last ; elem ++ )
2001
- {
2002
- res = recursiveExecuteNoUnwrap (cxt , jsp , elem , found );
2002
+ if (jperIsError (res ))
2003
+ break ;
2004
+ if (res == jperOk && !found )
2005
+ break ;
2006
+ }
2007
+ }
2008
+ else
2009
+ {
2010
+ JsonbValue v ;
2011
+ JsonbIterator * it ;
2012
+ JsonbIteratorToken tok ;
2013
+
2014
+ it = JsonbIteratorInit (jb -> val .binary .data );
2003
2015
2016
+ while ((tok = JsonbIteratorNext (& it , & v , true)) != WJB_DONE )
2017
+ {
2018
+ if (tok == WJB_ELEM )
2019
+ {
2020
+ res = recursiveExecuteNoUnwrap (cxt , jsp , & v , found );
2004
2021
if (jperIsError (res ))
2005
2022
break ;
2006
2023
if (res == jperOk && !found )
2007
2024
break ;
2008
2025
}
2009
2026
}
2010
- else
2011
- {
2012
- JsonbValue v ;
2013
- JsonbIterator * it ;
2014
- JsonbIteratorToken tok ;
2015
-
2016
- it = JsonbIteratorInit (jb -> val .binary .data );
2027
+ }
2017
2028
2018
- while ((tok = JsonbIteratorNext (& it , & v , true)) != WJB_DONE )
2019
- {
2020
- if (tok == WJB_ELEM )
2021
- {
2022
- res = recursiveExecuteNoUnwrap (cxt , jsp , & v , found );
2023
- if (jperIsError (res ))
2024
- break ;
2025
- if (res == jperOk && !found )
2026
- break ;
2027
- }
2028
- }
2029
- }
2029
+ return res ;
2030
+ }
2030
2031
2031
- return res ;
2032
- }
2032
+ static inline JsonPathExecResult
2033
+ recursiveExecuteUnwrap (JsonPathExecContext * cxt , JsonPathItem * jsp ,
2034
+ JsonbValue * jb , JsonValueList * found )
2035
+ {
2036
+ if (cxt -> lax && JsonbType (jb ) == jbvArray )
2037
+ return recursiveExecuteUnwrapArray (cxt , jsp , jb , found );
2033
2038
2034
2039
return recursiveExecuteNoUnwrap (cxt , jsp , jb , found );
2035
2040
}
0 commit comments