* check for boolean condition */
| 17 | * check for boolean condition |
| 18 | */ |
| 19 | bool |
| 20 | ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM *val)) |
| 21 | { |
| 22 | /* since this function recurses, it could be driven to stack overflow */ |
| 23 | check_stack_depth(); |
| 24 | |
| 25 | if (curitem->type == VAL) |
| 26 | return (*chkcond) (checkval, curitem); |
| 27 | else if (curitem->val == (int32) '!') |
| 28 | { |
| 29 | return calcnot ? |
| 30 | ((ltree_execute(curitem + 1, checkval, calcnot, chkcond)) ? false : true) |
| 31 | : true; |
| 32 | } |
| 33 | else if (curitem->val == (int32) '&') |
| 34 | { |
| 35 | if (ltree_execute(curitem + curitem->left, checkval, calcnot, chkcond)) |
| 36 | return ltree_execute(curitem + 1, checkval, calcnot, chkcond); |
| 37 | else |
| 38 | return false; |
| 39 | } |
| 40 | else |
| 41 | { /* |-operator */ |
| 42 | if (ltree_execute(curitem + curitem->left, checkval, calcnot, chkcond)) |
| 43 | return true; |
| 44 | else |
| 45 | return ltree_execute(curitem + 1, checkval, calcnot, chkcond); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | typedef struct |
| 50 | { |
no test coverage detected