mirror of
https://github.com/isar/libmdbx.git
synced 2025-04-01 14:52:57 +08:00
mdbx++: переформатирование (временно) неиспользуемого кода (backport).
This commit is contained in:
parent
c5936eb5da
commit
682233ba28
17
src/mdbx.c++
17
src/mdbx.c++
@ -63,8 +63,8 @@ class trouble_location {
|
||||
#endif
|
||||
|
||||
public:
|
||||
MDBX_CXX11_CONSTEXPR trouble_location(unsigned line, const char *condition,
|
||||
const char *function, const char *filename)
|
||||
MDBX_CXX11_CONSTEXPR trouble_location(unsigned line, const char *condition, const char *function,
|
||||
const char *filename)
|
||||
:
|
||||
#if TROUBLE_PROVIDE_LINENO
|
||||
line_(line)
|
||||
@ -146,8 +146,7 @@ __cold std::string format_va(const char *fmt, va_list ap) {
|
||||
result.reserve(size_t(needed + 1));
|
||||
result.resize(size_t(needed), '\0');
|
||||
assert(int(result.capacity()) > needed);
|
||||
int actual = vsnprintf(const_cast<char *>(result.data()), result.capacity(),
|
||||
fmt, ones);
|
||||
int actual = vsnprintf(const_cast<char *>(result.data()), result.capacity(), fmt, ones);
|
||||
assert(actual == needed);
|
||||
(void)actual;
|
||||
va_end(ones);
|
||||
@ -176,16 +175,13 @@ public:
|
||||
};
|
||||
|
||||
__cold bug::bug(const trouble_location &location) noexcept
|
||||
: std::runtime_error(format("mdbx.bug: %s.%s at %s:%u", location.function(),
|
||||
location.condition(), location.filename(),
|
||||
location.line())),
|
||||
: std::runtime_error(format("mdbx.bug: %s.%s at %s:%u", location.function(), location.condition(),
|
||||
location.filename(), location.line())),
|
||||
location_(location) {}
|
||||
|
||||
__cold bug::~bug() noexcept {}
|
||||
|
||||
[[noreturn]] __cold void raise_bug(const trouble_location &what_and_where) {
|
||||
throw bug(what_and_where);
|
||||
}
|
||||
[[maybe_unused, noreturn]] __cold void raise_bug(const trouble_location &what_and_where) { throw bug(what_and_where); }
|
||||
|
||||
#define RAISE_BUG(line, condition, function, file) \
|
||||
do { \
|
||||
@ -193,6 +189,7 @@ __cold bug::~bug() noexcept {}
|
||||
raise_bug(bug); \
|
||||
} while (0)
|
||||
|
||||
#undef ENSURE
|
||||
#define ENSURE(condition) \
|
||||
do \
|
||||
if (MDBX_UNLIKELY(!(condition))) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user