summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/macro.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-11-13 16:39:05 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-11-15 21:03:43 +0100
commitcede7d61d912750e3bd04ef9d54f3ffd63fb308f (patch)
tree49c3bf8553811a790fbf991aee59448c99d9baad /crawl-ref/source/macro.cc
parent1eb5ba87ee17c68aa806a7df4ce309b84829a593 (diff)
downloadcrawl-ref-cede7d61d912750e3bd04ef9d54f3ffd63fb308f.tar.gz
crawl-ref-cede7d61d912750e3bd04ef9d54f3ffd63fb308f.zip
Don't allocate pointless iterators.
map or set.count() can test the presence of a given key and return 0 or 1 outright.
Diffstat (limited to 'crawl-ref/source/macro.cc')
-rw-r--r--crawl-ref/source/macro.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc
index 9551c59e8a..5fe67cbf4e 100644
--- a/crawl-ref/source/macro.cc
+++ b/crawl-ref/source/macro.cc
@@ -953,7 +953,7 @@ void macro_add_query(void)
msgwin_reply(vtostr(key));
- if (mapref.find(key) != mapref.end() && !mapref[key].empty())
+ if (mapref.count(key) && !mapref[key].empty())
{
string action = vtostr(mapref[key]);
action = replace_all(action, "<", "<<");
@@ -1173,7 +1173,7 @@ void init_keybindings()
command_name &data = _command_name_list[i];
ASSERT(VALID_BIND_COMMAND(data.cmd));
- ASSERT(_names_to_cmds.find(data.name) == _names_to_cmds.end());
+ ASSERT(!_names_to_cmds.count(data.name));
ASSERT(_cmds_to_names.find(data.cmd) == _cmds_to_names.end());
_names_to_cmds[data.name] = data.cmd;
@@ -1197,7 +1197,7 @@ void init_keybindings()
// Only one command per key, but it's okay to have several
// keys map to the same command.
- ASSERT(key_map.find(data.key) == key_map.end());
+ ASSERT(!key_map.count(data.key));
key_map[data.key] = data.cmd;
cmd_map[data.cmd] = data.key;