From c62b3be617d954ca24f315544e5a11622f14721d Mon Sep 17 00:00:00 2001 From: Eric Tsanyen Date: Thu, 25 May 2017 02:27:57 +0800 Subject: [PATCH] fixed problem with kb_itr_get always returns iterator same as kb_itr_first --- kbtree.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kbtree.h b/kbtree.h index 8b4f9176..11a3f3fa 100644 --- a/kbtree.h +++ b/kbtree.h @@ -337,7 +337,10 @@ typedef struct { itr->p->x = b->root; itr->p->i = 0; \ while (itr->p->x) { \ i = __kb_getp_aux_##name(itr->p->x, k, &r); \ - if (i >= 0 && r == 0) return 0; \ + if (i >= 0 && r == 0) { \ + itr->p->i = i; \ + return 0; \ + } \ if (itr->p->x->is_internal == 0) return -1; \ itr->p[1].x = __KB_PTR(b, itr->p->x)[i + 1]; \ itr->p[1].i = i; \