diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-09-16 19:57:57 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-09-16 20:02:12 +0100 |
| commit | 693d9a4861c7a6019c082c8d1f773c362a56e62e (patch) | |
| tree | 0e2c0b2cf05a87db00dd0032de0682328adb8b9c /src/hook_manager.cc | |
| parent | afad50514b6653c1bfa767306d857f939de2eb02 (diff) | |
Store key hash in IdMap
Diffstat (limited to 'src/hook_manager.cc')
| -rw-r--r-- | src/hook_manager.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/hook_manager.cc b/src/hook_manager.cc index 9cdfb10b..49a09f3b 100644 --- a/src/hook_manager.cc +++ b/src/hook_manager.cc @@ -21,7 +21,7 @@ void HookManager::remove_hooks(StringView group) if (group.empty()) throw runtime_error("invalid id"); for (auto& hooks : m_hook) - hooks.second.remove_all(group); + hooks.value.remove_all(group); } CandidateList HookManager::complete_hook_group(StringView prefix, ByteCount pos_in_token) @@ -29,7 +29,7 @@ CandidateList HookManager::complete_hook_group(StringView prefix, ByteCount pos_ CandidateList res; for (auto& list : m_hook) { - auto container = transformed(list.second, IdMap<HookFunc>::get_id); + auto container = transformed(list.value, decltype(list.value)::get_id); for (auto& c : complete(prefix, pos_in_token, container)) { if (!contains(res, c)) @@ -51,21 +51,21 @@ void HookManager::run_hook(StringView hook_name, auto& disabled_hooks = context.options()["disabled_hooks"].get<Regex>(); bool hook_error = false; - for (auto& hook : hook_list_it->second) + for (auto& hook : hook_list_it->value) { - if (not hook.first.empty() and not disabled_hooks.empty() and - regex_match(hook.first.begin(), hook.first.end(), disabled_hooks)) + if (not hook.key.empty() and not disabled_hooks.empty() and + regex_match(hook.key.begin(), hook.key.end(), disabled_hooks)) continue; try { - hook.second(param, context); + hook.value(param, context); } catch (runtime_error& err) { hook_error = true; write_to_debug_buffer(format("error running hook {}/{}: {}", - hook_name, hook.first, err.what())); + hook_name, hook.key, err.what())); } } |
