0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 06:51:08 +01:00

ircd::allocator::je: Simplify definition #ifdef related.

This commit is contained in:
Jason Volk 2020-05-10 18:34:59 -07:00
parent 1cc57495a4
commit bab494cafd

View file

@ -10,6 +10,10 @@
#include <RB_INC_JEMALLOC_H #include <RB_INC_JEMALLOC_H
#if defined(IRCD_ALLOCATOR_USE_JEMALLOC) && defined(HAVE_JEMALLOC_H)
#define IRCD_ALLOCATOR_JEMALLOC
#endif
namespace ircd::allocator namespace ircd::allocator
{ {
static std::function<void (std::ostream &, const string_view &)> je_stats_callback; static std::function<void (std::ostream &, const string_view &)> je_stats_callback;
@ -19,7 +23,7 @@ namespace ircd::allocator
extern info::versions je_malloc_version_abi; extern info::versions je_malloc_version_abi;
} }
#if defined(IRCD_ALLOCATOR_USE_JEMALLOC) && defined(HAVE_JEMALLOC_H) #if defined(IRCD_ALLOCATOR_USE_JEMALLOC)
const char * const char *
__attribute__((weak)) __attribute__((weak))
malloc_conf malloc_conf
@ -49,7 +53,7 @@ ircd::allocator::je_malloc_version_abi
"jemalloc", info::versions::ABI, //TODO: get this "jemalloc", info::versions::ABI, //TODO: get this
}; };
#if defined(IRCD_ALLOCATOR_USE_JEMALLOC) && defined(HAVE_JEMALLOC_H) #if defined(IRCD_ALLOCATOR_JEMALLOC)
bool bool
ircd::allocator::trim(const size_t &pad) ircd::allocator::trim(const size_t &pad)
noexcept noexcept
@ -58,7 +62,7 @@ noexcept
} }
#endif #endif
#if defined(IRCD_ALLOCATOR_USE_JEMALLOC) && defined(HAVE_JEMALLOC_H) #if defined(IRCD_ALLOCATOR_JEMALLOC)
ircd::string_view ircd::string_view
ircd::allocator::get(const string_view &key_, ircd::allocator::get(const string_view &key_,
const mutable_buffer &buf) const mutable_buffer &buf)
@ -75,7 +79,7 @@ ircd::allocator::get(const string_view &key_,
} }
#endif #endif
#if defined(IRCD_ALLOCATOR_USE_JEMALLOC) && defined(HAVE_JEMALLOC_H) #if defined(IRCD_ALLOCATOR_JEMALLOC)
ircd::string_view ircd::string_view
ircd::allocator::set(const string_view &key_, ircd::allocator::set(const string_view &key_,
const string_view &val, const string_view &val,
@ -111,7 +115,7 @@ catch(const std::bad_function_call &)
return; return;
} }
#if defined(IRCD_ALLOCATOR_USE_JEMALLOC) && defined(HAVE_JEMALLOC_H) #if defined(IRCD_ALLOCATOR_JEMALLOC)
ircd::string_view ircd::string_view
ircd::allocator::info(const mutable_buffer &buf) ircd::allocator::info(const mutable_buffer &buf)
{ {
@ -135,7 +139,7 @@ ircd::allocator::info(const mutable_buffer &buf)
} }
#endif #endif
#if defined(IRCD_ALLOCATOR_USE_JEMALLOC) && defined(HAVE_JEMALLOC_H) #if defined(IRCD_ALLOCATOR_JEMALLOC)
void void
ircd::allocator::scope::hook_init() ircd::allocator::scope::hook_init()
noexcept noexcept
@ -143,7 +147,7 @@ noexcept
} }
#endif #endif
#if defined(IRCD_ALLOCATOR_USE_JEMALLOC) && defined(HAVE_JEMALLOC_H) #if defined(IRCD_ALLOCATOR_JEMALLOC)
void void
ircd::allocator::scope::hook_fini() ircd::allocator::scope::hook_fini()
noexcept noexcept