@@ -43,7 +43,7 @@ static inline JsonPathExecResult recursiveExecute(JsonPathExecContext *cxt,
43
43
JsonPathItem * jsp , JsonbValue * jb ,
44
44
JsonValueList * found );
45
45
46
- static JsonPathExecResult recursiveExecuteUnwrap (JsonPathExecContext * cxt ,
46
+ static inline JsonPathExecResult recursiveExecuteUnwrap (JsonPathExecContext * cxt ,
47
47
JsonPathItem * jsp , JsonbValue * jb , JsonValueList * found );
48
48
49
49
static inline JsonbValue * wrapItemsInArray (const JsonValueList * items );
@@ -1958,51 +1958,56 @@ recursiveExecuteNoUnwrap(JsonPathExecContext *cxt, JsonPathItem *jsp,
1958
1958
}
1959
1959
1960
1960
static JsonPathExecResult
1961
- recursiveExecuteUnwrap (JsonPathExecContext * cxt , JsonPathItem * jsp ,
1962
- JsonbValue * jb , JsonValueList * found )
1961
+ recursiveExecuteUnwrapArray (JsonPathExecContext * cxt , JsonPathItem * jsp ,
1962
+ JsonbValue * jb , JsonValueList * found )
1963
1963
{
1964
- if (cxt -> lax && JsonbType (jb ) == jbvArray )
1964
+ JsonPathExecResult res = jperNotFound ;
1965
+
1966
+ if (jb -> type == jbvArray )
1965
1967
{
1966
- JsonPathExecResult res = jperNotFound ;
1968
+ JsonbValue * elem = jb -> val .array .elems ;
1969
+ JsonbValue * last = elem + jb -> val .array .nElems ;
1967
1970
1968
- if ( jb -> type == jbvArray )
1971
+ for (; elem < last ; elem ++ )
1969
1972
{
1970
- JsonbValue * elem = jb -> val .array .elems ;
1971
- JsonbValue * last = elem + jb -> val .array .nElems ;
1973
+ res = recursiveExecuteNoUnwrap (cxt , jsp , elem , found );
1972
1974
1973
- for (; elem < last ; elem ++ )
1974
- {
1975
- res = recursiveExecuteNoUnwrap (cxt , jsp , elem , found );
1975
+ if (jperIsError (res ))
1976
+ break ;
1977
+ if (res == jperOk && !found )
1978
+ break ;
1979
+ }
1980
+ }
1981
+ else
1982
+ {
1983
+ JsonbValue v ;
1984
+ JsonbIterator * it ;
1985
+ JsonbIteratorToken tok ;
1986
+
1987
+ it = JsonbIteratorInit (jb -> val .binary .data );
1976
1988
1989
+ while ((tok = JsonbIteratorNext (& it , & v , true)) != WJB_DONE )
1990
+ {
1991
+ if (tok == WJB_ELEM )
1992
+ {
1993
+ res = recursiveExecuteNoUnwrap (cxt , jsp , & v , found );
1977
1994
if (jperIsError (res ))
1978
1995
break ;
1979
1996
if (res == jperOk && !found )
1980
1997
break ;
1981
1998
}
1982
1999
}
1983
- else
1984
- {
1985
- JsonbValue v ;
1986
- JsonbIterator * it ;
1987
- JsonbIteratorToken tok ;
1988
-
1989
- it = JsonbIteratorInit (jb -> val .binary .data );
2000
+ }
1990
2001
1991
- while ((tok = JsonbIteratorNext (& it , & v , true)) != WJB_DONE )
1992
- {
1993
- if (tok == WJB_ELEM )
1994
- {
1995
- res = recursiveExecuteNoUnwrap (cxt , jsp , & v , found );
1996
- if (jperIsError (res ))
1997
- break ;
1998
- if (res == jperOk && !found )
1999
- break ;
2000
- }
2001
- }
2002
- }
2002
+ return res ;
2003
+ }
2003
2004
2004
- return res ;
2005
- }
2005
+ static inline JsonPathExecResult
2006
+ recursiveExecuteUnwrap (JsonPathExecContext * cxt , JsonPathItem * jsp ,
2007
+ JsonbValue * jb , JsonValueList * found )
2008
+ {
2009
+ if (cxt -> lax && JsonbType (jb ) == jbvArray )
2010
+ return recursiveExecuteUnwrapArray (cxt , jsp , jb , found );
2006
2011
2007
2012
return recursiveExecuteNoUnwrap (cxt , jsp , jb , found );
2008
2013
}
0 commit comments