mdbx: удаление const у транзакции в cursor_bind() и cursor_renew() (backport).

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2025-03-20 00:52:16 +03:00
parent d8f9f3ba58
commit 15bd9cfc89
3 changed files with 10 additions and 10 deletions

6
mdbx.h
View File

@ -5131,7 +5131,7 @@ MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API void *mdbx_cursor_get_userctx(const MDBX_
* \retval MDBX_THREAD_MISMATCH Given transaction is not owned * \retval MDBX_THREAD_MISMATCH Given transaction is not owned
* by current thread. * by current thread.
* \retval MDBX_EINVAL An invalid parameter was specified. */ * \retval MDBX_EINVAL An invalid parameter was specified. */
LIBMDBX_API int mdbx_cursor_bind(const MDBX_txn *txn, MDBX_cursor *cursor, MDBX_dbi dbi); LIBMDBX_API int mdbx_cursor_bind(MDBX_txn *txn, MDBX_cursor *cursor, MDBX_dbi dbi);
/** \brief Unbind cursor from a transaction. /** \brief Unbind cursor from a transaction.
* \ingroup c_cursors * \ingroup c_cursors
@ -5200,7 +5200,7 @@ LIBMDBX_API int mdbx_cursor_reset(MDBX_cursor *cursor);
* \retval MDBX_THREAD_MISMATCH Given transaction is not owned * \retval MDBX_THREAD_MISMATCH Given transaction is not owned
* by current thread. * by current thread.
* \retval MDBX_EINVAL An invalid parameter was specified. */ * \retval MDBX_EINVAL An invalid parameter was specified. */
LIBMDBX_API int mdbx_cursor_open(const MDBX_txn *txn, MDBX_dbi dbi, MDBX_cursor **cursor); LIBMDBX_API int mdbx_cursor_open(MDBX_txn *txn, MDBX_dbi dbi, MDBX_cursor **cursor);
/** \brief Close a cursor handle. /** \brief Close a cursor handle.
* \ingroup c_cursors * \ingroup c_cursors
@ -5288,7 +5288,7 @@ LIBMDBX_INLINE_API(int, mdbx_txn_release_all_cursors, (const MDBX_txn *txn, bool
* \retval MDBX_EINVAL An invalid parameter was specified. * \retval MDBX_EINVAL An invalid parameter was specified.
* \retval MDBX_BAD_DBI The cursor was not bound to a DBI-handle * \retval MDBX_BAD_DBI The cursor was not bound to a DBI-handle
* or such a handle became invalid. */ * or such a handle became invalid. */
LIBMDBX_API int mdbx_cursor_renew(const MDBX_txn *txn, MDBX_cursor *cursor); LIBMDBX_API int mdbx_cursor_renew(MDBX_txn *txn, MDBX_cursor *cursor);
/** \brief Return the cursor's transaction handle. /** \brief Return the cursor's transaction handle.
* \ingroup c_cursors * \ingroup c_cursors

View File

@ -4474,11 +4474,11 @@ public:
/// \brief Renew/bind a cursor with a new transaction and previously used /// \brief Renew/bind a cursor with a new transaction and previously used
/// key-value map handle. /// key-value map handle.
inline void renew(const ::mdbx::txn &txn); inline void renew(::mdbx::txn &txn);
/// \brief Bind/renew a cursor with a new transaction and specified key-value /// \brief Bind/renew a cursor with a new transaction and specified key-value
/// map handle. /// map handle.
inline void bind(const ::mdbx::txn &txn, ::mdbx::map_handle map_handle); inline void bind(::mdbx::txn &txn, ::mdbx::map_handle map_handle);
/// \brief Unbind cursor from a transaction. /// \brief Unbind cursor from a transaction.
inline void unbind(); inline void unbind();
@ -6166,9 +6166,9 @@ inline cursor::estimate_result cursor::estimate(move_operation operation) const
return estimate_result(*this, operation); return estimate_result(*this, operation);
} }
inline void cursor::renew(const ::mdbx::txn &txn) { error::success_or_throw(::mdbx_cursor_renew(txn, handle_)); } inline void cursor::renew(::mdbx::txn &txn) { error::success_or_throw(::mdbx_cursor_renew(txn, handle_)); }
inline void cursor::bind(const ::mdbx::txn &txn, ::mdbx::map_handle map_handle) { inline void cursor::bind(::mdbx::txn &txn, ::mdbx::map_handle map_handle) {
error::success_or_throw(::mdbx_cursor_bind(txn, handle_, map_handle.dbi)); error::success_or_throw(::mdbx_cursor_bind(txn, handle_, map_handle.dbi));
} }

View File

@ -23,7 +23,7 @@ MDBX_cursor *mdbx_cursor_create(void *context) {
return &couple->outer; return &couple->outer;
} }
int mdbx_cursor_renew(const MDBX_txn *txn, MDBX_cursor *mc) { int mdbx_cursor_renew(MDBX_txn *txn, MDBX_cursor *mc) {
return likely(mc) ? mdbx_cursor_bind(txn, mc, (kvx_t *)mc->clc - txn->env->kvs) : LOG_IFERR(MDBX_EINVAL); return likely(mc) ? mdbx_cursor_bind(txn, mc, (kvx_t *)mc->clc - txn->env->kvs) : LOG_IFERR(MDBX_EINVAL);
} }
@ -40,7 +40,7 @@ int mdbx_cursor_reset(MDBX_cursor *mc) {
return MDBX_SUCCESS; return MDBX_SUCCESS;
} }
int mdbx_cursor_bind(const MDBX_txn *txn, MDBX_cursor *mc, MDBX_dbi dbi) { int mdbx_cursor_bind(MDBX_txn *txn, MDBX_cursor *mc, MDBX_dbi dbi) {
if (unlikely(!mc)) if (unlikely(!mc))
return LOG_IFERR(MDBX_EINVAL); return LOG_IFERR(MDBX_EINVAL);
@ -130,7 +130,7 @@ int mdbx_cursor_unbind(MDBX_cursor *mc) {
return MDBX_SUCCESS; return MDBX_SUCCESS;
} }
int mdbx_cursor_open(const MDBX_txn *txn, MDBX_dbi dbi, MDBX_cursor **ret) { int mdbx_cursor_open(MDBX_txn *txn, MDBX_dbi dbi, MDBX_cursor **ret) {
if (unlikely(!ret)) if (unlikely(!ret))
return LOG_IFERR(MDBX_EINVAL); return LOG_IFERR(MDBX_EINVAL);
*ret = nullptr; *ret = nullptr;