summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-06 17:50:26 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-06 17:50:26 +0100
commitb1336faa48bee2cdb7ef0486a5a4faa5c74f4fa7 (patch)
treea86ee9bbd505b68d57a189418df152d48a1e852d /inc
parent3a62ede25114452938acb8e1a67006633b139efc (diff)
downloadabrt-b1336faa48bee2cdb7ef0486a5a4faa5c74f4fa7.tar.gz
abrt-b1336faa48bee2cdb7ef0486a5a4faa5c74f4fa7.tar.xz
abrt-b1336faa48bee2cdb7ef0486a5a4faa5c74f4fa7.zip
make exception handling lighter
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'inc')
-rw-r--r--inc/ABRTException.h37
-rw-r--r--inc/abrtlib.h2
2 files changed, 23 insertions, 16 deletions
diff --git a/inc/ABRTException.h b/inc/ABRTException.h
index 730faf3b..173f45fc 100644
--- a/inc/ABRTException.h
+++ b/inc/ABRTException.h
@@ -3,33 +3,40 @@
#include <string>
-typedef enum {EXCEP_UNKNOW,
- EXCEP_DD_OPEN,
- EXCEP_DD_LOAD,
- EXCEP_DD_SAVE,
- EXCEP_DD_DELETE,
- EXCEP_DL,
- EXCEP_PLUGIN,
- EXCEP_ERROR,
- EXCEP_FATAL} abrt_exception_t;
+typedef enum {
+ EXCEP_UNKNOW,
+ EXCEP_DD_OPEN,
+ EXCEP_DD_LOAD,
+ EXCEP_DD_SAVE,
+ EXCEP_DD_DELETE,
+ EXCEP_DL,
+ EXCEP_PLUGIN,
+ EXCEP_ERROR,
+ EXCEP_FATAL,
+} abrt_exception_t;
-class CABRTException : public std::exception
+/* std::exception is a class with virtual members.
+ * deriving from it makes our ctor/dtor much more heavy,
+ * and those are inlined in every throw and catch site!
+ */
+class CABRTException /*: public std::exception*/
{
private:
std::string m_sWhat;
abrt_exception_t m_Type;
+
public:
- virtual ~CABRTException() throw() {}
- CABRTException(const abrt_exception_t& pType, const char* pWhat) :
+ /* virtual ~CABRTException() throw() {} */
+ CABRTException(abrt_exception_t pType, const char* pWhat) :
m_sWhat(pWhat),
m_Type(pType)
{}
- CABRTException(const abrt_exception_t& pType, const std::string& pWhat) :
+ CABRTException(abrt_exception_t pType, const std::string& pWhat) :
m_sWhat(pWhat),
m_Type(pType)
{}
abrt_exception_t type() { return m_Type; }
- std::string what() { return m_sWhat; }
+ const char* what() const { return m_sWhat.c_str(); }
};
-#endif /* ABRTEXCEPTION_H_ */
+#endif
diff --git a/inc/abrtlib.h b/inc/abrtlib.h
index d20d067f..9bcd5bfb 100644
--- a/inc/abrtlib.h
+++ b/inc/abrtlib.h
@@ -212,7 +212,7 @@ std::string concat_path_file(const char *path, const char *filename);
template <class T>
std::string
-to_string( T x )
+to_string(T x)
{
std::ostringstream o;
o << x;