aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-09 09:23:47 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-09 09:23:47 +0000
commit7f7c79fcc67df4fae498ca943e36592d3f7a3ad2 (patch)
tree213ad2f92de66fc4770b65a3675d9fb6f857b936
parent93b40cd8b07025c1d6aa5d489ce661c85c9c0219 (diff)
downloadpaludis-7f7c79fcc67df4fae498ca943e36592d3f7a3ad2.tar.gz
paludis-7f7c79fcc67df4fae498ca943e36592d3f7a3ad2.tar.xz
Fix segfault
-rw-r--r--paludis/format_messages_output_manager.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/paludis/format_messages_output_manager.cc b/paludis/format_messages_output_manager.cc
index 2d4df9e..a6f4e12 100644
--- a/paludis/format_messages_output_manager.cc
+++ b/paludis/format_messages_output_manager.cc
@@ -178,15 +178,17 @@ FormatMessagesOutputManager::factory_managers()
namespace
{
- std::string format_message(
- const OutputManagerFactory::ReplaceVarsFunc r,
- const std::string & f,
- const std::string & s)
+ struct FormatMessage
{
- std::shared_ptr<Map<std::string, std::string> > m(std::make_shared<Map<std::string, std::string>>());
- m->insert("message", s);
- return r(f, m);
- }
+ const OutputManagerFactory::ReplaceVarsFunc r;
+
+ std::string operator() (const std::string & f, const std::string & s)
+ {
+ std::shared_ptr<Map<std::string, std::string> > m(std::make_shared<Map<std::string, std::string>>());
+ m->insert("message", s);
+ return r(f, m);
+ }
+ };
}
const std::shared_ptr<OutputManager>
@@ -205,11 +207,8 @@ FormatMessagesOutputManager::factory_create(
std::shared_ptr<OutputManager> child(create_child_function(child_s));
- FormatMessagesOutputManagerFormatFunction format_func(std::bind(
- &format_message, std::cref(replace_vars_func), std::placeholders::_1, std::placeholders::_2));
-
return std::make_shared<FormatMessagesOutputManager>(
- child, format_debug_s, format_info_s, format_warn_s, format_error_s, format_log_s, format_status_s, format_func);
+ child, format_debug_s, format_info_s, format_warn_s, format_error_s, format_log_s, format_status_s, FormatMessage{replace_vars_func});
}
template class Pimp<FormatMessagesOutputManager>;