summaryrefslogtreecommitdiff
path: root/generic/Exceptions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'generic/Exceptions.cpp')
-rw-r--r--generic/Exceptions.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/generic/Exceptions.cpp b/generic/Exceptions.cpp
index b7c00a6..510e0a3 100644
--- a/generic/Exceptions.cpp
+++ b/generic/Exceptions.cpp
@@ -3,7 +3,9 @@
#include <string.h>
#include <errno.h>
#include <stddef.h>
+#ifdef HAVE_GLIB
#include <glib.h>
+#endif
#ifdef DEBUG
#include <iostream>
#endif
@@ -40,7 +42,7 @@ GeneralException::~GeneralException() {
TaskNotFound::TaskNotFound() : GeneralException("Task not found") { }
-char * GeneralException::GetMsg() {
+const char * GeneralException::GetMsg() const {
return msg;
}
@@ -71,6 +73,16 @@ TaskSwitch::TaskSwitch() : GeneralException(_("Switching task in a non-tasked en
#endif
}
+Exit::Exit(int a_code) : GeneralException(_("Exitting with code " + a_code)), code(a_code) {
+#ifdef DEBUG
+ cerr << "Generating an Exit exception: '" << GetMsg() << "'.\n";
+#endif
+}
+
+int Exit::GetCode() {
+ return code;
+}
+
char * xstrdup(const char * s) {
char * r;
@@ -108,9 +120,9 @@ void * xrealloc(void * ptr, size_t s) {
#endif
}
-#ifdef OVER_FREE
-#undef free
-#endif
+void xfree(unsigned char *& p) {
+ xfree(((char *)p));
+}
void xfree(void *& p) {
xfree(((char *)p));