X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=rset%2Frsnull.c;h=29322afec84df42dee410d26ec9c290578d0d6af;hb=8d47d759a2e957ada235ab83bf877f2eb0d2ab99;hp=aacf61a396be5406807a886a01c9b1eb49f0f3ae;hpb=5660e317ea2972ea6bb6a4f8a415f71579f71103;p=idzebra-moved-to-github.git diff --git a/rset/rsnull.c b/rset/rsnull.c index aacf61a..29322af 100644 --- a/rset/rsnull.c +++ b/rset/rsnull.c @@ -1,4 +1,4 @@ -/* $Id: rsnull.c,v 1.20 2004-08-06 10:09:28 heikki Exp $ +/* $Id: rsnull.c,v 1.23 2004-08-26 11:11:59 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -27,19 +27,19 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -static void *r_create(RSET ct, const struct rset_control *sel, void *parms); +/* FIXME - Use the nmem instead of xmalloc all the way through */ + static RSFD r_open (RSET ct, int flag); static void r_close (RSFD rfd); static void r_delete (RSET ct); static void r_rewind (RSFD rfd); static void r_pos (RSFD rfd, double *current, double *total); -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 const struct rset_control control = { "null", - r_create, r_open, r_close, r_delete, @@ -52,28 +52,26 @@ static const struct rset_control control = const struct rset_control *rset_kind_null = &control; -static void *r_create(RSET ct, const struct rset_control *sel, void *parms) +RSET rsnull_create(NMEM nmem ) { - rset_null_parms *null_parms = (rset_null_parms *) parms; - - ct->no_rset_terms = 1; - ct->rset_terms = (RSET_TERM *) xmalloc (sizeof(*ct->rset_terms)); - if (parms && null_parms->rset_term) - ct->rset_terms[0] = null_parms->rset_term; - else - ct->rset_terms[0] = rset_term_create ("term", -1, "rank-0", - 0); - ct->rset_terms[0]->nn = 0; + RSET rnew=rset_create_base(&control, nmem); + rnew->priv=NULL; + return rnew; +} +#if 0 +static void *r_create(RSET ct, const struct rset_control *sel, void *parms) +{ return NULL; } +#endif static RSFD r_open (RSET ct, int flag) { if (flag & RSETF_WRITE) { - logf (LOG_FATAL, "NULL set type is read-only"); - return NULL; + logf (LOG_FATAL, "NULL set type is read-only"); + return NULL; } return ""; } @@ -84,13 +82,10 @@ static void r_close (RSFD rfd) static void r_delete (RSET ct) { - rset_term_destroy (ct->rset_terms[0]); - xfree (ct->rset_terms); } static void r_rewind (RSFD rfd) { - logf (LOG_DEBUG, "rsnull_rewind"); } static void r_pos (RSFD rfd, double *current, double *total) @@ -102,9 +97,8 @@ static void r_pos (RSFD rfd, double *current, double *total) *current=0; } -static int r_read (RSFD rfd, void *buf, int *term_index) +static int r_read (RSFD rfd, void *buf) { - *term_index = -1; return 0; }