mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:34:14 +08:00
mdbx: использование enum-типов вместо int для устранения предупреждений GCC >= 13.
This commit is contained in:
parent
9b8291457b
commit
cf9145bb46
27
src/core.c
27
src/core.c
@ -3400,8 +3400,8 @@ static int __must_check_result setup_dbx(MDBX_dbx *const dbx,
|
|||||||
const MDBX_db *const db,
|
const MDBX_db *const db,
|
||||||
const unsigned pagesize);
|
const unsigned pagesize);
|
||||||
|
|
||||||
static __inline MDBX_cmp_func *get_default_keycmp(unsigned flags);
|
static __inline MDBX_cmp_func *get_default_keycmp(MDBX_db_flags_t flags);
|
||||||
static __inline MDBX_cmp_func *get_default_datacmp(unsigned flags);
|
static __inline MDBX_cmp_func *get_default_datacmp(MDBX_db_flags_t flags);
|
||||||
|
|
||||||
__cold const char *mdbx_liberr2str(int errnum) {
|
__cold const char *mdbx_liberr2str(int errnum) {
|
||||||
/* Table of descriptions for MDBX errors */
|
/* Table of descriptions for MDBX errors */
|
||||||
@ -17889,7 +17889,7 @@ static __hot int cursor_put_checklen(MDBX_cursor *mc, const MDBX_val *key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int mdbx_cursor_put(MDBX_cursor *mc, const MDBX_val *key, MDBX_val *data,
|
int mdbx_cursor_put(MDBX_cursor *mc, const MDBX_val *key, MDBX_val *data,
|
||||||
unsigned flags) {
|
MDBX_put_flags_t flags) {
|
||||||
if (unlikely(mc == NULL || key == NULL || data == NULL))
|
if (unlikely(mc == NULL || key == NULL || data == NULL))
|
||||||
return MDBX_EINVAL;
|
return MDBX_EINVAL;
|
||||||
|
|
||||||
@ -21016,7 +21016,7 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int mdbx_put(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data,
|
int mdbx_put(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data,
|
||||||
unsigned flags) {
|
MDBX_put_flags_t flags) {
|
||||||
int rc = check_txn_rw(txn, MDBX_TXN_BLOCKED);
|
int rc = check_txn_rw(txn, MDBX_TXN_BLOCKED);
|
||||||
if (unlikely(rc != MDBX_SUCCESS))
|
if (unlikely(rc != MDBX_SUCCESS))
|
||||||
return rc;
|
return rc;
|
||||||
@ -21431,7 +21431,8 @@ __cold static void meta_make_sizeable(MDBX_meta *meta) {
|
|||||||
/* Copy environment with compaction. */
|
/* Copy environment with compaction. */
|
||||||
__cold static int env_compact(MDBX_env *env, MDBX_txn *read_txn,
|
__cold static int env_compact(MDBX_env *env, MDBX_txn *read_txn,
|
||||||
mdbx_filehandle_t fd, uint8_t *buffer,
|
mdbx_filehandle_t fd, uint8_t *buffer,
|
||||||
const bool dest_is_pipe, const int flags) {
|
const bool dest_is_pipe,
|
||||||
|
const MDBX_copy_flags_t flags) {
|
||||||
const size_t meta_bytes = pgno2bytes(env, NUM_METAS);
|
const size_t meta_bytes = pgno2bytes(env, NUM_METAS);
|
||||||
uint8_t *const data_buffer =
|
uint8_t *const data_buffer =
|
||||||
buffer + ceil_powerof2(meta_bytes, env->me_os_psize);
|
buffer + ceil_powerof2(meta_bytes, env->me_os_psize);
|
||||||
@ -21578,7 +21579,8 @@ __cold static int env_compact(MDBX_env *env, MDBX_txn *read_txn,
|
|||||||
/* Copy environment as-is. */
|
/* Copy environment as-is. */
|
||||||
__cold static int env_copy_asis(MDBX_env *env, MDBX_txn *read_txn,
|
__cold static int env_copy_asis(MDBX_env *env, MDBX_txn *read_txn,
|
||||||
mdbx_filehandle_t fd, uint8_t *buffer,
|
mdbx_filehandle_t fd, uint8_t *buffer,
|
||||||
const bool dest_is_pipe, const int flags) {
|
const bool dest_is_pipe,
|
||||||
|
const MDBX_copy_flags_t flags) {
|
||||||
/* We must start the actual read txn after blocking writers */
|
/* We must start the actual read txn after blocking writers */
|
||||||
int rc = txn_end(read_txn, MDBX_END_RESET_TMP);
|
int rc = txn_end(read_txn, MDBX_END_RESET_TMP);
|
||||||
if (unlikely(rc != MDBX_SUCCESS))
|
if (unlikely(rc != MDBX_SUCCESS))
|
||||||
@ -21704,7 +21706,7 @@ __cold static int env_copy_asis(MDBX_env *env, MDBX_txn *read_txn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
__cold int mdbx_env_copy2fd(MDBX_env *env, mdbx_filehandle_t fd,
|
__cold int mdbx_env_copy2fd(MDBX_env *env, mdbx_filehandle_t fd,
|
||||||
unsigned flags) {
|
MDBX_copy_flags_t flags) {
|
||||||
int rc = check_env(env, true);
|
int rc = check_env(env, true);
|
||||||
if (unlikely(rc != MDBX_SUCCESS))
|
if (unlikely(rc != MDBX_SUCCESS))
|
||||||
return rc;
|
return rc;
|
||||||
@ -22367,13 +22369,13 @@ __cold int mdbx_env_info_ex(const MDBX_env *env, const MDBX_txn *txn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline MDBX_cmp_func *get_default_keycmp(unsigned flags) {
|
static __inline MDBX_cmp_func *get_default_keycmp(MDBX_db_flags_t flags) {
|
||||||
return (flags & MDBX_REVERSEKEY) ? cmp_reverse
|
return (flags & MDBX_REVERSEKEY) ? cmp_reverse
|
||||||
: (flags & MDBX_INTEGERKEY) ? cmp_int_align2
|
: (flags & MDBX_INTEGERKEY) ? cmp_int_align2
|
||||||
: cmp_lexical;
|
: cmp_lexical;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline MDBX_cmp_func *get_default_datacmp(unsigned flags) {
|
static __inline MDBX_cmp_func *get_default_datacmp(MDBX_db_flags_t flags) {
|
||||||
return !(flags & MDBX_DUPSORT)
|
return !(flags & MDBX_DUPSORT)
|
||||||
? cmp_lenfast
|
? cmp_lenfast
|
||||||
: ((flags & MDBX_INTEGERDUP)
|
: ((flags & MDBX_INTEGERDUP)
|
||||||
@ -23220,7 +23222,8 @@ __cold MDBX_INTERNAL_FUNC int cleanup_dead_readers(MDBX_env *env,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
__cold int mdbx_setup_debug(int level, int flags, MDBX_debug_func *logger) {
|
__cold int mdbx_setup_debug(MDBX_log_level_t level, MDBX_debug_flags_t flags,
|
||||||
|
MDBX_debug_func *logger) {
|
||||||
const int rc = runtime_flags | (loglevel << 16);
|
const int rc = runtime_flags | (loglevel << 16);
|
||||||
|
|
||||||
if (level != MDBX_LOG_DONTCHANGE)
|
if (level != MDBX_LOG_DONTCHANGE)
|
||||||
@ -24671,11 +24674,11 @@ int64_t mdbx_int64_from_key(const MDBX_val v) {
|
|||||||
UINT64_C(0x8000000000000000));
|
UINT64_C(0x8000000000000000));
|
||||||
}
|
}
|
||||||
|
|
||||||
__cold MDBX_cmp_func *mdbx_get_keycmp(unsigned flags) {
|
__cold MDBX_cmp_func *mdbx_get_keycmp(MDBX_db_flags_t flags) {
|
||||||
return get_default_keycmp(flags);
|
return get_default_keycmp(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
__cold MDBX_cmp_func *mdbx_get_datacmp(unsigned flags) {
|
__cold MDBX_cmp_func *mdbx_get_datacmp(MDBX_db_flags_t flags) {
|
||||||
return get_default_datacmp(flags);
|
return get_default_datacmp(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user