Added some safety checks and a missing deVar to the code that localises terms.
This commit is contained in:
parent
69c0486376
commit
b56c66db0b
@ -453,12 +453,15 @@ run_localize (const System sys, const int rid, Termlist fromlist,
|
|||||||
Term t;
|
Term t;
|
||||||
|
|
||||||
t = substlist->term;
|
t = substlist->term;
|
||||||
|
if (t != NULL)
|
||||||
|
{
|
||||||
if (t->subst != NULL)
|
if (t->subst != NULL)
|
||||||
{
|
{
|
||||||
t->subst = termLocal (t->subst, fromlist, tolist);
|
t->subst = termLocal (t->subst, fromlist, tolist);
|
||||||
sys->runs[rid].substitutions =
|
sys->runs[rid].substitutions =
|
||||||
termlistAdd (sys->runs[rid].substitutions, t);
|
termlistAdd (sys->runs[rid].substitutions, t);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
substlist = substlist->next;
|
substlist = substlist->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -629,14 +629,18 @@ termlistLength (Termlist tl)
|
|||||||
*\sa termlistLocal()
|
*\sa termlistLocal()
|
||||||
*/
|
*/
|
||||||
Term
|
Term
|
||||||
termLocal (const Term t, Termlist fromlist, Termlist tolist)
|
termLocal (const Term tPre, Termlist fromlist, Termlist tolist)
|
||||||
{
|
{
|
||||||
if (t == NULL)
|
Term t;
|
||||||
|
|
||||||
|
if (tPre == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
t = deVar(tPre);
|
||||||
|
|
||||||
if (realTermLeaf (t))
|
if (realTermLeaf (t))
|
||||||
{
|
{
|
||||||
while (fromlist != NULL && tolist != NULL)
|
while ((fromlist != NULL) && (tolist != NULL))
|
||||||
{
|
{
|
||||||
if (isTermEqual (fromlist->term, t))
|
if (isTermEqual (fromlist->term, t))
|
||||||
{
|
{
|
||||||
@ -650,17 +654,22 @@ termLocal (const Term t, Termlist fromlist, Termlist tolist)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Term newt = termNodeDuplicate (t);
|
Term newt;
|
||||||
|
|
||||||
|
newt = termNodeDuplicate (t);
|
||||||
if (realTermTuple (t))
|
if (realTermTuple (t))
|
||||||
{
|
{
|
||||||
TermOp1 (newt) = termLocal (TermOp1 (t), fromlist, tolist);
|
TermOp1 (newt) = termLocal (TermOp1 (t), fromlist, tolist);
|
||||||
TermOp2 (newt) = termLocal (TermOp2 (t), fromlist, tolist);
|
TermOp2 (newt) = termLocal (TermOp2 (t), fromlist, tolist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (realTermEncrypt (t))
|
||||||
{
|
{
|
||||||
TermOp (newt) = termLocal (TermOp (t), fromlist, tolist);
|
TermOp (newt) = termLocal (TermOp (t), fromlist, tolist);
|
||||||
TermKey (newt) = termLocal (TermKey (t), fromlist, tolist);
|
TermKey (newt) = termLocal (TermKey (t), fromlist, tolist);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return newt;
|
return newt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user