]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9376 simplify
authorHoward Chu <hyc@openldap.org>
Sun, 14 Mar 2021 14:25:55 +0000 (14:25 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 14 Mar 2021 17:51:38 +0000 (17:51 +0000)
libraries/liblmdb/mdb.c

index 1ebb04c0f5231e16fe4c9f04c7aa066d19abd6ea..991c71316162c27bfbfbf1d1f0d17b386f8aa7e7 100644 (file)
@@ -8481,7 +8481,6 @@ mdb_cursor_del0(MDB_cursor *mc)
                return rc;
        }
 
-       ki = mc->mc_ki[mc->mc_top];
        mp = mc->mc_pg[mc->mc_top];
        nkeys = NUMKEYS(mp);
 
@@ -8493,19 +8492,18 @@ mdb_cursor_del0(MDB_cursor *mc)
                if (m3->mc_snum < mc->mc_snum)
                        continue;
                if (m3->mc_pg[mc->mc_top] == mp) {
+                       if (m3->mc_ki[mc->mc_top] >= mc->mc_ki[mc->mc_top]) {
                        /* if m3 points past last node in page, find next sibling */
-                       if (m3->mc_ki[mc->mc_top] >= nkeys) {
-                               rc = mdb_cursor_sibling(m3, 1);
-                               if (rc == MDB_NOTFOUND) {
-                                       m3->mc_flags |= C_EOF;
-                                       rc = MDB_SUCCESS;
-                                       continue;
+                               if (m3->mc_ki[mc->mc_top] >= nkeys) {
+                                       rc = mdb_cursor_sibling(m3, 1);
+                                       if (rc == MDB_NOTFOUND) {
+                                               m3->mc_flags |= C_EOF;
+                                               rc = MDB_SUCCESS;
+                                               continue;
+                                       }
+                                       if (rc)
+                                               goto fail;
                                }
-                               if (rc)
-                                       goto fail;
-                       }
-                       if (m3->mc_ki[mc->mc_top] >= ki ||
-                               /* moved to right sibling */ m3->mc_pg[mc->mc_top] != mp) {
                                if (m3->mc_xcursor && !(m3->mc_flags & C_EOF)) {
                                        MDB_node *node = NODEPTR(m3->mc_pg[m3->mc_top], m3->mc_ki[m3->mc_top]);
                                        /* If this node has dupdata, it may need to be reinited