summaryrefslogtreecommitdiff
path: root/src/common/nullpo.h
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2015-01-18 13:17:51 -0200
committershennetsind <ind@henn.et>2015-01-18 13:17:51 -0200
commit57789fb70b899eda61206a59283e1a849e544397 (patch)
treee90451205624140f8e47628f39fb2a6a9ec4e30b /src/common/nullpo.h
parentfb5d412a6a9813e1486b7a411ec6b5297209ca51 (diff)
downloadhercules-57789fb70b899eda61206a59283e1a849e544397.tar.gz
hercules-57789fb70b899eda61206a59283e1a849e544397.tar.bz2
hercules-57789fb70b899eda61206a59283e1a849e544397.tar.xz
hercules-57789fb70b899eda61206a59283e1a849e544397.zip
Implementing nullpo interface for plugin use
As proposed in pull request #361 Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/common/nullpo.h')
-rw-r--r--src/common/nullpo.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/common/nullpo.h b/src/common/nullpo.h
index 407f45403..573e351e0 100644
--- a/src/common/nullpo.h
+++ b/src/common/nullpo.h
@@ -27,7 +27,7 @@
#include <crtdbg.h>
#endif // !DEFCPP && WIN && !MINGW
#define Assert(EX) assert(EX)
-#define Assert_chk(EX) ( (EX) ? false : (assert_report(__FILE__, __LINE__, __func__, #EX, "failed assertion"), true) )
+#define Assert_chk(EX) ( (EX) ? false : (nullpo->assert_report(__FILE__, __LINE__, __func__, #EX, "failed assertion"), true) )
#else // ! ASSERT_CHECK
#define Assert(EX) (EX)
#define Assert_chk(EX) ((EX), false)
@@ -40,7 +40,7 @@
* @param t pointer to check
* @return true if the passed pointer is NULL, false otherwise
*/
-#define nullpo_chk(t) ( (t) != NULL ? false : (assert_report(__FILE__, __LINE__, __func__, #t, "nullpo info"), true) )
+#define nullpo_chk(t) ( (t) != NULL ? false : (nullpo->assert_report(__FILE__, __LINE__, __func__, #t, "nullpo info"), true) )
#else // ! NULLPO_CHECK
#define nullpo_chk(t) ((void)(t), false)
#endif // NULLPO_CHECK
@@ -123,8 +123,14 @@
if (Assert_chk(t)) break; else (void)0
+struct nullpo_interface {
+ void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title);
+};
+
+struct nullpo_interface *nullpo;
+
#ifdef HERCULES_CORE
-void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title);
+void nullpo_defaults(void);
#endif // HERCULES_CORE
#endif /* COMMON_NULLPO_H */