diff options
author | Haru <haru@dotalux.com> | 2013-12-14 15:14:23 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-12-17 01:02:33 +0100 |
commit | a23d072a66d2569ba13921522be3c82ae9aad576 (patch) | |
tree | 7e71523316ba55f2b08477331ecab561e53700d0 /src/common/nullpo.c | |
parent | 853c5a3141d1f431af95aed55d991334a2b995f6 (diff) | |
download | hercules-a23d072a66d2569ba13921522be3c82ae9aad576.tar.gz hercules-a23d072a66d2569ba13921522be3c82ae9aad576.tar.bz2 hercules-a23d072a66d2569ba13921522be3c82ae9aad576.tar.xz hercules-a23d072a66d2569ba13921522be3c82ae9aad576.zip |
Added support for non-aborting assertions
- Added Assert_ret, Assert_retv, Assert_retb, Assert_retr, working
similarly to the corresponding nullpo_ functions.
- Moved Assert-related macros to nullpo.h, since they share some
functions.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/nullpo.c')
-rw-r--r-- | src/common/nullpo.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/common/nullpo.c b/src/common/nullpo.c index f0fc2c7ab..20180dd3b 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.c @@ -4,20 +4,26 @@ #include <stdio.h> #include <stdarg.h> #include <string.h> -#include "nullpo.h" +#include "../common/nullpo.h" #include "../common/showmsg.h" /** - * Reports NULL pointer information + * Reports failed assertions or NULL pointers + * + * @param file Source file where the error was detected + * @param line Line + * @param func Function + * @param targetname Name of the checked symbol + * @param title Message title to display (i.e. failed assertion or nullpo info) */ -void nullpo_info(const char *file, int line, const char *func, const char *targetname) { +void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title) { if (file == NULL) file = "??"; if (func == NULL || *func == '\0') func = "unknown"; - ShowMessage("--- nullpo info --------------------------------------------\n"); - ShowMessage("%s:%d: target '%s' in func `%s'\n", file, line, targetname, func); - ShowMessage("--- end nullpo info ----------------------------------------\n"); + ShowError("--- %s --------------------------------------------\n", title); + ShowError("%s:%d: '%s' in function `%s'\n", file, line, targetname, func); + ShowError("--- end %s ----------------------------------------\n", title); } |