diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2011-03-01 16:55:34 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2011-03-01 16:55:34 -0800 |
commit | 0acc2454cacb3ccab512b41b96cbaa024ebb0117 (patch) | |
tree | 9c84c96681fd13c2ffd96eb92da09884058c3fa0 /src/cstore | |
parent | cf5c5f6a492bb92b25aeb880e46e9df2560a4c2e (diff) | |
download | vyatta-cfg-0acc2454cacb3ccab512b41b96cbaa024ebb0117.tar.gz vyatta-cfg-0acc2454cacb3ccab512b41b96cbaa024ebb0117.zip |
tweak map iterator usage
Diffstat (limited to 'src/cstore')
-rw-r--r-- | src/cstore/cstore.cpp | 6 | ||||
-rw-r--r-- | src/cstore/unionfs/cstore-unionfs.cpp | 8 | ||||
-rw-r--r-- | src/cstore/unionfs/cstore-unionfs.hpp | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/cstore/cstore.cpp b/src/cstore/cstore.cpp index f32e6ec..91d82e3 100644 --- a/src/cstore/cstore.cpp +++ b/src/cstore/cstore.cpp @@ -1980,10 +1980,12 @@ Cstore::sort_func_deb_version(string a, string b) void Cstore::sort_nodes(vector<string>& nvec, unsigned int sort_alg) { - if (_sort_func_map.find(sort_alg) == _sort_func_map.end()) { + Cstore::MapT<unsigned int, Cstore::SortFuncT>::iterator p + = _sort_func_map.find(sort_alg); + if (p == _sort_func_map.end()) { return; } - sort(nvec.begin(), nvec.end(), _sort_func_map[sort_alg]); + sort(nvec.begin(), nvec.end(), p->second); } /* try to append the logical path to template path. diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp index 50aefb5..af4075c 100644 --- a/src/cstore/unionfs/cstore-unionfs.cpp +++ b/src/cstore/unionfs/cstore-unionfs.cpp @@ -82,7 +82,7 @@ _escape_char(char c) { Cstore::MapT<char, string>::iterator p = _fs_escape_chars.find(c); if (p != _fs_escape_chars.end()) { - return _fs_escape_chars[c]; + return p->second; } else { return string(1, c); } @@ -97,7 +97,7 @@ _escape_path_name(const string& path) = _escape_path_name_cache.find(path); if (p != _escape_path_name_cache.end()) { // found escaped string in cache. just return it. - return _escape_path_name_cache[path]; + return p->second; } // special case for empty string @@ -120,7 +120,7 @@ _unescape_path_name(const string& path) = _unescape_path_name_cache.find(path); if (p != _unescape_path_name_cache.end()) { // found unescaped string in cache. just return it. - return _unescape_path_name_cache[path]; + return p->second; } // assume all escape patterns are 3-char @@ -133,7 +133,7 @@ _unescape_path_name(const string& path) string s = path.substr(i, 3); Cstore::MapT<string, char>::iterator p = _fs_unescape_chars.find(s); if (p != _fs_unescape_chars.end()) { - char c = _fs_unescape_chars[s]; + char c = p->second; if (path.size() == 3 && c == -1) { // special case for empty string npath = ""; diff --git a/src/cstore/unionfs/cstore-unionfs.hpp b/src/cstore/unionfs/cstore-unionfs.hpp index 82bda2a..47bfe26 100644 --- a/src/cstore/unionfs/cstore-unionfs.hpp +++ b/src/cstore/unionfs/cstore-unionfs.hpp @@ -136,7 +136,7 @@ private: if (it == saved_paths.end()) { exit_internal("restore_paths: handle not found\n"); } - pair<b_fs::path, b_fs::path> p = saved_paths[handle]; + pair<b_fs::path, b_fs::path> p = it->second; mutable_cfg_path = p.first; tmpl_path = p.second; }; |