5 static void OrQuery_reclaim(Query *this) {
6 OrQuery *q = (OrQuery*) this;
8 for ( i = 0; i < q->size; i++ ) {
9 Query_reclaim( q->disjuncts[i] );
15 static int OrQuery_next( Query *this,BindingTable *bt,enum NextState state) {
16 OrQuery *q = (OrQuery*) this;
18 enum NextState s = subsequent;
24 for ( ; i < q->size; i++ ) {
25 if ( Query_next( q->disjuncts[i], bt, s ) ) {
29 Query_next( q->disjuncts[i], bt, restore );
36 Query_next( q->disjuncts[i], bt, restore );
44 static void OrQuery_variables(Query *this,HashVector *hv) {
45 OrQuery *q = (OrQuery*) this;
47 for ( i = 0; i < q->size; i++ ) {
48 Query_variables( q->disjuncts[i], hv );
52 static struct QueryCallbacks OrQuery_def = {
53 .reclaim = OrQuery_reclaim,
55 .variables = OrQuery_variables
58 Query *Query_or(int n,...) {
60 OrQuery *q = (OrQuery *)
61 malloc( sizeof( OrQuery ) );
66 .disjuncts = (Query**) malloc( n * sizeof( Query* ) ),
70 for ( i = 0; i < n; i++ ) {
71 q->disjuncts[i] = va_arg( args, Query* );