X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=rset%2Frset.c;h=254ee0877d285630171df7e91aa7aeba1287868f;hb=375478a4799d7a1aefd08452f73f3d4f8d43438f;hp=901702a623d4316aeee2697f75a2297b69888dfe;hpb=9949fe7912e81ebf77d345a0581dc31a439bc2b8;p=idzebra-moved-to-github.git diff --git a/rset/rset.c b/rset/rset.c index 901702a..254ee08 100644 --- a/rset/rset.c +++ b/rset/rset.c @@ -1,5 +1,5 @@ -/* $Id: rset.c,v 1.18 2004-01-16 15:27:35 heikki Exp $ - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 +/* $Id: rset.c,v 1.24 2004-08-19 12:49:15 heikki Exp $ + Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps This file is part of the Zebra server. @@ -25,8 +25,10 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include #include +#include #include +#include <../index/index.h> /* for log_keydump. Debugging only */ RSET rset_create(const struct rset_control *sel, void *parms) { @@ -63,9 +65,37 @@ RSET rset_dup (RSET rs) return rs; } -int rset_default_forward(RSFD rfd, void *buf, const void *untilbuf) +void rset_default_pos (RSFD rfd, double *current, double *total) +{ /* This should never really be needed, but it is still used in */ + /* those rsets that we don't really plan to use, like isam-s */ + assert(rfd); + assert(current); + assert(total); + *current=-1; /* signal that pos is not implemented */ + *total=-1; +} /* rset_default_pos */ + +int rset_default_forward(RSET ct, RSFD rfd, void *buf, int *term_index, + int (*cmpfunc)(const void *p1, const void *p2), + const void *untilbuf) { - logf (LOG_FATAL, "rset_default-forward not yet implemented (%s)"); + int more=1; + int cmp=2; + logf (LOG_DEBUG, "rset_default_forward starting '%s' (ct=%p rfd=%p)", + ct->control->desc, ct,rfd); + key_logdump(LOG_DEBUG, untilbuf); + while ( (cmp==2) && (more)) + { + logf (LOG_DEBUG, "rset_default_forward looping m=%d c=%d",more,cmp); + more=rset_read(ct, rfd, buf, term_index); + if (more) + cmp=(*cmpfunc)(untilbuf,buf); + if (more) + key_logdump(LOG_DEBUG,buf); + } + logf (LOG_DEBUG, "rset_default_forward exiting m=%d c=%d",more,cmp); + + return more; } RSET_TERM *rset_terms(RSET rs, int *no) @@ -100,9 +130,11 @@ RSET_TERM rset_term_create (const char *name, int length, const char *flags, void rset_term_destroy (RSET_TERM t) { - xfree (t->name); - xfree (t->flags); - xfree (t); + if (t) { /* rsmultior uses things without terms at all ! */ + xfree (t->name); + xfree (t->flags); + xfree (t); + } } RSET_TERM rset_term_dup (RSET_TERM t)