MCPcopy Create free account
hub / github.com/apache/cloudberry / execute

Function execute

contrib/intarray/_int_bool.c:265–294  ·  view source on GitHub ↗

* evaluate boolean expression, using chkcond() to test the primitive cases */

Source from the content-addressed store, hash-verified

263 * evaluate boolean expression, using chkcond() to test the primitive cases
264 */
265static bool
266execute(ITEM *curitem, void *checkval, void *options, bool calcnot,
267 bool (*chkcond) (void *checkval, ITEM *item, void *options))
268{
269 /* since this function recurses, it could be driven to stack overflow */
270 check_stack_depth();
271
272 if (curitem->type == VAL)
273 return (*chkcond) (checkval, curitem, options);
274 else if (curitem->val == (int32) '!')
275 {
276 return calcnot ?
277 ((execute(curitem - 1, checkval, options, calcnot, chkcond)) ? false : true)
278 : true;
279 }
280 else if (curitem->val == (int32) '&')
281 {
282 if (execute(curitem + curitem->left, checkval, options, calcnot, chkcond))
283 return execute(curitem - 1, checkval, options, calcnot, chkcond);
284 else
285 return false;
286 }
287 else
288 { /* |-operator */
289 if (execute(curitem + curitem->left, checkval, options, calcnot, chkcond))
290 return true;
291 else
292 return execute(curitem - 1, checkval, options, calcnot, chkcond);
293 }
294}
295
296/*
297 * signconsistent & execconsistent called by *_consistent

Callers 4

signconsistentFunction · 0.70
execconsistentFunction · 0.70
gin_bool_consistentFunction · 0.70
boolopFunction · 0.70

Calls 1

check_stack_depthFunction · 0.85

Tested by

no test coverage detected