From 98a6ed5873c619124688545e65152e2244536bb6 Mon Sep 17 00:00:00 2001 From: Cas Cremers Date: Mon, 24 Dec 2018 13:45:28 +0100 Subject: [PATCH] Got rid of similar trampoline for unify tuple recursion. --- src/mgu.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/mgu.c b/src/mgu.c index fc2585f..ad702dc 100644 --- a/src/mgu.c +++ b/src/mgu.c @@ -270,14 +270,15 @@ unify (Term t1, Term t2, Termlist tl, int (*callback) (), void *state) non-associative version ! TODO other version */ if (isTermTuple (t1)) { - int unify_combined_tup (Termlist tl, void *state) - { - // now the keys are unified (subst in this tl) - // and we try the inner terms - return unify (TermOp2 (t1), TermOp2 (t2), tl, callback, state); - } - return unify (TermOp1 (t1), TermOp1 (t2), tl, unify_combined_tup, - state); + struct state_mgu_tmp tmpstate; + + tmpstate.oldstate = state; + tmpstate.oldcallback = callback; + tmpstate.unifyt1 = TermOp2 (t1); + tmpstate.unifyt2 = TermOp2 (t2); + + return unify (TermOp1 (t1), TermOp1 (t2), tl, unify_callback_wrapper, + &tmpstate); } return true;