summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-06-14 08:58:57 -0400
committerLioncash <mathew1800@gmail.com>2018-06-14 09:04:57 -0400
commitd459470feef32756f2e6aed9d1670d6cf2d38341 (patch)
treeb85aef66433994b980fb133818169c44b2e47fba /Source/Core
parente8c1e5af63612faaf758329ce5eb602124fd9d87 (diff)
HotkeyManager: Convert file-scope std::string array to constexpr const char* array
Previously, a total of 114 std::string instances would need to construct (allocating on the heap for larger strings that can't be stored with small string optimizations). We can just use an array of const char* strings instead, which allows us to avoid this.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HotkeyManager.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/Source/Core/Core/HotkeyManager.cpp b/Source/Core/Core/HotkeyManager.cpp
index 67086b593c..7b3f04a5e6 100644
--- a/Source/Core/Core/HotkeyManager.cpp
+++ b/Source/Core/Core/HotkeyManager.cpp
@@ -20,7 +20,7 @@
#include "InputCommon/GCPadStatus.h"
// clang-format off
-const std::string hotkey_labels[] = {
+constexpr std::array<const char*, 114> hotkey_labels{{
_trans("Open"),
_trans("Change Disc"),
_trans("Eject Disc"),
@@ -154,10 +154,9 @@ const std::string hotkey_labels[] = {
_trans("Undo Save State"),
_trans("Save State"),
_trans("Load State"),
-};
+}};
// clang-format on
-static_assert(NUM_HOTKEYS == sizeof(hotkey_labels) / sizeof(hotkey_labels[0]),
- "Wrong count of hotkey_labels");
+static_assert(NUM_HOTKEYS == hotkey_labels.size(), "Wrong count of hotkey_labels");
namespace HotkeyManagerEmu
{