Standardize assert
This commit is contained in:
@@ -204,6 +204,7 @@ set(SOURCE_FILES
|
||||
|
||||
src/kernel/sys.c
|
||||
|
||||
src/libc/assert.c
|
||||
src/libc/ctype.c
|
||||
src/libc/stdio.c
|
||||
src/libc/string.c
|
||||
|
||||
@@ -15,18 +15,8 @@
|
||||
/// @param file The file where the assertion is located.
|
||||
/// @param line The line inside the file.
|
||||
/// @param function The function where the assertion is.
|
||||
static void __assert_fail(const char *assertion, const char *file,
|
||||
unsigned int line, const char *function)
|
||||
{
|
||||
char message[1024];
|
||||
sprintf(message,
|
||||
"FILE: %s\n"
|
||||
"LINE: %d\n"
|
||||
"FUNC: %s\n\n"
|
||||
"Assertion `%s` failed.\n",
|
||||
file, line, (function ? function : "NO_FUN"), assertion);
|
||||
kernel_panic(message);
|
||||
}
|
||||
void __assert_fail(const char *assertion, const char *file, unsigned int line,
|
||||
const char *function);
|
||||
|
||||
/// @brief Assert function.
|
||||
#define assert(expression) \
|
||||
|
||||
+10
-15
@@ -8,20 +8,15 @@
|
||||
#include "stdio.h"
|
||||
#include "panic.h"
|
||||
|
||||
void __assert_fail(const char *assertion,
|
||||
const char *file,
|
||||
unsigned int line,
|
||||
const char *function)
|
||||
void __assert_fail(const char *assertion, const char *file, unsigned int line,
|
||||
const char *function)
|
||||
{
|
||||
char message[1024];
|
||||
sprintf(message,
|
||||
"FILE: %s\n"
|
||||
"LINE: %d\n"
|
||||
"FUNC: %s\n\n"
|
||||
"Assertion `%s` failed.\n",
|
||||
file,
|
||||
line,
|
||||
(function ? function : "NO_FUN"),
|
||||
assertion);
|
||||
kernel_panic(message);
|
||||
char message[1024];
|
||||
sprintf(message,
|
||||
"FILE: %s\n"
|
||||
"LINE: %d\n"
|
||||
"FUNC: %s\n\n"
|
||||
"Assertion `%s` failed.\n",
|
||||
file, line, (function ? function : "NO_FUN"), assertion);
|
||||
kernel_panic(message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user