From 61d99731c89b0106673781ee653bc88aaab53f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Thu, 7 Oct 2010 18:14:55 +0100 Subject: [PATCH 1/3] avoid recursion on very deep sequences of static indices. --- H/rheap.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/H/rheap.h b/H/rheap.h index 6f138820a..f48cc246d 100755 --- a/H/rheap.h +++ b/H/rheap.h @@ -635,19 +635,23 @@ CleanLUIndex(LogUpdIndex *idx, int recurse) static void CleanSIndex(StaticIndex *idx, int recurse) { - idx->ClPred = PtoPredAdjust(idx->ClPred); - if (idx->SiblingIndex) { - idx->SiblingIndex = SIndexAdjust(idx->SiblingIndex); - if (recurse) - CleanSIndex(idx->SiblingIndex, TRUE); + beginning: + if (!(idx->ClFlags & SwitchTableMask)) { + restore_opcodes(idx->ClCode, NULL); } + idx->ClPred = PtoPredAdjust(idx->ClPred); if (idx->ChildIndex) { idx->ChildIndex = SIndexAdjust(idx->ChildIndex); if (recurse) CleanSIndex(idx->ChildIndex, TRUE); } - if (!(idx->ClFlags & SwitchTableMask)) { - restore_opcodes(idx->ClCode, NULL); + if (idx->SiblingIndex) { + idx->SiblingIndex = SIndexAdjust(idx->SiblingIndex); + /* use loop to avoid recursion with very complex indices */ + if (recurse) { + idx = idx->SiblingIndex; + goto beginning; + } } } From c1710974b8456c511a5b6df19c6e473732603717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Fri, 8 Oct 2010 12:21:49 +0100 Subject: [PATCH 2/3] fix bad comparison (Ulrich Neumerkel). --- C/cmppreds.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/C/cmppreds.c b/C/cmppreds.c index c37a83f40..757c64329 100644 --- a/C/cmppreds.c +++ b/C/cmppreds.c @@ -567,6 +567,8 @@ a_cmp(Term t1, Term t2) #ifdef USE_GMP } else if (IsBigIntTerm(t1)) { { + t2 = Yap_Eval(t2); + if (IsIntegerTerm(t2)) { return Yap_gmp_cmp_big_int(t1, IntegerOfTerm(t2)); } else if (IsFloatTerm(t2)) { From 8846ccbf01ba4bbb3d38e30ac6e61d37ce0bc38a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Fri, 8 Oct 2010 14:42:55 +0100 Subject: [PATCH 3/3] small fixes --- MYDDAS/myddas_odbc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MYDDAS/myddas_odbc.c b/MYDDAS/myddas_odbc.c index 8a5e23b06..f0e3f1db4 100755 --- a/MYDDAS/myddas_odbc.c +++ b/MYDDAS/myddas_odbc.c @@ -652,7 +652,7 @@ c_db_odbc_row(void) { if (!strcmp(AtomName(AtomOfTerm(type)),"integer")) { - if (!Yap_unify(head, MkIntegerTerm(atoi(bind_value)))) + if (!Yap_unify(head, MkIntegerTerm(atol(bind_value)))) continue; } else if (!strcmp(AtomName(AtomOfTerm(type)),"real")) @@ -697,6 +697,11 @@ c_db_odbc_number_of_fields_in_query(void) { return FALSE; if (!Yap_unify(arg_fields, MkIntegerTerm(number_cols))){ + if (!SQLCLOSECURSOR(hstmt,"db_number_of_fields_in_query")) + return FALSE; + if (!SQLFREESTMT(hstmt,SQL_CLOSE, "db_number_of_fields_in_query")) + return FALSE; + return FALSE; }