X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=index%2Ftrunc.c;h=689415c08047652cf5d32d7a3781aa710d67744d;hb=3c67867986bf92288ae3b56d6fd5d39404fa7b7a;hp=261685e0b991ad3177f099294d3520b251a0943a;hpb=f7e93f016e75e43d037b5c3e89aeb27b7176513a;p=idzebra-moved-to-github.git diff --git a/index/trunc.c b/index/trunc.c index 261685e..689415c 100644 --- a/index/trunc.c +++ b/index/trunc.c @@ -1,4 +1,4 @@ -/* $Id: trunc.c,v 1.31 2004-08-06 13:14:46 adam Exp $ +/* $Id: trunc.c,v 1.33 2004-08-11 13:35:04 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -326,11 +326,13 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, key_compare_it); for (i = to-from; --i >= 0; ) { - ispt[i] = isamb_pp_open (zi->reg->isamb, isam_p[from+i]); - if (isamb_pp_read (ispt[i], ti->tmpbuf)) - heap_insert (ti, ti->tmpbuf, i); - else - isamb_pp_close (ispt[i]); + if (isam_p[from+i]) { + ispt[i] = isamb_pp_open (zi->reg->isamb, isam_p[from+i]); + if (isamb_pp_read (ispt[i], ti->tmpbuf)) + heap_insert (ti, ti->tmpbuf, i); + else + isamb_pp_close (ispt[i]); + } } while (ti->heapnum) { @@ -393,12 +395,11 @@ static int isamc_trunc_cmp (const void *p1, const void *p2) { ISAMC_P i1 = *(ISAMC_P*) p1; ISAMC_P i2 = *(ISAMC_P*) p2; - int d; + zint d; - d = (int) (isc_type (i1) - isc_type (i2)); - if (d) - return d; - d = isc_block (i1) - isc_block (i2); + d = (isc_type (i1) - isc_type (i2)); + if (d == 0) + d = isc_block (i1) - isc_block (i2); if (d > 0) return 1; else if (d < 0)