diff options
author | Evan Martin <martine@danga.com> | 2011-09-12 18:44:12 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-09-12 18:46:18 (GMT) |
commit | 3fbb25b2cc66f236a39b728d20e5d44da23612ac (patch) | |
tree | d6eb7c1bc63ef3d4d4d1056750756dc581da5ef0 /src/stat_cache.h | |
parent | f1139aff5deddacd899be064fad9ed5a185e7444 (diff) | |
download | Ninja-3fbb25b2cc66f236a39b728d20e5d44da23612ac.zip Ninja-3fbb25b2cc66f236a39b728d20e5d44da23612ac.tar.gz Ninja-3fbb25b2cc66f236a39b728d20e5d44da23612ac.tar.bz2 |
generalize the pattern of hash_map<const char*, ...>, use in BuildLog
Refactor the code in StatCache for use in BuildLog. Now both use
hash tables where the keys are const char*. Removes another 30ms
from Chrome no-op builds.
Diffstat (limited to 'src/stat_cache.h')
-rw-r--r-- | src/stat_cache.h | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/stat_cache.h b/src/stat_cache.h index 1b9a8ff..9cb3eff 100644 --- a/src/stat_cache.h +++ b/src/stat_cache.h @@ -31,27 +31,7 @@ struct StatCache { void Dump(); void Reload(); - struct Key { - Key() : path(NULL) {} - Key(const char* p) : path(p) {} - - const char* path; - bool operator==(const Key& other) const { - return strcmp(path, other.path) == 0; - } - }; - - struct KeyHash { - size_t operator()(const StatCache::Key& key) const { -#ifdef _MSC_VER - return stdext::hash<const char*>()(key.path); -#else - return __gnu_cxx::hash<const char*>()(key.path); -#endif - } - }; - - typedef hash_map<Key, FileStat*, KeyHash> Paths; + typedef ExternalStringHashMap<FileStat*>::Type Paths; Paths paths_; }; |