* appropriate flag, as well as having the pointed-to Jsonb superheader be of
* that same container type at the top level. If both of those conditions
* don't hold, immediately fall through and return NULL. Otherwise, return
- * palloc()'d copy of value.
+ * palloc()'d copy of value. "flags" allows caller to specify which container
+ * types are of interest.
*/
JsonbValue *
findJsonbValueFromSuperHeader(JsonbSuperHeader sheader, uint32 flags,
JsonbValue *r = palloc(sizeof(JsonbValue));
int count = (superheader & JB_CMASK);
- /* No contradictory requests */
- Assert((superheader & (JB_FARRAY | JB_FOBJECT)) !=
- (JB_FARRAY | JB_FOBJECT));
+ Assert((flags & ~(JB_FARRAY | JB_FOBJECT)) == 0);
if (flags & JB_FARRAY & superheader)
{
/*
* Get i-th value of array or object.
*
- * Returns palloc()'d copy of value, or NULL if it cannot be found.
+ * Returns palloc()'d copy of value, or NULL if it cannot be found. "flags"
+ * allows caller to specify which container types are of interest.
*/
JsonbValue *
getIthJsonbValueFromSuperHeader(JsonbSuperHeader sheader, uint32 flags,
*e;
char *data;
- r = palloc(sizeof(JsonbValue));
+ Assert((flags & ~(JB_FARRAY | JB_FOBJECT)) == 0);
- /* No contradictory requests */
- Assert((superheader & (JB_FARRAY | JB_FOBJECT)) !=
- (JB_FARRAY | JB_FOBJECT));
+ r = palloc(sizeof(JsonbValue));
if (i >= (superheader & JB_CMASK))
return NULL;