Skip to content

Commit

Permalink
Fix unify with occurs checking enables, re issue #349
Browse files Browse the repository at this point in the history
  • Loading branch information
infradig committed Sep 26, 2023
1 parent b723648 commit 8ab8f94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
31 changes: 10 additions & 21 deletions src/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -1839,38 +1839,27 @@ void query_destroy(query *q)
free(q);
}

void query_reset(query *q)
{
q->flags.occurs_check = false;
q->get_started = get_time_in_usec();
q->time_cpu_last_started = q->time_cpu_started = cpu_time_in_usec();
q->ops_dirty = true;
q->double_quotes = false;
q->st.prob = 1.0;
q->max_depth = 0;
q->halt = false;
q->error = false;
q->st.hp = 0;
q->st.tp = 0;
q->st.sp = 0;
mp_int_init(&q->tmp_ival);
mp_rat_init(&q->tmp_irat);
clr_accum(&q->accum);
}

query *query_create(module *m, bool is_task)
{
static atomic_t uint64_t g_query_id = 0;

query *q = calloc(1, sizeof(query));
ensure(q);
q->flags.occurs_check = false;
q->qid = g_query_id++;
q->pl = m->pl;
q->st.prev_m = q->st.m = m;
q->trace = m->pl->trace;
q->flags = m->flags;

query_reset(q);
q->get_started = get_time_in_usec();
q->time_cpu_last_started = q->time_cpu_started = cpu_time_in_usec();
q->ops_dirty = true;
q->double_quotes = false;
q->st.prob = 1.0;
q->max_depth = 0;
mp_int_init(&q->tmp_ival);
mp_rat_init(&q->tmp_irat);
clr_accum(&q->accum);

// Allocate these now...

Expand Down
1 change: 0 additions & 1 deletion src/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ typedef struct {

query *query_create(module *m, bool sub_query);
query *query_create_task(query *q, cell *curr_cell);
void query_reset(query *q);
void query_destroy(query *q);

bool push_choice(query *q);
Expand Down

0 comments on commit 8ab8f94

Please sign in to comment.