From 1285f0f6eeb151a62b69d8d3381c54ace03e55d4 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 7 Jun 2005 07:41:04 +0000 Subject: [PATCH] Make a copy of ord(inals) in rset_term_create. --- include/rset.h | 6 +++++- index/zrpn.c | 16 +--------------- rset/rset.c | 26 ++++++++++++++++++++++++-- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/include/rset.h b/include/rset.h index 7fc3c95..b37becc 100644 --- a/include/rset.h +++ b/include/rset.h @@ -1,4 +1,4 @@ -/* $Id: rset.h,v 1.54 2005-06-06 21:31:08 adam Exp $ +/* $Id: rset.h,v 1.55 2005-06-07 07:41:04 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -40,6 +40,10 @@ struct ord_list { struct ord_list *next; }; +struct ord_list *ord_list_create(NMEM nmem); +struct ord_list *ord_list_append(NMEM nmem, struct ord_list *list, int ord); +struct ord_list *ord_list_dup(NMEM nmem, struct ord_list *list); + /** * rset_term is all we need to know of a term to do ranking etc. * As far as the rsets are concerned, it is just a dummy pointer to diff --git a/index/zrpn.c b/index/zrpn.c index ce55c6e..4b39270 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -1,4 +1,4 @@ -/* $Id: zrpn.c,v 1.195 2005-06-06 21:31:08 adam Exp $ +/* $Id: zrpn.c,v 1.196 2005-06-07 07:41:05 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -50,20 +50,6 @@ typedef struct Z_AttributesPlusTerm *zapt; } AttrType; -static struct ord_list *ord_list_create(NMEM nmem) -{ - return 0; -} - -static struct ord_list *ord_list_append(NMEM nmem, struct ord_list *list, - int ord) -{ - struct ord_list *n = nmem_malloc(nmem, sizeof(*n)); - n->ord = ord; - n->next = list; - return n; -} - static int log_level_set = 0; static int log_level_rpn = 0; diff --git a/rset/rset.c b/rset/rset.c index c825bf0..c7821d3 100644 --- a/rset/rset.c +++ b/rset/rset.c @@ -1,4 +1,4 @@ -/* $Id: rset.c,v 1.48 2005-06-06 21:31:09 adam Exp $ +/* $Id: rset.c,v 1.49 2005-06-07 07:41:05 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -277,6 +277,28 @@ void rset_get_one_term(RSET ct, TERMID *terms, int maxterms, int *curterm) } } +struct ord_list *ord_list_create(NMEM nmem) +{ + return 0; +} + +struct ord_list *ord_list_append(NMEM nmem, struct ord_list *list, + int ord) +{ + struct ord_list *n = nmem_malloc(nmem, sizeof(*n)); + n->ord = ord; + n->next = list; + return n; +} + +struct ord_list *ord_list_dup(NMEM nmem, struct ord_list *list) +{ + struct ord_list *n = ord_list_create(nmem); + for (; list; list = list->next) + n = ord_list_append(nmem, n, list->ord); + return n; +} + /** \brief Creates a TERMID entry. \param name Term/Name buffer with given length @@ -311,7 +333,7 @@ TERMID rset_term_create(const char *name, int length, const char *flags, t->type = type; t->rankpriv = 0; t->rset = 0; - t->ol = ol; + t->ol = ord_list_dup(nmem, ol); return t; } -- 1.7.10.4