summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorHallvard Furuseth <hallvard@openldap.org>2016-12-07 18:55:21 +0100
committerHallvard Furuseth <hallvard@openldap.org>2016-12-07 18:55:21 +0100
commit72f875b48a0f9c588e4f26828f18c547525a507d (patch)
tree8dd7f69b8618007b7ceeb14fedf28b31481f82c4 /libraries
parent08e4684d37b45cff97ea0ba17573165a63fb622c (diff)
downloadlmdb-72f875b48a0f9c588e4f26828f18c547525a507d.tar.gz
lmdb-72f875b48a0f9c588e4f26828f18c547525a507d.tar.bz2
lmdb-72f875b48a0f9c588e4f26828f18c547525a507d.zip
Note functions which must set MDB_TXN_ERROR on failure
Other functions depend on them to do so. For mdb_node_read(), instead remove such a dependence.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/liblmdb/mdb.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c
index 4a79ae1..a0e65d9 100644
--- a/libraries/liblmdb/mdb.c
+++ b/libraries/liblmdb/mdb.c
@@ -1899,6 +1899,7 @@ mdb_dcmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b)
/** Allocate memory for a page.
* Re-use old malloc'd pages first for singletons, otherwise just malloc.
+ * Set #MDB_TXN_ERROR on failure.
*/
static MDB_page *
mdb_page_malloc(MDB_txn *txn, unsigned num)
@@ -2310,7 +2311,7 @@ mdb_page_dirty(MDB_txn *txn, MDB_page *mp)
}
/** Allocate page numbers and memory for writing. Maintain me_pglast,
- * me_pghead and mt_next_pgno.
+ * me_pghead and mt_next_pgno. Set #MDB_TXN_ERROR on failure.
*
* If there are free pages available from older transactions, they
* are re-used first. Otherwise allocate a new page at mt_next_pgno.
@@ -2442,7 +2443,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp)
np = m2.mc_pg[m2.mc_top];
leaf = NODEPTR(np, m2.mc_ki[m2.mc_top]);
if ((rc = mdb_node_read(&m2, leaf, &data)) != MDB_SUCCESS)
- return rc;
+ goto fail;
idl = (MDB_ID *) data.mv_data;
i = idl[0];
@@ -2606,6 +2607,7 @@ mdb_page_unspill(MDB_txn *txn, MDB_page *mp, MDB_page **ret)
}
/** Touch a page: make it dirty and re-insert into tree with updated pgno.
+ * Set #MDB_TXN_ERROR on failure.
* @param[in] mc cursor pointing to the page to be touched
* @return 0 on success, non-zero on failure.
*/
@@ -5788,7 +5790,9 @@ mdb_cursor_pop(MDB_cursor *mc)
}
}
-/** Push a page onto the top of the cursor's stack. */
+/** Push a page onto the top of the cursor's stack.
+ * Set #MDB_TXN_ERROR on failure.
+ */
static int
mdb_cursor_push(MDB_cursor *mc, MDB_page *mp)
{
@@ -6096,6 +6100,7 @@ ok:
#endif
/** Find the address of the page corresponding to a given page number.
+ * Set #MDB_TXN_ERROR on failure.
* @param[in] mc the cursor accessing the page.
* @param[in] pgno the page number for the page to retrieve.
* @param[out] ret address of a pointer where the page's address will be stored.
@@ -7884,6 +7889,7 @@ fail:
}
/** Allocate and initialize new pages for a database.
+ * Set #MDB_TXN_ERROR on failure.
* @param[in] mc a cursor on the database being added to.
* @param[in] flags flags defining what type of page is being allocated.
* @param[in] num the number of pages to allocate. This is usually 1,
@@ -7969,6 +7975,7 @@ mdb_branch_size(MDB_env *env, MDB_val *key)
}
/** Add a node to the page pointed to by the cursor.
+ * Set #MDB_TXN_ERROR on failure.
* @param[in] mc The cursor for this operation.
* @param[in] indx The index on the page where the new node should be added.
* @param[in] key The key for the new node.
@@ -8460,6 +8467,7 @@ mdb_cursor_dbi(MDB_cursor *mc)
}
/** Replace the key for a branch node with a new key.
+ * Set #MDB_TXN_ERROR on failure.
* @param[in] mc Cursor pointing to the node to operate on.
* @param[in] key The new key to use.
* @return 0 on success, non-zero on failure.
@@ -9289,6 +9297,7 @@ mdb_del0(MDB_txn *txn, MDB_dbi dbi,
}
/** Split a page and insert a new node.
+ * Set #MDB_TXN_ERROR on failure.
* @param[in,out] mc Cursor pointing to the page and desired insertion index.
* The cursor will be updated to point to the actual page and index where
* the node got inserted after the split.