From e4b8ef1fb668bcdc1fd1398d50aab44c4ffe32c9 Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Sun, 16 May 2021 22:31:30 +0000 Subject: [PATCH] Fix --with-valgrind-debug build broken by commit 02f5357 (#822) error: cbdata_htable was not declared in this scope --- src/cbdata.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/cbdata.cc b/src/cbdata.cc index a32e579c8e..81054ebf5c 100644 --- a/src/cbdata.cc +++ b/src/cbdata.cc @@ -90,14 +90,7 @@ public: {} ~cbdata(); - static cbdata *FromUserData(const void *p) { -#if WITH_VALGRIND - return cbdata_htable.at(p); -#else - const auto t = static_cast(p) - offsetof(cbdata, data); - return reinterpret_cast(const_cast(t)); -#endif - } + static cbdata *FromUserData(const void *); int valid; int32_t locks; @@ -168,6 +161,16 @@ cbdata::~cbdata() cbdata_index[type].pool->freeOne(p); } +cbdata * +cbdata::FromUserData(const void *p) { +#if WITH_VALGRIND + return cbdata_htable.at(p); +#else + const auto t = static_cast(p) - offsetof(cbdata, data); + return reinterpret_cast(const_cast(t)); +#endif +} + static void cbdataInternalInitType(cbdata_type type, const char *name, int size) { -- 2.47.2