From 1a35514653cd105cdd3d45fd4ec7f84d38dfd744 Mon Sep 17 00:00:00 2001 From: Jason Volk <jason@zemos.net> Date: Sat, 23 Sep 2017 00:27:25 -0700 Subject: [PATCH] ircd::db: Fixes for reverse iteration. --- include/ircd/db/cursor.h | 2 +- ircd/db.cc | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/ircd/db/cursor.h b/include/ircd/db/cursor.h index 75800d177..94aba9eb5 100644 --- a/include/ircd/db/cursor.h +++ b/include/ircd/db/cursor.h @@ -175,7 +175,7 @@ ircd::db::cursor<d, tuple>::const_iterator_base<index_iterator>::const_iterator_ } ,invalid { - !bool(this->idx) || !row.valid(this->idx->first) + !this->idx || !row.valid(this->idx->first) } { if(invalid) diff --git a/ircd/db.cc b/ircd/db.cc index 9d97914a7..c0b7303e9 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -1800,10 +1800,7 @@ ircd::db::index::rbegin(const string_view &key, opts |= get::NO_CACHE; if(seek(ret, key, opts)) - { - while(seek(ret, pos::NEXT, opts)); - seek(ret, pos::PREV, opts); - } + seek(ret, pos::BACK, opts); return ret; }