X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;ds=sidebyside;f=rset%2Frstemp.c;h=0a3b5829d98cd77ddf4f3dc6b5dc5135c13ccd67;hb=863d336f803da454e03f39ee2225719fed05021e;hp=7b5420da630518dde5be4c2326536947340a1f2d;hpb=4da0cd2978c9a902be772e95302e6522175402fd;p=idzebra-moved-to-github.git diff --git a/rset/rstemp.c b/rset/rstemp.c index 7b5420d..0a3b582 100644 --- a/rset/rstemp.c +++ b/rset/rstemp.c @@ -1,4 +1,4 @@ -/* $Id: rstemp.c,v 1.39 2004-08-06 09:43:04 heikki Exp $ +/* $Id: rstemp.c,v 1.43 2004-08-20 14:44:46 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -40,9 +40,9 @@ static void r_close (RSFD rfd); static void r_delete (RSET ct); static void r_rewind (RSFD rfd); /* static int r_count (RSET ct);*/ -static int r_read (RSFD rfd, void *buf, int *term_index); +static int r_read (RSFD rfd, void *buf); static int r_write (RSFD rfd, const void *buf); -static void r_pos (RSFD rfd, zint *current, zint *total); +static void r_pos (RSFD rfd, double *current, double *total); static const struct rset_control control = { @@ -79,7 +79,7 @@ struct rset_temp_info { struct rset_temp_rfd { struct rset_temp_info *info; struct rset_temp_rfd *next; - int *countp; + zint *countp; void *buf; size_t pos_cur; /* current position in set */ zint cur; /* number of the current hit */ @@ -104,15 +104,12 @@ static void *r_create(RSET ct, const struct rset_control *sel, void *parms) info->rfd_list = NULL; if (!temp_parms->temp_path) - info->temp_path = NULL; + info->temp_path = NULL; else { - info->temp_path = (char *) xmalloc (strlen(temp_parms->temp_path)+1); - strcpy (info->temp_path, temp_parms->temp_path); + info->temp_path = (char *) xmalloc (strlen(temp_parms->temp_path)+1); + strcpy (info->temp_path, temp_parms->temp_path); } - ct->no_rset_terms = 1; - ct->rset_terms = (RSET_TERM *) xmalloc (sizeof(*ct->rset_terms)); - ct->rset_terms[0] = temp_parms->rset_term; return info; } @@ -140,7 +137,6 @@ static RSFD r_open (RSET ct, int flag) rfd->info = info; r_rewind (rfd); - rfd->countp = &ct->rset_terms[0]->count; *rfd->countp = 0; rfd->buf = xmalloc (info->key_size); @@ -190,7 +186,7 @@ static void r_flush (RSFD rfd, int mk) if (info->fname && info->fd != -1 && info->dirty) { size_t count; - int r; + int r; if (lseek (info->fd, info->pos_buf, SEEK_SET) == -1) { @@ -253,9 +249,7 @@ static void r_delete (RSET ct) xfree (info->fname); } if (info->temp_path) - xfree (info->temp_path); - rset_term_destroy (ct->rset_terms[0]); - xfree (ct->rset_terms); + xfree (info->temp_path); xfree (info); } @@ -270,7 +264,7 @@ static void r_reread (RSFD rfd) if (info->fname) { size_t count; - int r; + int r; info->pos_border = ((struct rset_temp_rfd *)rfd)->pos_cur + info->buf_size; @@ -318,7 +312,7 @@ static int r_count (RSET ct) return info->pos_end / info->key_size; } */ -static int r_read (RSFD rfd, void *buf, int *term_index) +static int r_read (RSFD rfd, void *buf) { struct rset_temp_rfd *mrfd = (struct rset_temp_rfd*) rfd; struct rset_temp_info *info = mrfd->info; @@ -336,7 +330,6 @@ static int r_read (RSFD rfd, void *buf, int *term_index) memcpy (buf, info->buf_mem + (mrfd->pos_cur - info->pos_buf), info->key_size); mrfd->pos_cur = nc; - *term_index = 0; if (*mrfd->countp == 0 || (*info->cmp)(buf, mrfd->buf) > 1) { @@ -371,9 +364,9 @@ static int r_write (RSFD rfd, const void *buf) return 1; } -static void r_pos (RSFD rfd, zint *current, zint *total) +static void r_pos (RSFD rfd, double *current, double *total) { struct rset_temp_rfd *mrfd = (struct rset_temp_rfd*) rfd; - *current=mrfd->cur; - *total=mrfd->info->hits; + *current=(double) mrfd->cur; + *total=(double) mrfd->info->hits; }