diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-11-13 16:39:05 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-11-15 21:03:43 +0100 |
commit | cede7d61d912750e3bd04ef9d54f3ffd63fb308f (patch) | |
tree | 49c3bf8553811a790fbf991aee59448c99d9baad /crawl-ref/source/package.cc | |
parent | 1eb5ba87ee17c68aa806a7df4ce309b84829a593 (diff) | |
download | crawl-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/package.cc')
-rw-r--r-- | crawl-ref/source/package.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crawl-ref/source/package.cc b/crawl-ref/source/package.cc index cacd21e04d..7e124ca8ee 100644 --- a/crawl-ref/source/package.cc +++ b/crawl-ref/source/package.cc @@ -563,7 +563,7 @@ void package::read_directory(plen_t start, uint8_t version) bool package::has_chunk(const string name) { - return !name.empty() && directory.find(name) != directory.end(); + return !name.empty() && directory.count(name); } vector<string> package::list_chunks() @@ -645,7 +645,7 @@ plen_t package::get_slack() plen_t package::get_chunk_fragmentation(const string name) { load_traces(); - ASSERT(directory.find(name) != directory.end()); // not has_chunk(), "" is valid + ASSERT(directory.count(name)); // not has_chunk(), "" is valid plen_t frags = 0; plen_t at = directory[name]; while (at) @@ -661,7 +661,7 @@ plen_t package::get_chunk_fragmentation(const string name) plen_t package::get_chunk_compressed_length(const string name) { load_traces(); - ASSERT(directory.find(name) != directory.end()); // not has_chunk(), "" is valid + ASSERT(directory.count(name)); // not has_chunk(), "" is valid plen_t len = 0; plen_t at = directory[name]; while (at) |