From c425acdb51f6b1dfcfd6e5ff56a4c3967507ccba Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Fri, 20 Mar 2026 13:45:24 -0400 Subject: Wrap LogTrace FV/F functions with BN_ENABLE_LOG_TRACE guard The *FV and *F variants were unconditionally calling fmt::vformat (allocating/formatting strings) even when trace logging was compiled out, since only the underlying LogTrace* callees were guarded. Co-Authored-By: Claude Sonnet 4.6 --- binaryninjaapi.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 2feff8d8..7b46f97f 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -944,7 +944,9 @@ namespace BinaryNinja { template void LogTraceF(fmt::format_string format, T&&... args) { +#ifdef BN_ENABLE_LOG_TRACE LogTraceFV(format, fmt::make_format_args(args...)); +#endif } /*! LogDebug only writes text to the error console if the console is set to log level: DebugLog @@ -1058,7 +1060,9 @@ namespace BinaryNinja { template void LogTraceForExceptionF(const std::exception& e, fmt::format_string format, T&&... args) { +#ifdef BN_ENABLE_LOG_TRACE LogTraceForExceptionFV(e, format, fmt::make_format_args(args...)); +#endif } /*! LogDebugForExceptionF only writes text to the error console if the console is set to log level: DebugLog @@ -1175,7 +1179,9 @@ namespace BinaryNinja { template void LogTraceWithStackTraceF(fmt::format_string format, T&&... args) { +#ifdef BN_ENABLE_LOG_TRACE LogTraceWithStackTraceFV(format, fmt::make_format_args(args...)); +#endif } /*! LogDebugWithStackTraceF only writes text to the error console if the console is set to log level: DebugLog @@ -1581,7 +1587,9 @@ namespace BinaryNinja { template void LogTraceF(fmt::format_string format, T&&... args) { +#ifdef BN_ENABLE_LOG_TRACE LogTraceFV(format, fmt::make_format_args(args...)); +#endif } /*! LogDebug only writes text to the error console if the console is set to log level: DebugLog @@ -1682,7 +1690,9 @@ namespace BinaryNinja { template void LogTraceForExceptionF(const std::exception& e, fmt::format_string format, T&&... args) { +#ifdef BN_ENABLE_LOG_TRACE LogTraceForExceptionFV(e, format, fmt::make_format_args(args...)); +#endif } /*! LogDebugForExceptionF only writes text to the error console if the console is set to log level: @@ -1785,7 +1795,9 @@ namespace BinaryNinja { template void LogTraceWithStackTraceF(fmt::format_string format, T&&... args) { +#ifdef BN_ENABLE_LOG_TRACE LogTraceWithStackTraceFV(format, fmt::make_format_args(args...)); +#endif } /*! LogDebugWithStackTraceF only writes text to the error console if the console is set to log level: -- cgit v1.3.1