From f091b701a8326e533f4877e755ec561e109b47b9 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 13 Jan 2003 22:37:12 +0000 Subject: [PATCH] Do not use readdir_r --- index/dir.c | 10 ++-------- index/rank1.c | 15 ++++++++++----- index/zsets.c | 4 +++- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/index/dir.c b/index/dir.c index 412620e..868740e 100644 --- a/index/dir.c +++ b/index/dir.c @@ -1,4 +1,4 @@ -/* $Id: dir.c,v 1.27 2002-10-30 12:58:21 adam Exp $ +/* $Id: dir.c,v 1.28 2003-01-13 22:37:12 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -79,13 +79,7 @@ struct dir_entry *dir_open (const char *rep, const char *base, pathpos = strlen(path); if (!pathpos || path[pathpos-1] != '/') path[pathpos++] = '/'; - while ( -#if _REENTRANT - (readdir_r (dir, &dent_s, &dent) == 0 && dent) -#else - (dent = readdir (dir)) -#endif - ) + while ( (dent = readdir (dir)) ) { struct stat finfo; if (strcmp (dent->d_name, ".") == 0 || diff --git a/index/rank1.c b/index/rank1.c index f968e81..1d12085 100644 --- a/index/rank1.c +++ b/index/rank1.c @@ -1,4 +1,4 @@ -/* $Id: rank1.c,v 1.10 2002-08-02 19:26:55 adam Exp $ +/* $Id: rank1.c,v 1.11 2003-01-13 22:37:12 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -96,7 +96,7 @@ static void *begin (struct zebra_register *reg, void *class_handle, RSET rset) struct rank_set_info *si = (struct rank_set_info *) xmalloc (sizeof(*si)); int i; - logf (LOG_DEBUG, "rank-1 begin"); + logf (LOG_LOG, "rank-1 begin"); si->no_entries = rset->no_rset_terms; si->no_rank_entries = 0; si->entries = (struct rank_term_info *) @@ -104,12 +104,12 @@ static void *begin (struct zebra_register *reg, void *class_handle, RSET rset) for (i = 0; i < si->no_entries; i++) { int g = rset->rset_terms[i]->nn; + yaz_log(LOG_LOG, "i=%d flags=%s", i, rset->rset_terms[i]->flags); if (!strncmp (rset->rset_terms[i]->flags, "rank,", 5)) { - yaz_log (LOG_LOG, "%s", rset->rset_terms[i]->flags); si->entries[i].rank_flag = 1; si->entries[i].rank_weight = atoi (rset->rset_terms[i]->flags+5); - yaz_log (LOG_LOG, "i=%d weight=%d", i, si->entries[i].rank_weight); + yaz_log (LOG_LOG, " weight=%d", i, si->entries[i].rank_weight); (si->no_rank_entries)++; } else @@ -142,7 +142,7 @@ static void end (struct zebra_register *reg, void *set_handle) static void add (void *set_handle, int seqno, int term_index) { struct rank_set_info *si = (struct rank_set_info *) set_handle; - /*logf (LOG_DEBUG, "rank-1 add seqno=%d term_index=%d", seqno, term_index);*/ + yaz_log (LOG_LOG, "rank-1 add seqno=%d term_index=%d", seqno, term_index); si->last_pos = seqno; si->entries[term_index].local_occur++; } @@ -161,10 +161,15 @@ static int calc (void *set_handle, int sysno) if (!si->no_rank_entries) return -1; + yaz_log(LOG_LOG, "calc"); for (i = 0; i < si->no_entries; i++) + { + yaz_log(LOG_LOG, "i=%d rank_flag=%d lo=%d", + i, si->entries[i].rank_flag, si->entries[i].local_occur); if (si->entries[i].rank_flag && (lo = si->entries[i].local_occur)) score += (8+log2_int (lo)) * si->entries[i].global_inv * si->entries[i].rank_weight; + } divisor = si->no_rank_entries * (8+log2_int (si->last_pos/si->no_entries)); score = score / divisor; yaz_log (LOG_LOG, "sysno=%d score=%d", sysno, score); diff --git a/index/zsets.c b/index/zsets.c index c23c572..17c7de6 100644 --- a/index/zsets.c +++ b/index/zsets.c @@ -1,4 +1,4 @@ -/* $Id: zsets.c,v 1.39 2002-08-28 19:52:29 adam Exp $ +/* $Id: zsets.c,v 1.40 2003-01-13 22:37:12 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -730,6 +730,8 @@ void resultSetRank (ZebraHandle zh, ZebraSet zebraSet, RSET rset) do { kno++; + yaz_log(LOG_LOG, "sysno=%d seqno=%d idx=%d", key.sysno, key.seqno, + term_index); if (key.sysno != psysno) { score = (*rc->calc) (handle, psysno); -- 1.7.10.4