summaryrefslogtreecommitdiffstats
path: root/src/sord.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sord.c')
-rw-r--r--src/sord.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/sord.c b/src/sord.c
index f9b8e53..104cc21 100644
--- a/src/sord.c
+++ b/src/sord.c
@@ -447,14 +447,14 @@ sord_iter_get_node(const SordIter* iter, SordQuadIndex index)
return iter ? ((SordNode**)zix_btree_get(iter->cur))[index] : NULL;
}
-bool
-sord_iter_next(SordIter* iter)
+static bool
+sord_iter_scan_next(SordIter* iter)
{
- if (iter->end)
+ if (iter->end) {
return true;
+ }
const SordNode** key;
- iter->end = sord_iter_forward(iter);
if (!iter->end) {
switch (iter->mode) {
case ALL:
@@ -506,6 +506,17 @@ sord_iter_next(SordIter* iter)
}
bool
+sord_iter_next(SordIter* iter)
+{
+ if (iter->end) {
+ return true;
+ }
+
+ iter->end = sord_iter_forward(iter);
+ return sord_iter_scan_next(iter);
+}
+
+bool
sord_iter_end(const SordIter* iter)
{
return !iter || iter->end;
@@ -1258,6 +1269,7 @@ sord_erase(SordModel* sord, SordIter* iter)
}
}
iter->end = zix_btree_iter_is_end(iter->cur);
+ sord_iter_scan_next(iter);
free(quad);