From b3af54f7bf58db2a5d85b6a54b720bf6c5359c1f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 21 Nov 2006 22:17:49 +0000 Subject: [PATCH] Get rid of SYSNO which is zint anyway. Removed various prototypes of unused/undefined functions. --- include/idzebra/api.h | 11 ++++---- include/idzebra/util.h | 16 ++++------- include/sortidx.h | 14 +++++----- index/dirs.c | 4 +-- index/extract.c | 71 ++++++++++++++++++++++++------------------------ index/index.h | 27 ++++++------------ index/key_block.c | 9 +++--- index/key_block.h | 6 ++-- index/recindex.c | 26 +++++++++--------- index/recindex.h | 8 +++--- index/reckeys.c | 7 +++-- index/reckeys.h | 5 +++- index/retrieve.c | 8 +++--- index/sortidx.c | 10 +++---- index/symtab.c | 4 +-- index/update_file.c | 28 +++++++++---------- index/zebraapi.c | 38 +++++++++++++------------- index/zebrash.c | 4 +-- index/zebrasrv.c | 6 ++-- index/zinfo.c | 14 +++++----- test/api/t13.c | 4 +-- 21 files changed, 154 insertions(+), 166 deletions(-) diff --git a/include/idzebra/api.h b/include/idzebra/api.h index d01ce21..4f0dec6 100644 --- a/include/idzebra/api.h +++ b/include/idzebra/api.h @@ -1,4 +1,4 @@ -/* $Id: api.h,v 1.40 2006-11-14 08:12:07 adam Exp $ +/* $Id: api.h,v 1.41 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -57,7 +57,7 @@ typedef struct { int len; /* length */ oid_value format; /* record syntax */ char *base; - SYSNO sysno; + zint sysno; int score; } ZebraRetrievalRecord; @@ -393,21 +393,22 @@ ZEBRA_RES zebra_add_record(ZebraHandle zh, const char *buf, int buf_size); YAZ_EXPORT ZEBRA_RES zebra_insert_record(ZebraHandle zh, const char *recordType, - SYSNO *sysno, const char *match, + zint *sysno, const char *match, const char *fname, const char *buf, int buf_size, int force_update); YAZ_EXPORT ZEBRA_RES zebra_update_record(ZebraHandle zh, const char *recordType, - SYSNO *sysno, const char *match, + zint *sysno, const char *match, const char *fname, const char *buf, int buf_size, int force_update); YAZ_EXPORT ZEBRA_RES zebra_delete_record(ZebraHandle zh, const char *recordType, - SYSNO *sysno, const char *match, const char *fname, + zint *sysno, const char *match, + const char *fname, const char *buf, int buf_size, int force_update); diff --git a/include/idzebra/util.h b/include/idzebra/util.h index 1e35164..d8f314c 100644 --- a/include/idzebra/util.h +++ b/include/idzebra/util.h @@ -1,4 +1,4 @@ -/* $Id: util.h,v 1.10 2006-11-14 08:12:07 adam Exp $ +/* $Id: util.h,v 1.11 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -91,19 +91,13 @@ typedef short ZEBRA_RES; #define ZEBRA_FAIL -1 #define ZEBRA_OK 0 -typedef zint SYSNO; +YAZ_EXPORT zint atoi_zn(const char *buf, zint len); -YAZ_EXPORT -zint atoi_zn (const char *buf, zint len); +YAZ_EXPORT void zebra_zint_encode(char **dst, zint pos); -YAZ_EXPORT -void zebra_zint_encode(char **dst, zint pos); +YAZ_EXPORT void zebra_zint_decode(const char **src, zint *pos); -YAZ_EXPORT -void zebra_zint_decode(const char **src, zint *pos); - -YAZ_EXPORT -void zebra_exit(const char *msg); +YAZ_EXPORT void zebra_exit(const char *msg); YAZ_END_CDECL diff --git a/include/sortidx.h b/include/sortidx.h index f4fdde7..6ee16c4 100644 --- a/include/sortidx.h +++ b/include/sortidx.h @@ -1,4 +1,4 @@ -/* $Id: sortidx.h,v 1.10 2006-08-14 10:40:12 adam Exp $ +/* $Id: sortidx.h,v 1.11 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -33,12 +33,12 @@ YAZ_BEGIN_CDECL typedef struct sortIdx *SortIdx; -SortIdx sortIdx_open (BFiles bfs, int write_flag); -void sortIdx_close (SortIdx si); -int sortIdx_type (SortIdx si, int type); -void sortIdx_sysno (SortIdx si, SYSNO sysno); -void sortIdx_add (SortIdx si, const char *buf, int len); -void sortIdx_read (SortIdx si, char *buf); +SortIdx sortIdx_open(BFiles bfs, int write_flag); +void sortIdx_close(SortIdx si); +int sortIdx_type(SortIdx si, int type); +void sortIdx_sysno(SortIdx si, zint sysno); +void sortIdx_add(SortIdx si, const char *buf, int len); +void sortIdx_read(SortIdx si, char *buf); YAZ_END_CDECL diff --git a/index/dirs.c b/index/dirs.c index 186f477..c960a1b 100644 --- a/index/dirs.c +++ b/index/dirs.c @@ -1,4 +1,4 @@ -/* $Id: dirs.c,v 1.25 2006-08-14 10:40:15 adam Exp $ +/* $Id: dirs.c,v 1.26 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -186,7 +186,7 @@ void dirs_rmdir (struct dirs_info *p, const char *src) dict_delete (p->dict, path); } -void dirs_add (struct dirs_info *p, const char *src, SYSNO sysno, time_t mtime) +void dirs_add (struct dirs_info *p, const char *src, zint sysno, time_t mtime) { char path[DIRS_MAX_PATH]; char info[16]; diff --git a/index/extract.c b/index/extract.c index 0cea5a7..bad3586 100644 --- a/index/extract.c +++ b/index/extract.c @@ -1,4 +1,4 @@ -/* $Id: extract.c,v 1.240 2006-11-21 17:48:08 adam Exp $ +/* $Id: extract.c,v 1.241 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -51,11 +51,11 @@ static void zebra_init_log_level(void) } } -static void extract_flushRecordKeys (ZebraHandle zh, SYSNO sysno, - int cmd, zebra_rec_keys_t reckeys, - zint staticrank); -static void extract_flushSortKeys (ZebraHandle zh, SYSNO sysno, - int cmd, zebra_rec_keys_t skp); +static void extract_flush_record_keys(ZebraHandle zh, zint sysno, + int cmd, zebra_rec_keys_t reckeys, + zint staticrank); +static void extract_flush_sort_keys(ZebraHandle zh, zint sysno, + int cmd, zebra_rec_keys_t skp); static void extract_schema_add (struct recExtractCtrl *p, Odr_oid *oid); static void extract_token_add (RecWord *p); @@ -139,9 +139,9 @@ static void searchRecordKey(ZebraHandle zh, #define FILE_MATCH_BLANK "\t " -static char *fileMatchStr (ZebraHandle zh, - zebra_rec_keys_t reckeys, - const char *fname, const char *spec) +static char *get_match_from_spec(ZebraHandle zh, + zebra_rec_keys_t reckeys, + const char *fname, const char *spec) { static char dstBuf[2048]; /* static here ??? */ char *dst = dstBuf; @@ -309,7 +309,7 @@ static void all_matches_add(struct recExtractCtrl *ctrl) "", 0); } -ZEBRA_RES zebra_extract_file(ZebraHandle zh, SYSNO *sysno, const char *fname, +ZEBRA_RES zebra_extract_file(ZebraHandle zh, zint *sysno, const char *fname, int deleteFlag) { ZEBRA_RES r = ZEBRA_OK; @@ -443,7 +443,7 @@ ZEBRA_RES zebra_buffer_extract_record(ZebraHandle zh, int delete_flag, int test_mode, const char *recordType, - SYSNO *sysno, + zint *sysno, const char *match_criteria, const char *fname, int force_update, @@ -505,7 +505,7 @@ ZEBRA_RES zebra_extract_record_stream(ZebraHandle zh, int delete_flag, int test_mode, const char *recordType, - SYSNO *sysno, + zint *sysno, const char *match_criteria, const char *fname, int force_update, @@ -514,7 +514,7 @@ ZEBRA_RES zebra_extract_record_stream(ZebraHandle zh, void *recTypeClientData) { - SYSNO sysno0 = 0; + zint sysno0 = 0; RecordAttr *recordAttr; struct recExtractCtrl extractCtrl; int r; @@ -593,11 +593,11 @@ ZEBRA_RES zebra_extract_record_stream(ZebraHandle zh, matchStr = match_criteria; } else { if (zh->m_record_id && *zh->m_record_id) { - matchStr = fileMatchStr (zh, zh->reg->keys, pr_fname, - zh->m_record_id); + matchStr = get_match_from_spec(zh, zh->reg->keys, pr_fname, + zh->m_record_id); if (!matchStr) { - yaz_log (YLOG_WARN, "Bad match criteria (recordID)"); + yaz_log(YLOG_WARN, "Bad match criteria (recordID)"); return ZEBRA_FAIL; } } @@ -649,10 +649,9 @@ ZEBRA_RES zebra_extract_record_stream(ZebraHandle zh, sizeof(*sysno), sysno); } - - extract_flushSortKeys (zh, *sysno, 1, zh->reg->sortKeys); - extract_flushRecordKeys (zh, *sysno, 1, zh->reg->keys, - recordAttr->staticrank); + extract_flush_sort_keys(zh, *sysno, 1, zh->reg->sortKeys); + extract_flush_record_keys(zh, *sysno, 1, zh->reg->keys, + recordAttr->staticrank); zh->records_inserted++; } else @@ -682,9 +681,9 @@ ZEBRA_RES zebra_extract_record_stream(ZebraHandle zh, rec->size[recInfo_sortKeys], 0); - extract_flushSortKeys (zh, *sysno, 0, sortKeys); - extract_flushRecordKeys (zh, *sysno, 0, delkeys, - recordAttr->staticrank); + extract_flush_sort_keys(zh, *sysno, 0, sortKeys); + extract_flush_record_keys(zh, *sysno, 0, delkeys, + recordAttr->staticrank); if (delete_flag) { /* record going to be deleted */ @@ -718,9 +717,9 @@ ZEBRA_RES zebra_extract_record_stream(ZebraHandle zh, yaz_log(YLOG_LOG, "update %s %s " ZINT_FORMAT, recordType, pr_fname, (zint) ZINT_FORMAT); recordAttr->staticrank = extractCtrl.staticrank; - extract_flushSortKeys (zh, *sysno, 1, zh->reg->sortKeys); - extract_flushRecordKeys (zh, *sysno, 1, zh->reg->keys, - recordAttr->staticrank); + extract_flush_sort_keys(zh, *sysno, 1, zh->reg->sortKeys); + extract_flush_record_keys(zh, *sysno, 1, zh->reg->keys, + recordAttr->staticrank); zh->records_updated++; } zebra_rec_keys_close(delkeys); @@ -863,19 +862,19 @@ ZEBRA_RES zebra_extract_explain(void *handle, Record rec, data1_node *n) zebra_rec_keys_set_buf(delkeys, rec->info[recInfo_delKeys], rec->size[recInfo_delKeys], 0); - extract_flushRecordKeys (zh, rec->sysno, 0, delkeys, 0); + extract_flush_record_keys(zh, rec->sysno, 0, delkeys, 0); zebra_rec_keys_close(delkeys); zebra_rec_keys_set_buf(sortkeys, rec->info[recInfo_sortKeys], rec->size[recInfo_sortKeys], 0); - extract_flushSortKeys (zh, rec->sysno, 0, sortkeys); + extract_flush_sort_keys(zh, rec->sysno, 0, sortkeys); zebra_rec_keys_close(sortkeys); } - extract_flushRecordKeys (zh, rec->sysno, 1, zh->reg->keys, 0); - extract_flushSortKeys (zh, rec->sysno, 1, zh->reg->sortKeys); - + extract_flush_record_keys(zh, rec->sysno, 1, zh->reg->keys, 0); + extract_flush_sort_keys(zh, rec->sysno, 1, zh->reg->sortKeys); + xfree (rec->info[recInfo_delKeys]); zebra_rec_keys_get_buf(zh->reg->keys, &rec->info[recInfo_delKeys], @@ -1004,9 +1003,9 @@ void extract_rec_keys_adjust(ZebraHandle zh, int is_insert, } } -void extract_flushRecordKeys(ZebraHandle zh, SYSNO sysno, int cmd, - zebra_rec_keys_t reckeys, - zint staticrank) +void extract_flush_record_keys(ZebraHandle zh, zint sysno, int cmd, + zebra_rec_keys_t reckeys, + zint staticrank) { ZebraExplainInfo zei = zh->reg->zei; @@ -1347,8 +1346,8 @@ static void extract_schema_add(struct recExtractCtrl *p, Odr_oid *oid) zebraExplain_addSchema (zh->reg->zei, oid); } -void extract_flushSortKeys(ZebraHandle zh, SYSNO sysno, - int cmd, zebra_rec_keys_t reckeys) +void extract_flush_sort_keys(ZebraHandle zh, zint sysno, + int cmd, zebra_rec_keys_t reckeys) { if (zebra_rec_keys_rewind(reckeys)) { diff --git a/index/index.h b/index/index.h index cf13c2d..8f5b3fe 100644 --- a/index/index.h +++ b/index/index.h @@ -1,4 +1,4 @@ -/* $Id: index.h,v 1.182 2006-11-21 14:32:38 adam Exp $ +/* $Id: index.h,v 1.183 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -66,7 +66,7 @@ struct dir_entry { struct dirs_entry { enum dirsKind kind; char path[256]; - SYSNO sysno; + zint sysno; time_t mtime; }; @@ -78,12 +78,12 @@ struct dirs_entry *dirs_read(struct dirs_info *p); struct dirs_entry *dirs_last(struct dirs_info *p); void dirs_mkdir(struct dirs_info *p, const char *src, time_t mtime); void dirs_rmdir(struct dirs_info *p, const char *src); -void dirs_add(struct dirs_info *p, const char *src, SYSNO sysno, time_t mtime); +void dirs_add(struct dirs_info *p, const char *src, zint sysno, time_t mtime); void dirs_del(struct dirs_info *p, const char *src); void dirs_free(struct dirs_info **pp); struct dir_entry *dir_open(const char *rep, const char *base, - int follow_links); + int follow_links); void dir_sort(struct dir_entry *e); void dir_free(struct dir_entry **e_p); @@ -107,17 +107,6 @@ ISAMC_M *key_isamc_m(Res res, ISAMC_M *me); #define GMATCH_DICT "gmatch" #define FMATCH_DICT "fmatch%d" -struct strtab *strtab_mk(void); -int strtab_src(struct strtab *t, const char *name, void ***infop); -void strtab_del(struct strtab *t, - void (*func)(const char *name, void *info, void *data), - void *data); - -void zebraIndexLockMsg(ZebraHandle zh, const char *str); -void zebraIndexUnlock(ZebraHandle zh); -int zebraIndexLock(BFiles bfs, ZebraHandle zh, int commitNow, const char *rval); -int zebraIndexWait(ZebraHandle zh, int commitPhase); - void zebra_lock_prefix(Res res, char *dst); #define FNAME_MAIN_LOCK "zebraidx.LCK" @@ -308,7 +297,7 @@ ZEBRA_RES resultSetRank(ZebraHandle zh, ZebraSet zebraSet, RSET rset, NMEM nmem); void resultSetInvalidate(ZebraHandle zh); -int zebra_record_fetch(ZebraHandle zh, SYSNO sysno, int score, +int zebra_record_fetch(ZebraHandle zh, zint sysno, int score, zebra_snippets *hit_snippet, ODR stream, oid_value input_format, Z_RecordComposition *comp, oid_value *output_format, char **rec_bufp, @@ -324,7 +313,7 @@ ZEBRA_RES zebra_buffer_extract_record(ZebraHandle zh, int delete_flag, int test_mode, const char *recordType, - SYSNO *sysno, + zint *sysno, const char *match_criteria, const char *fname, int force_update, @@ -335,7 +324,7 @@ ZEBRA_RES zebra_extract_record_stream(ZebraHandle zh, int delete_flag, int test_mode, const char *recordType, - SYSNO *sysno, + zint *sysno, const char *match_criteria, const char *fname, int force_update, @@ -356,7 +345,7 @@ ZEBRA_RES zebra_snippets_hit_vector(ZebraHandle zh, const char *setname, ZEBRA_RES zebra_extract_explain(void *handle, Record rec, data1_node *n); -ZEBRA_RES zebra_extract_file(ZebraHandle zh, SYSNO *sysno, const char *fname, +ZEBRA_RES zebra_extract_file(ZebraHandle zh, zint *sysno, const char *fname, int deleteFlag); ZEBRA_RES zebra_begin_read(ZebraHandle zh); diff --git a/index/key_block.c b/index/key_block.c index 375e2c6..e9e8fdb 100644 --- a/index/key_block.c +++ b/index/key_block.c @@ -1,4 +1,4 @@ -/* $Id: key_block.c,v 1.3 2006-11-21 17:48:08 adam Exp $ +/* $Id: key_block.c,v 1.4 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include +#include #include #include @@ -29,9 +30,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #endif -#include -#include "index.h" #include "key_block.h" +#include +#include struct zebra_key_block { char **key_buf; @@ -245,7 +246,7 @@ void key_block_destroy(zebra_key_block_t *pp) } } -void key_block_write(zebra_key_block_t p, SYSNO sysno, struct it_key *key_in, +void key_block_write(zebra_key_block_t p, zint sysno, struct it_key *key_in, int cmd, const char *str_buf, size_t str_len, zint staticrank, int static_rank_enable) { diff --git a/index/key_block.h b/index/key_block.h index 378c462..b590e05 100644 --- a/index/key_block.h +++ b/index/key_block.h @@ -1,4 +1,4 @@ -/* $Id: key_block.h,v 1.2 2006-11-21 17:48:08 adam Exp $ +/* $Id: key_block.h,v 1.3 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #ifndef ZEBRA_KEY_BLOCK_H #define ZEBRA_KEY_BLOCK_H +#include "it_key.h" + YAZ_BEGIN_CDECL typedef struct zebra_key_block *zebra_key_block_t; @@ -31,7 +33,7 @@ zebra_key_block_t key_block_create(int mem, const char *key_tmp_dir, int use_threads); void key_block_destroy(zebra_key_block_t *pp); void key_block_flush(zebra_key_block_t p, int is_final); -void key_block_write(zebra_key_block_t p, SYSNO sysno, struct it_key *key_in, +void key_block_write(zebra_key_block_t p, zint sysno, struct it_key *key_in, int cmd, const char *str_buf, size_t str_len, zint staticrank, int static_rank_enable); int key_block_get_no_files(zebra_key_block_t p); diff --git a/index/recindex.c b/index/recindex.c index 3280dfc..00c9c95 100644 --- a/index/recindex.c +++ b/index/recindex.c @@ -1,4 +1,4 @@ -/* $Id: recindex.c,v 1.53 2006-11-14 08:12:08 adam Exp $ +/* $Id: recindex.c,v 1.54 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -61,13 +61,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define USUAL_RANGE 2000000000LL #endif -static SYSNO rec_sysno_to_ext(SYSNO sysno) +static zint rec_sysno_to_ext(zint sysno) { assert(sysno >= 0 && sysno <= USUAL_RANGE); return sysno + FAKE_OFFSET; } -SYSNO rec_sysno_to_int(SYSNO sysno) +zint rec_sysno_to_int(zint sysno) { assert(sysno >= FAKE_OFFSET && sysno <= FAKE_OFFSET + USUAL_RANGE); return sysno - FAKE_OFFSET; @@ -101,7 +101,7 @@ static void rec_tmp_expand(Records p, int size) } } -static int read_indx(Records p, SYSNO sysno, void *buf, int itemsize, +static int read_indx(Records p, zint sysno, void *buf, int itemsize, int ignoreError) { int r; @@ -124,7 +124,7 @@ static int read_indx(Records p, SYSNO sysno, void *buf, int itemsize, return r; } -static void write_indx(Records p, SYSNO sysno, void *buf, int itemsize) +static void write_indx(Records p, zint sysno, void *buf, int itemsize) { zint pos = (sysno-1)*itemsize; int off = CAST_ZINT_TO_INT(pos%RIDX_CHUNK); @@ -139,7 +139,7 @@ static void write_indx(Records p, SYSNO sysno, void *buf, int itemsize) (char*) buf + sz1); } -static ZEBRA_RES rec_release_blocks(Records p, SYSNO sysno) +static ZEBRA_RES rec_release_blocks(Records p, zint sysno) { struct record_index_entry entry; zint freeblock; @@ -212,7 +212,7 @@ static ZEBRA_RES rec_delete_single(Records p, Record rec) return ZEBRA_OK; } -static ZEBRA_RES rec_write_tmp_buf(Records p, int size, SYSNO *sysnos) +static ZEBRA_RES rec_write_tmp_buf(Records p, int size, zint *sysnos) { struct record_index_entry entry; int no_written = 0; @@ -484,8 +484,8 @@ static ZEBRA_RES rec_write_multiple(Records p, int saveCount) int out_size = 1000; int out_offset = 0; char *out_buf = (char *) xmalloc(out_size); - SYSNO *sysnos = (SYSNO *) xmalloc(sizeof(*sysnos) * (p->cache_cur + 1)); - SYSNO *sysnop = sysnos; + zint *sysnos = (zint *) xmalloc(sizeof(*sysnos) * (p->cache_cur + 1)); + zint *sysnop = sysnos; ZEBRA_RES ret = ZEBRA_OK; for (i = 0; icache_cur - saveCount; i++) @@ -602,7 +602,7 @@ static ZEBRA_RES rec_cache_flush(Records p, int saveCount) return ret; } -static Record *rec_cache_lookup(Records p, SYSNO sysno, +static Record *rec_cache_lookup(Records p, zint sysno, enum recordCacheFlag flag) { int i; @@ -683,7 +683,7 @@ ZEBRA_RES rec_close(Records *pp) return ret; } -static Record rec_get_int(Records p, SYSNO sysno) +static Record rec_get_int(Records p, zint sysno) { int i, in_size, r; Record rec, *recp; @@ -828,7 +828,7 @@ static Record rec_get_int(Records p, SYSNO sysno) return rec; } -Record rec_get(Records p, SYSNO sysno) +Record rec_get(Records p, zint sysno) { Record rec; zebra_mutex_lock(&p->mutex); @@ -846,7 +846,7 @@ Record rec_get_root(Records p) static Record rec_new_int(Records p) { int i; - SYSNO sysno; + zint sysno; Record rec; assert(p); diff --git a/index/recindex.h b/index/recindex.h index 6310a24..cccc891 100644 --- a/index/recindex.h +++ b/index/recindex.h @@ -1,4 +1,4 @@ -/* $Id: recindex.h,v 1.29 2006-09-15 10:45:13 adam Exp $ +/* $Id: recindex.h,v 1.30 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -32,7 +32,7 @@ YAZ_BEGIN_CDECL #define REC_NO_INFO 8 typedef struct record_info { - SYSNO sysno; + zint sysno; int newFlag; char *info[REC_NO_INFO]; size_t size[REC_NO_INFO]; @@ -72,7 +72,7 @@ Record rec_new(Records p); \param sysno system ID (external number) \returns record pointer (or NULL on error) */ -Record rec_get(Records p, SYSNO sysno); +Record rec_get(Records p, zint sysno); /** \brief gets root record \param p records handle @@ -91,7 +91,7 @@ Records rec_open(BFiles bfs, int rw, int compression_method); char *rec_strdup(const char *s, size_t *len); void rec_prstat(Records p); -SYSNO rec_sysno_to_int(SYSNO sysno); +zint rec_sysno_to_int(zint sysno); /** \brief compression types */ #define REC_COMPRESS_NONE 0 diff --git a/index/reckeys.c b/index/reckeys.c index 3ba8453..652b729 100644 --- a/index/reckeys.c +++ b/index/reckeys.c @@ -1,4 +1,4 @@ -/* $Id: reckeys.c,v 1.9 2006-11-20 13:59:35 adam Exp $ +/* $Id: reckeys.c,v 1.10 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -22,12 +22,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include +#include #include #include -#include -#include "index.h" #include "reckeys.h" +#include +#include struct zebra_rec_key_entry { char *buf; diff --git a/index/reckeys.h b/index/reckeys.h index ed906da..8975533 100644 --- a/index/reckeys.h +++ b/index/reckeys.h @@ -1,4 +1,4 @@ -/* $Id: reckeys.h,v 1.7 2006-11-21 14:32:38 adam Exp $ +/* $Id: reckeys.h,v 1.8 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -23,6 +23,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #ifndef RECKEYS_H #define RECKEYS_H +#include +#include "it_key.h" + YAZ_BEGIN_CDECL typedef struct zebra_rec_keys_t_ *zebra_rec_keys_t; diff --git a/index/retrieve.c b/index/retrieve.c index cffbc40..64c3dcc 100644 --- a/index/retrieve.c +++ b/index/retrieve.c @@ -1,4 +1,4 @@ -/* $Id: retrieve.c,v 1.54 2006-11-17 08:20:17 marc Exp $ +/* $Id: retrieve.c,v 1.55 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -109,7 +109,7 @@ static void parse_zebra_elem(const char *elem, } -int zebra_special_index_fetch(ZebraHandle zh, SYSNO sysno, ODR odr, +int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr, Record rec, const char *elemsetname, oid_value input_format, @@ -253,7 +253,7 @@ int zebra_special_index_fetch(ZebraHandle zh, SYSNO sysno, ODR odr, } -int zebra_special_fetch(ZebraHandle zh, SYSNO sysno, ODR odr, +int zebra_special_fetch(ZebraHandle zh, zint sysno, ODR odr, const char *elemsetname, oid_value input_format, oid_value *output_format, @@ -336,7 +336,7 @@ int zebra_special_fetch(ZebraHandle zh, SYSNO sysno, ODR odr, } -int zebra_record_fetch(ZebraHandle zh, SYSNO sysno, int score, +int zebra_record_fetch(ZebraHandle zh, zint sysno, int score, zebra_snippets *hit_snippet, ODR odr, oid_value input_format, Z_RecordComposition *comp, oid_value *output_format, diff --git a/index/sortidx.c b/index/sortidx.c index 979d919..08b16e6 100644 --- a/index/sortidx.c +++ b/index/sortidx.c @@ -1,4 +1,4 @@ -/* $Id: sortidx.c,v 1.18 2006-08-14 10:40:15 adam Exp $ +/* $Id: sortidx.c,v 1.19 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define SORT_IDX_BLOCKSIZE 64 struct sortFileHead { - SYSNO sysno_max; + zint sysno_max; }; struct sortFile { @@ -46,7 +46,7 @@ struct sortFile { struct sortIdx { BFiles bfs; int write_flag; - SYSNO sysno; + zint sysno; char *entry_buf; struct sortFile *current_file; struct sortFile *files; @@ -116,12 +116,12 @@ int sortIdx_type (SortIdx si, int type) return 0; } -void sortIdx_sysno (SortIdx si, SYSNO sysno) +void sortIdx_sysno(SortIdx si, zint sysno) { si->sysno = rec_sysno_to_int(sysno); } -void sortIdx_add (SortIdx si, const char *buf, int len) +void sortIdx_add(SortIdx si, const char *buf, int len) { if (!si->current_file || !si->current_file->bf) return; diff --git a/index/symtab.c b/index/symtab.c index de38be4..a14c9cf 100644 --- a/index/symtab.c +++ b/index/symtab.c @@ -1,4 +1,4 @@ -/* $Id: symtab.c,v 1.10 2006-08-14 10:40:15 adam Exp $ +/* $Id: symtab.c,v 1.11 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -26,8 +26,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include -#include "index.h" - struct strentry { char *name; void *info; diff --git a/index/update_file.c b/index/update_file.c index 7b211c0..ed2035c 100644 --- a/index/update_file.c +++ b/index/update_file.c @@ -1,4 +1,4 @@ -/* $Id: update_file.c,v 1.3 2006-09-11 22:57:54 adam Exp $ +/* $Id: update_file.c,v 1.4 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -104,7 +104,7 @@ static void file_update_r(ZebraHandle zh, sprintf (tmppath, "%s%s", base, src); e_src = dir_open (tmppath, zh->path_reg, zh->m_follow_links); - yaz_log (YLOG_LOG, "dir %s", tmppath); + yaz_log(YLOG_LOG, "dir %s", tmppath); #if 0 if (!dst || repComp (dst->path, src, src_len)) @@ -149,7 +149,7 @@ static void file_update_r(ZebraHandle zh, { if (e_src[i_src].name) { - yaz_log (YLOG_DEBUG, "dst=%s src=%s", dst->path + src_len, + yaz_log(YLOG_DEBUG, "dst=%s src=%s", dst->path + src_len, e_src[i_src].name); sd = strcmp (dst->path + src_len, e_src[i_src].name); } @@ -160,7 +160,7 @@ static void file_update_r(ZebraHandle zh, sd = 1; else break; - yaz_log (YLOG_DEBUG, "trav sd=%d", sd); + yaz_log(YLOG_DEBUG, "trav sd=%d", sd); if (sd == 0) { @@ -176,15 +176,15 @@ static void file_update_r(ZebraHandle zh, { dirs_add (di, src, dst->sysno, e_src[i_src].mtime); } - yaz_log (YLOG_DEBUG, "old: %s", ctime (&dst->mtime)); - yaz_log (YLOG_DEBUG, "new: %s", ctime (&e_src[i_src].mtime)); + yaz_log(YLOG_DEBUG, "old: %s", ctime (&dst->mtime)); + yaz_log(YLOG_DEBUG, "new: %s", ctime (&e_src[i_src].mtime)); } dst = dirs_read (di); break; case dirs_dir: file_update_r(zh, di, dst, base, src, level+1); dst = dirs_last (di); - yaz_log (YLOG_DEBUG, "last is %s", dst ? dst->path : "null"); + yaz_log(YLOG_DEBUG, "last is %s", dst ? dst->path : "null"); break; default: dst = dirs_read (di); @@ -193,7 +193,7 @@ static void file_update_r(ZebraHandle zh, } else if (sd > 0) { - SYSNO sysno = 0; + zint sysno = 0; strcpy (src + src_len, e_src[i_src].name); sprintf (tmppath, "%s%s", base, src); @@ -257,14 +257,14 @@ static void file_update_top(ZebraHandle zh, Dict dict, const char *path) if (ret == -1) { - yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot access path %s", src); + yaz_log(YLOG_WARN|YLOG_ERRNO, "Cannot access path %s", src); } else if (S_ISREG(sbuf.st_mode)) { struct dirs_entry *e_dst; di = dirs_fopen (dict, src, zh->m_flag_rw); - e_dst = dirs_read (di); + e_dst = dirs_read(di); if (e_dst) { if (sbuf.st_mtime > e_dst->mtime) @@ -273,11 +273,11 @@ static void file_update_top(ZebraHandle zh, Dict dict, const char *path) } else { - SYSNO sysno = 0; + zint sysno = 0; if (zebra_extract_file (zh, &sysno, src, 0) == ZEBRA_OK) dirs_add (di, src, sysno, sbuf.st_mtime); } - dirs_free (&di); + dirs_free(&di); } else if (S_ISDIR(sbuf.st_mode)) { @@ -293,7 +293,7 @@ static void file_update_top(ZebraHandle zh, Dict dict, const char *path) } else { - yaz_log (YLOG_WARN, "Skipping path %s", src); + yaz_log(YLOG_WARN, "Skipping path %s", src); } } @@ -307,7 +307,7 @@ static ZEBRA_RES zebra_open_fmatch(ZebraHandle zh, Dict *dictp) if (!(*dictp = dict_open_res (zh->reg->bfs, fmatch_fname, 50, zh->m_flag_rw, 0, zh->res))) { - yaz_log (YLOG_FATAL, "dict_open fail of %s", fmatch_fname); + yaz_log(YLOG_FATAL, "dict_open fail of %s", fmatch_fname); return ZEBRA_FAIL; } return ZEBRA_OK; diff --git a/index/zebraapi.c b/index/zebraapi.c index 12d28ac..d8857c1 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.233 2006-11-21 14:32:38 adam Exp $ +/* $Id: zebraapi.c,v 1.234 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -1316,7 +1316,7 @@ ZEBRA_RES zebra_admin_import_end (ZebraHandle zh) ZEBRA_RES zebra_admin_import_segment (ZebraHandle zh, Z_Segment *segment) { ZEBRA_RES res = ZEBRA_OK; - SYSNO sysno; + zint sysno; int i; ZEBRA_CHECK_HANDLE(zh); yaz_log(log_level, "zebra_admin_import_segment"); @@ -1358,7 +1358,7 @@ ZEBRA_RES zebra_admin_exchange_record(ZebraHandle zh, /* 4 = update. Insert/replace */ { ZEBRA_RES res; - SYSNO sysno = 0; + zint sysno = 0; char *rinfo = 0; char recid_z[256]; int db_ord; @@ -2236,7 +2236,7 @@ ZEBRA_RES zebra_add_record(ZebraHandle zh, ZEBRA_RES zebra_insert_record(ZebraHandle zh, const char *recordType, - SYSNO *sysno, const char *match, + zint *sysno, const char *match, const char *fname, const char *buf, int buf_size, int force_update) { @@ -2267,12 +2267,12 @@ ZEBRA_RES zebra_insert_record(ZebraHandle zh, return res; } -ZEBRA_RES zebra_update_record (ZebraHandle zh, - const char *recordType, - SYSNO* sysno, const char *match, - const char *fname, - const char *buf, int buf_size, - int force_update) +ZEBRA_RES zebra_update_record(ZebraHandle zh, + const char *recordType, + zint *sysno, const char *match, + const char *fname, + const char *buf, int buf_size, + int force_update) { ZEBRA_RES res; @@ -2304,12 +2304,12 @@ ZEBRA_RES zebra_update_record (ZebraHandle zh, return res; } -ZEBRA_RES zebra_delete_record (ZebraHandle zh, - const char *recordType, - SYSNO *sysno, const char *match, - const char *fname, - const char *buf, int buf_size, - int force_update) +ZEBRA_RES zebra_delete_record(ZebraHandle zh, + const char *recordType, + zint *sysno, const char *match, + const char *fname, + const char *buf, int buf_size, + int force_update) { ZEBRA_RES res; @@ -2466,11 +2466,11 @@ void zebra_setError_zint(ZebraHandle zh, int code, zint i) zh->errString = nmem_strdup(zh->nmem_error, vstr); } -void zebra_lock_prefix (Res res, char *path) +void zebra_lock_prefix(Res res, char *path) { const char *lock_dir = res_get_def (res, "lockDir", ""); - - strcpy (path, lock_dir); + + strcpy(path, lock_dir); if (*path && path[strlen(path)-1] != '/') strcat (path, "/"); } diff --git a/index/zebrash.c b/index/zebrash.c index 2fd1157..8a0d5c7 100644 --- a/index/zebrash.c +++ b/index/zebrash.c @@ -1,4 +1,4 @@ -/* $Id: zebrash.c,v 1.40 2006-10-29 17:20:01 adam Exp $ +/* $Id: zebrash.c,v 1.41 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -351,7 +351,7 @@ static int cmd_end_trans( char *args[], WRBUF outbuff) static int cmd_record_insert( char *args[], WRBUF outbuff) { - SYSNO sysno=0; + zint sysno = 0; int rc; char *rec=restargs(args,1); diff --git a/index/zebrasrv.c b/index/zebrasrv.c index 3283d5f..966c186 100644 --- a/index/zebrasrv.c +++ b/index/zebrasrv.c @@ -1,4 +1,4 @@ -/* $Id: zebrasrv.c,v 1.1 2006-09-22 10:18:08 adam Exp $ +/* $Id: zebrasrv.c,v 1.2 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -585,8 +585,8 @@ int bend_esrequest (void *handle, bend_esrequest_rr *rr) Z_External *rec = notToKeep->elements[i]->record; struct oident *oident = 0; Odr_oct *opaque_recid = 0; - SYSNO *sysno = 0; - SYSNO sysno_tmp; + zint *sysno = 0; + zint sysno_tmp; if (notToKeep->elements[i]->u.opaque) { diff --git a/index/zinfo.c b/index/zinfo.c index 9d5bb3d..8e4f087 100644 --- a/index/zinfo.c +++ b/index/zinfo.c @@ -1,4 +1,4 @@ -/* $Id: zinfo.c,v 1.71 2006-11-14 08:12:08 adam Exp $ +/* $Id: zinfo.c,v 1.72 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -53,7 +53,7 @@ struct zebSUInfoB { typedef struct zebAccessObjectB *zebAccessObject; struct zebAccessObjectB { void *handle; - SYSNO sysno; + zint sysno; Odr_oid *oid; zebAccessObject next; }; @@ -66,7 +66,7 @@ struct zebAccessInfoB { typedef struct { struct zebSUInfoB *SUInfo; - SYSNO sysno; + zint sysno; int dirty; int readFlag; data1_node *data1_tree; @@ -79,7 +79,7 @@ struct zebDatabaseInfoB { data1_node *data1_database; zint recordCount; /* records in db */ zint recordBytes; /* size of records */ - SYSNO sysno; /* sysno of database info */ + zint sysno; /* sysno of database info */ int readFlag; /* 1: read is needed when referenced; 0 if not */ int dirty; /* 1: database is dirty: write is needed */ struct zebDatabaseInfoB *next; @@ -94,7 +94,7 @@ struct zebraExplainAttset { struct zebraCategoryListInfo { int dirty; - SYSNO sysno; + zint sysno; data1_node *data1_categoryList; }; @@ -143,7 +143,7 @@ static void zebraExplain_writeCategoryList(ZebraExplainInfo zei, int key_flush); -static Record createRecord(Records records, SYSNO *sysno) +static Record createRecord(Records records, zint *sysno) { Record rec; if (*sysno) @@ -976,7 +976,7 @@ static void zebraExplain_writeCategoryList (ZebraExplainInfo zei, int i; Record drec; data1_node *node_ci, *node_categoryList; - SYSNO sysno = 0; + zint sysno = 0; static char *category[] = { "CategoryList", "TargetInfo", diff --git a/test/api/t13.c b/test/api/t13.c index 40d41ca..a30bdf7 100644 --- a/test/api/t13.c +++ b/test/api/t13.c @@ -1,4 +1,4 @@ -/* $Id: t13.c,v 1.9 2006-08-14 10:40:22 adam Exp $ +/* $Id: t13.c,v 1.10 2006-11-21 22:17:50 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -83,7 +83,7 @@ static void tst_no_config(void) static char *xml_buf = "myx"; ZebraService zs; ZebraHandle zh; - SYSNO sysno = 0; + zint sysno = 0; zs = zebra_start_res(0, 0, 0); YAZ_CHECK(zs); -- 1.7.10.4