alwas make sure you are looking at a variable before checking IsUnboundVar

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1130 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-09-08 19:06:57 +00:00
parent 6a4d9ef41a
commit 3c44b02093
2 changed files with 4 additions and 4 deletions

View File

@ -281,8 +281,8 @@ PutAtt(attvar_record *attv, Int i, Term tatt) {
static Int
UpdateAtt(attvar_record *attv, Int i, Term tatt) {
Int pos = i*2;
if (!IsUnboundVar(attv->Atts[pos+1])) {
Term tv = attv->Atts[pos+1];
if (!IsVarTerm(tv) || !IsUnboundVar(tv)) {
tatt = MkPairTerm(tatt, attv->Atts[pos+1]);
} else {
tatt = MkPairTerm(tatt, TermNil);
@ -389,7 +389,7 @@ static Int
GetAtt(attvar_record *attv, int i) {
Int pos = i *2;
#if SBA
if (IsUnboundVar(attv->Atts[pos+1]))
if (IsVarTerm(attv->Atts[pos+1]) && IsUnboundVar(attv->Atts[pos+1]))
return((CELL)&(attv->Atts[pos+1]));
#endif
return(attv->Atts[pos+1]);

View File

@ -1691,7 +1691,7 @@ static int subsumes_complex(register CELL *pt0, register CELL *pt0_end, register
/* cell we created */
CELL *npt1 = (CELL *)*pt1;
/* shorten the chain */
if (IsUnboundVar(*pt1)) {
if (IsVarTerm(*pt1) && IsUnboundVar(*pt1)) {
RESET_VARIABLE(pt1);
} else {
*pt1 = *npt1;