From d19cf8bef834f49f2b722ce4eb9e279e9466faed Mon Sep 17 00:00:00 2001 From: vsc Date: Tue, 31 May 2005 20:04:17 +0000 Subject: [PATCH] fix cleanup of expand_clauses: make sure we have everything with NULL afterwards. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1317 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/index.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/C/index.c b/C/index.c index 0d98c941d..11864ef72 100644 --- a/C/index.c +++ b/C/index.c @@ -11,8 +11,12 @@ * File: index.c * * comments: Indexing a Prolog predicate * * * -* Last rev: $Date: 2005-05-31 19:42:27 $,$Author: vsc $ * +* Last rev: $Date: 2005-05-31 20:04:17 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.131 2005/05/31 19:42:27 vsc +* insert some more slack for indices in LU +* Use doubly linked list for LU indices so that updating is less cumbersome. +* * Revision 1.130 2005/05/31 04:46:06 vsc * fix expand_index on tabled code. * @@ -6537,11 +6541,17 @@ compacta_expand_clauses(yamop *ipc) ptr = end = start+ipc->u.sp.s1; - while (--ptr > start) { - yamop *next = *ptr; + while (ptr > start) { + yamop *next = *--ptr; if (next) *--end = next; } - return ptr+1 != end; + if (ptr != end) { + while (end > start) { + *--end = NULL; + } + return TRUE; + } + return FALSE; } static int @@ -6559,7 +6569,14 @@ compactz_expand_clauses(yamop *ipc) yamop *next = *ptr++; if (next) *start++ = next; } - return ptr != start; + /* reset empty slots at end */ + if (start != end) { + while (start < end) { + *start++ = NULL; + } + return TRUE; + } + return FALSE; } /* this code should be called when we jumped to clauses */