From c1387dc5920baf8f0f539a3ef490e0c6fcfb5e2d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 17 Oct 2012 17:01:08 +0200 Subject: [PATCH] assert: simplify header --- src/assert.cc | 20 +++++++++++--------- src/assert.hh | 13 +------------ 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/assert.cc b/src/assert.cc index 0c4e85f3..d906a48c 100644 --- a/src/assert.cc +++ b/src/assert.cc @@ -1,21 +1,23 @@ #include "assert.hh" +#include "exception.hh" + namespace Kakoune { -assert_failed::assert_failed(const String& message) +struct assert_failed : logic_error { - m_message = message; -} + assert_failed(const String& message) + : m_message(message) {} -String assert_failed::description() const -{ - return m_message; -} + String description() const override { return m_message; } +private: + String m_message; +}; -void on_assert_failed(const String& message) +void on_assert_failed(const char* message) { - int res = system(("xmessage -buttons 'quit:0,ignore:1' '" + message + "'").c_str()); + int res = system(("xmessage -buttons 'quit:0,ignore:1' '"_str + message + "'").c_str()); switch (res) { case 0: diff --git a/src/assert.hh b/src/assert.hh index 0ec5db90..182b58a4 100644 --- a/src/assert.hh +++ b/src/assert.hh @@ -1,21 +1,10 @@ #ifndef assert_hh_INCLUDED #define assert_hh_INCLUDED -#include "exception.hh" - namespace Kakoune { -struct assert_failed : logic_error -{ - assert_failed(const String& message); - String description() const override; - -private: - String m_message; -}; - -void on_assert_failed(const String& message); +void on_assert_failed(const char* message); }