]> jfr.im git - solanum.git/commitdiff
librb: radixtree: fix iteration restarting
authorAriadne Conill <redacted>
Sun, 30 May 2021 03:32:44 +0000 (21:32 -0600)
committerDoug Freed <redacted>
Sun, 30 May 2021 15:39:34 +0000 (10:39 -0500)
STATE_CUR(state) = NULL causes rb_radixtree_foreach_next() to fail,
instead set both state pointers to the same address.

librb/src/radixtree.c

index bc2fca5c93cf6525cf41bd4d846c65b43e8a4ccc..89ed0006c552debaa5e5184f6bb4486ed3fcc7c0 100644 (file)
@@ -639,8 +639,8 @@ rb_radixtree_foreach_start_from(rb_radixtree *dtree, rb_radixtree_iteration_stat
 
        if (key != NULL)
        {
-               STATE_CUR(state) = NULL;
                STATE_NEXT(state) = rb_radixtree_elem_find(dtree, key, 1);
+               STATE_CUR(state) = STATE_NEXT(state);
 
                /* make STATE_CUR point to selected item and STATE_NEXT point to
                 * next item in the tree */