1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

StrFmt.h: remove some dead code with UB

Global variable is unused but written concurrently.
This commit is contained in:
Nekotekina 2019-08-18 05:19:11 +03:00
parent 7c5bde4aeb
commit 7a3aa02dc1

View File

@ -140,18 +140,9 @@ struct fmt_class_string
// Enum -> string function type // Enum -> string function type
using convert_t = const char*(*)(T value); using convert_t = const char*(*)(T value);
// Enum -> string function registered
static convert_t convert_enum;
// Helper function (safely converts arg to enum value) // Helper function (safely converts arg to enum value)
static SAFE_BUFFERS FORCE_INLINE void format_enum(std::string& out, u64 arg, convert_t convert) static SAFE_BUFFERS FORCE_INLINE void format_enum(std::string& out, u64 arg, convert_t convert)
{ {
// Save convert function
if (convert_enum == nullptr)
{
convert_enum = convert;
}
const auto value = static_cast<std::underlying_type_t<T>>(arg); const auto value = static_cast<std::underlying_type_t<T>>(arg);
// Check narrowing // Check narrowing
@ -203,9 +194,6 @@ struct fmt_class_string
static constexpr const char* unknown = nullptr; static constexpr const char* unknown = nullptr;
}; };
template <typename T, typename V>
const char*(*fmt_class_string<T, V>::convert_enum)(T) = nullptr;
template <> template <>
struct fmt_class_string<const void*, void> struct fmt_class_string<const void*, void>
{ {