Removed another nested function that didn't yield a trampoline warning.
This commit is contained in:
parent
65655a96c7
commit
d25445538e
@ -1008,33 +1008,9 @@ struct betg_state
|
||||
int newdecr;
|
||||
};
|
||||
|
||||
int
|
||||
unifiesWithKeys (Termlist substlist, Termlist keylist,
|
||||
struct betg_state *ptr_betgState)
|
||||
{
|
||||
int old_length;
|
||||
int newgoals;
|
||||
|
||||
assert (ptr_betgState != NULL);
|
||||
|
||||
// TODO this is a hack: in this case we really should not use subterm
|
||||
// unification but interm instead. However, this effectively does the same
|
||||
// by avoiding branches that get immediately pruned anyway.
|
||||
if (!ptr_betgState->newdecr && keylist != NULL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// We need some adapting because the height would increase; we therefore
|
||||
// have to add recv goals before we know whether it unifies.
|
||||
old_length = sys->runs[ptr_betgState->run].height;
|
||||
newgoals =
|
||||
add_recv_goals (ptr_betgState->run, old_length, ptr_betgState->index + 1);
|
||||
|
||||
{
|
||||
// wrap substitution lists
|
||||
|
||||
void wrapSubst (Termlist sl)
|
||||
void
|
||||
wrapSubst (const Termlist sl, const struct betg_state *ptr_betgState,
|
||||
const Termlist keylist)
|
||||
{
|
||||
if (sl == NULL)
|
||||
{
|
||||
@ -1067,11 +1043,11 @@ unifiesWithKeys (Termlist substlist, Termlist keylist,
|
||||
State.sl = sl;
|
||||
State.tvar = sl->term;
|
||||
State.allgood = true;
|
||||
iterateTermOther (ptr_betgState->run, State.tvar, makeDepend,
|
||||
&State);
|
||||
iterateTermOther (ptr_betgState->run, State.tvar, makeDepend, &State);
|
||||
if (State.allgood)
|
||||
{
|
||||
wrapSubst (sl->next);
|
||||
// Recursive call
|
||||
wrapSubst (sl->next, ptr_betgState, keylist);
|
||||
}
|
||||
while (State.neworders > 0)
|
||||
{
|
||||
@ -1081,9 +1057,32 @@ unifiesWithKeys (Termlist substlist, Termlist keylist,
|
||||
}
|
||||
}
|
||||
|
||||
wrapSubst (substlist);
|
||||
int
|
||||
unifiesWithKeys (Termlist substlist, Termlist keylist,
|
||||
struct betg_state *ptr_betgState)
|
||||
{
|
||||
int old_length;
|
||||
int newgoals;
|
||||
|
||||
assert (ptr_betgState != NULL);
|
||||
|
||||
// TODO this is a hack: in this case we really should not use subterm
|
||||
// unification but interm instead. However, this effectively does the same
|
||||
// by avoiding branches that get immediately pruned anyway.
|
||||
if (!ptr_betgState->newdecr && keylist != NULL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// We need some adapting because the height would increase; we therefore
|
||||
// have to add recv goals before we know whether it unifies.
|
||||
old_length = sys->runs[ptr_betgState->run].height;
|
||||
newgoals =
|
||||
add_recv_goals (ptr_betgState->run, old_length, ptr_betgState->index + 1);
|
||||
|
||||
// wrap substitution lists
|
||||
wrapSubst (substlist, ptr_betgState, keylist);
|
||||
|
||||
// undo
|
||||
goal_remove_last (newgoals);
|
||||
sys->runs[ptr_betgState->run].height = old_length;
|
||||
|
Loading…
Reference in New Issue
Block a user