From 7a788c724d8af3368d0521ea100032aba2c701c7 Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Sun, 27 Sep 2020 14:02:29 +0200 Subject: [PATCH] Don't assert() check_tagged, that causes assert failures in debug mode for code that works in release --- src/data/keyword.cpp | 4 ++-- src/util/tagged_string.hpp | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/data/keyword.cpp b/src/data/keyword.cpp index f999afbf..736cb206 100644 --- a/src/data/keyword.cpp +++ b/src/data/keyword.cpp @@ -774,7 +774,7 @@ void remove_from_stats(KeywordUsageStatistics* stat, const Value* stat_key) { String KeywordDatabase::expand(const String& text, KeywordExpandOptions const& options) const { assert(options.combine_script); - assert_tagged(text); + assert_tagged(text, false); // Clean up usage statistics remove_from_stats(options.stat, options.stat_key); @@ -794,7 +794,7 @@ String KeywordDatabase::expand(const String& text, KeywordExpandOptions const& o // Expand String result = expand_keywords(tagged, matches, options); - assert_tagged(result); + assert_tagged(result, false); return result; } diff --git a/src/util/tagged_string.hpp b/src/util/tagged_string.hpp index 9705e8d8..c538b37c 100644 --- a/src/util/tagged_string.hpp +++ b/src/util/tagged_string.hpp @@ -226,7 +226,11 @@ String tagged_substr_replace(const String& input, size_t start, size_t end, cons */ bool check_tagged(const String& str, bool check_balance = true); #ifdef _DEBUG - #define assert_tagged(...) assert(check_tagged(__VA_ARGS__)) + #if 0 + #define assert_tagged(...) assert(check_tagged(__VA_ARGS__)) + #else + #define assert_tagged(...) check_tagged(__VA_ARGS__) + #endif #else #define assert_tagged(...) do{}while(0) #endif