blob: e61d52257e265e0a4a891c3b8c951342ea70a6e4 (
plain) (
tree)
|
|
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
#define HERCULES_CORE
#include "nullpo.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "../common/showmsg.h"
struct nullpo_interface nullpo_s;
/**
* 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 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";
ShowError("--- %s --------------------------------------------\n", title);
ShowError("%s:%d: '%s' in function `%s'\n", file, line, targetname, func);
ShowError("--- end %s ----------------------------------------\n", title);
}
/**
*
**/
void nullpo_defaults(void) {
nullpo = &nullpo_s;
nullpo->assert_report = assert_report;
}
|