"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/knot/journal/knot_lmdb.c" between
knot-2.9.1.tar.xz and knot-2.9.2.tar.xz

About: Knot DNS is a high-performance authoritative-only DNS server (supports zone transfers, dynamic updates and DNSSEC).

knot_lmdb.c  (knot-2.9.1.tar.xz):knot_lmdb.c  (knot-2.9.2.tar.xz)
skipping to change at line 270 skipping to change at line 270
txn->db = db; txn->db = db;
txn->is_rw = rw; txn->is_rw = rw;
} }
} }
void knot_lmdb_abort(knot_lmdb_txn_t *txn) void knot_lmdb_abort(knot_lmdb_txn_t *txn)
{ {
if (txn->opened) { if (txn->opened) {
if (txn->cursor != NULL) { if (txn->cursor != NULL) {
mdb_cursor_close(txn->cursor); mdb_cursor_close(txn->cursor);
txn->cursor = false; txn->cursor = NULL;
} }
mdb_txn_abort(txn->txn); mdb_txn_abort(txn->txn);
txn->opened = false; txn->opened = false;
} }
} }
static bool txn_semcheck(knot_lmdb_txn_t *txn) static bool txn_semcheck(knot_lmdb_txn_t *txn)
{ {
if (!txn->opened && txn->ret == KNOT_EOK) { if (!txn->opened && txn->ret == KNOT_EOK) {
txn->ret = KNOT_ESEMCHECK; txn->ret = KNOT_ESEMCHECK;
skipping to change at line 296 skipping to change at line 296
return true; return true;
} }
void knot_lmdb_commit(knot_lmdb_txn_t *txn) void knot_lmdb_commit(knot_lmdb_txn_t *txn)
{ {
if (!txn_semcheck(txn)) { if (!txn_semcheck(txn)) {
return; return;
} }
if (txn->cursor != NULL) { if (txn->cursor != NULL) {
mdb_cursor_close(txn->cursor); mdb_cursor_close(txn->cursor);
txn->cursor = false; txn->cursor = NULL;
} }
txn->ret = mdb_txn_commit(txn->txn); txn->ret = mdb_txn_commit(txn->txn);
err_to_knot(&txn->ret); err_to_knot(&txn->ret);
if (txn->ret == KNOT_EOK) { txn->opened = false;
txn->opened = false;
} else {
knot_lmdb_abort(txn);
}
} }
// save the programmer's frequent checking for ENOMEM when creating search keys // save the programmer's frequent checking for ENOMEM when creating search keys
static bool txn_enomem(knot_lmdb_txn_t *txn, const MDB_val *tocheck) static bool txn_enomem(knot_lmdb_txn_t *txn, const MDB_val *tocheck)
{ {
if (tocheck->mv_data == NULL) { if (tocheck->mv_data == NULL) {
txn->ret = KNOT_ENOMEM; txn->ret = KNOT_ENOMEM;
knot_lmdb_abort(txn); knot_lmdb_abort(txn);
return false; return false;
} }
 End of changes. 3 change blocks. 
7 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)