From 3780f157e41e6a1661af0fb3f09f5c626ff85e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sun, 30 Aug 2020 10:25:11 +0200 Subject: [PATCH] Move the storage for deprecated lines in show_depreciation_warnings(). --- src/runner/pythonutils.cpp | 10 +++++----- src/runner/pythonutils.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runner/pythonutils.cpp b/src/runner/pythonutils.cpp index 8dcdd3d..088d1b6 100644 --- a/src/runner/pythonutils.cpp +++ b/src/runner/pythonutils.cpp @@ -7,12 +7,12 @@ #include "log.h" -// Contains the list of filename / line number for which a depreciation warning has already been shown. -static std::set> g_DeprecatedLines; - namespace utils { void show_depreciation_warning(std::string_view name, std::string_view message, bool show_once) { + + // Contains the list of filename / line number for which a depreciation warning has already been shown. + static std::set> DeprecatedLines; // Find the caller: auto inspect = bpy::import("inspect"); @@ -23,12 +23,12 @@ namespace utils { auto lineno = bpy::extract(callable_frame[-1].attr("lineno")); // Only show once if requested: - if (show_once && g_DeprecatedLines.contains({ filename, lineno })) { + if (show_once && DeprecatedLines.contains({ filename, lineno })) { return; } // Register the depreciation: - g_DeprecatedLines.emplace(filename, lineno); + DeprecatedLines.emplace(filename, lineno); auto path = relative(std::filesystem::path(filename), QCoreApplication::applicationDirPath().toStdWString()); diff --git a/src/runner/pythonutils.h b/src/runner/pythonutils.h index 40f4b6d..9d77594 100644 --- a/src/runner/pythonutils.h +++ b/src/runner/pythonutils.h @@ -200,7 +200,7 @@ namespace utils { /** * @brief Show a depreciation warning. - * + * * @param name Name of the deprecated function. * @param message Depreciation message. * @param show_once Only show the message once.