Skip to content
Permalink
Browse files

keycode.cpp: use std::unordered_map for keypress cache

  • Loading branch information
nerzhul committed Sep 21, 2017
1 parent 69f3c42 commit 080899b0f1f3c48e9038bff806815016d2b45508
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/keycode.cpp
@@ -359,13 +359,13 @@ const KeyPress CancelKey("KEY_CANCEL");
*/

// A simple cache for quicker lookup
std::map<std::string, KeyPress> g_key_setting_cache;
std::unordered_map<std::string, KeyPress> g_key_setting_cache;

KeyPress getKeySetting(const char *settingname)
{
std::map<std::string, KeyPress>::iterator n;
std::unordered_map<std::string, KeyPress>::iterator n;
n = g_key_setting_cache.find(settingname);
if(n != g_key_setting_cache.end())
if (n != g_key_setting_cache.end())
return n->second;

KeyPress k(g_settings->get(settingname).c_str());

0 comments on commit 080899b

Please sign in to comment.
You can’t perform that action at this time.