From da232e65627649c30c4f804240c899880f379a8b Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 1 Feb 2011 12:05:54 +0000 Subject: [PATCH] Add rec_get_next --- index/recindex.h | 9 +++++++++ index/records.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+) 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; -- 1.7.10.4