From 8a65faf45c7e29505471a8f09ed000e4bb190de5 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sun, 12 Mar 2017 15:12:44 +0000 Subject: [PATCH] Fixes to make safe_ptr work outside of kakoune. --- lib/kakoune/safe_ptr.hh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/kakoune/safe_ptr.hh b/lib/kakoune/safe_ptr.hh index 4d83a46..2b3d2b1 100644 --- a/lib/kakoune/safe_ptr.hh +++ b/lib/kakoune/safe_ptr.hh @@ -3,7 +3,11 @@ // #define SAFE_PTR_TRACK_CALLSTACKS -#include "assert.hh" +//King_DuckZ: +#include +#define kak_assert(a) assert(a) + +//#include "assert.hh" #include "ref_ptr.hh" #include @@ -57,6 +61,8 @@ struct SafeCountablePolicy ++sc->m_count; #ifdef SAFE_PTR_TRACK_CALLSTACKS sc->m_callstacks.emplace_back(ptr); + #else + static_cast(ptr); #endif } @@ -69,6 +75,8 @@ struct SafeCountablePolicy [=](const SafeCountable::Callstack& cs) { return cs.ptr == ptr; }); kak_assert(it != sc->m_callstacks.end()); sc->m_callstacks.erase(it); + #else + static_cast(ptr); #endif } @@ -79,6 +87,10 @@ struct SafeCountablePolicy [=](const SafeCountable::Callstack& cs) { return cs.ptr == from; }); kak_assert(it != sc->m_callstacks.end()); it->ptr = to; + #else + static_cast(sc); + static_cast(from); + static_cast(to); #endif } #else