From: Adam Dickmeiss Date: Tue, 1 Feb 2011 12:05:54 +0000 (+0000) Subject: Add rec_get_next X-Git-Tag: v2.0.46~18 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=da232e65627649c30c4f804240c899880f379a8b;p=idzebra-moved-to-github.git Add rec_get_next --- diff --git a/index/recindex.h b/index/recindex.h index aea2797..c4335cc 100644 --- a/index/recindex.h +++ b/index/recindex.h @@ -76,6 +76,15 @@ Record rec_get(Records p, zint sysno); \returns record pointer (or NULL on error) */ Record rec_get_root(Records p); + + +/** \brief gets next record - with given records + \param p records handle + \param rec record + \returns record pointer (or NULL on error) +*/ +Record rec_get_next(Records p, Record rec); + ZEBRA_RES rec_close (Records *p); /** \brief opens records system diff --git a/index/records.c b/index/records.c index f6ef93d..d63aac6 100644 --- a/index/records.c +++ b/index/records.c @@ -934,6 +934,21 @@ Record rec_get_root(Records p) return rec_get(p, rec_sysno_to_ext(1)); } +Record rec_get_next(Records p, Record rec) +{ + Record next = 0; + zint next_sysno_int = rec_sysno_to_int(rec->sysno); + + while (!next) + { + ++next_sysno_int; + if (next_sysno_int == p->head.index_last) + break; + next = rec_get(p, rec_sysno_to_ext(next_sysno_int)); + } + return next; +} + static Record rec_new_int(Records p) { int i;