|
|
@ -791,6 +791,7 @@ struct MDB_cursor { |
|
|
|
#define C_EOF 0x02 /**< No more data */ |
|
|
|
#define C_EOF 0x02 /**< No more data */ |
|
|
|
#define C_SUB 0x04 /**< Cursor is a sub-cursor */ |
|
|
|
#define C_SUB 0x04 /**< Cursor is a sub-cursor */ |
|
|
|
#define C_SHADOW 0x08 /**< Cursor is a dup from a parent txn */ |
|
|
|
#define C_SHADOW 0x08 /**< Cursor is a dup from a parent txn */ |
|
|
|
|
|
|
|
#define C_ALLOCD 0x10 /**< Cursor was malloc'd */ |
|
|
|
/** @} */ |
|
|
|
/** @} */ |
|
|
|
unsigned int mc_flags; /**< @ref mdb_cursor */ |
|
|
|
unsigned int mc_flags; /**< @ref mdb_cursor */ |
|
|
|
MDB_page *mc_pg[CURSOR_STACK]; /**< stack of pushed pages */ |
|
|
|
MDB_page *mc_pg[CURSOR_STACK]; /**< stack of pushed pages */ |
|
|
@ -1316,6 +1317,7 @@ mdb_cursor_merge(MDB_txn *txn) |
|
|
|
m2->mc_ki[j] = mc->mc_ki[j]; |
|
|
|
m2->mc_ki[j] = mc->mc_ki[j]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (mc->mc_flags & C_ALLOCD) |
|
|
|
free(mc); |
|
|
|
free(mc); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1517,6 +1519,7 @@ mdb_txn_reset0(MDB_txn *txn) |
|
|
|
MDB_cursor *mc; |
|
|
|
MDB_cursor *mc; |
|
|
|
while ((mc = txn->mt_cursors[i])) { |
|
|
|
while ((mc = txn->mt_cursors[i])) { |
|
|
|
txn->mt_cursors[i] = mc->mc_next; |
|
|
|
txn->mt_cursors[i] = mc->mc_next; |
|
|
|
|
|
|
|
if (mc->mc_flags & C_ALLOCD) |
|
|
|
free(mc); |
|
|
|
free(mc); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -4620,6 +4623,7 @@ mdb_cursor_open(MDB_txn *txn, MDB_dbi dbi, MDB_cursor **ret) |
|
|
|
mc->mc_next = txn->mt_cursors[dbi]; |
|
|
|
mc->mc_next = txn->mt_cursors[dbi]; |
|
|
|
txn->mt_cursors[dbi] = mc; |
|
|
|
txn->mt_cursors[dbi] = mc; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
mc->mc_flags |= C_ALLOCD; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return ENOMEM; |
|
|
|
return ENOMEM; |
|
|
|
} |
|
|
|
} |
|
|
@ -4664,6 +4668,7 @@ mdb_cursor_close(MDB_cursor *mc) |
|
|
|
if (*prev == mc) |
|
|
|
if (*prev == mc) |
|
|
|
*prev = mc->mc_next; |
|
|
|
*prev = mc->mc_next; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (mc->mc_flags & C_ALLOCD) |
|
|
|
free(mc); |
|
|
|
free(mc); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|