mdbx++: changes after codereview-1 (part 2 of 2).

Change-Id: I8e1ca134bb8c5d447895f116247dfd12fa6871f0
This commit is contained in:
Leonid Yuriev
2020-09-14 16:40:46 +03:00
parent 04b0d258ff
commit cacc4aa829
15 changed files with 631 additions and 628 deletions

View File

@@ -1038,9 +1038,9 @@ extern uint8_t mdbx_runtime_flags;
extern uint8_t mdbx_loglevel;
extern MDBX_debug_func *mdbx_debug_logger;
MDBX_INTERNAL_FUNC void mdbx_printf_args(4, 5)
MDBX_INTERNAL_FUNC void MDBX_PRINTF_ARGS(4, 5)
mdbx_debug_log(int level, const char *function, int line, const char *fmt,
...) mdbx_printf_args(4, 5);
...) MDBX_PRINTF_ARGS(4, 5);
MDBX_INTERNAL_FUNC void mdbx_debug_log_va(int level, const char *function,
int line, const char *fmt,
va_list args);
@@ -1360,30 +1360,30 @@ typedef struct MDBX_node {
/* Do not spill pages to disk if txn is getting full, may fail instead */
#define MDBX_NOSPILL 0x8000
__nothrow_const_function static __maybe_unused __inline pgno_t
MDBX_NOTHROW_CONST_FUNCTION static __maybe_unused __inline pgno_t
pgno_add(pgno_t base, pgno_t augend) {
assert(base <= MAX_PAGENO);
return (augend < MAX_PAGENO - base) ? base + augend : MAX_PAGENO;
}
__nothrow_const_function static __maybe_unused __inline pgno_t
MDBX_NOTHROW_CONST_FUNCTION static __maybe_unused __inline pgno_t
pgno_sub(pgno_t base, pgno_t subtrahend) {
assert(base >= MIN_PAGENO);
return (subtrahend < base - MIN_PAGENO) ? base - subtrahend : MIN_PAGENO;
}
__nothrow_const_function static __always_inline __maybe_unused bool
MDBX_NOTHROW_CONST_FUNCTION static __always_inline __maybe_unused bool
is_powerof2(size_t x) {
return (x & (x - 1)) == 0;
}
__nothrow_const_function static __always_inline __maybe_unused size_t
MDBX_NOTHROW_CONST_FUNCTION static __always_inline __maybe_unused size_t
floor_powerof2(size_t value, size_t granularity) {
assert(is_powerof2(granularity));
return value & ~(granularity - 1);
}
__nothrow_const_function static __always_inline __maybe_unused size_t
MDBX_NOTHROW_CONST_FUNCTION static __always_inline __maybe_unused size_t
ceil_powerof2(size_t value, size_t granularity) {
return floor_powerof2(value + granularity - 1, granularity);
}