refactor code with new formatting rules

Functions now break before their brace, mirroring the Linux kernel.
The reason for this is that breaking the parameter list otherwise makes
code unreadable.
This commit is contained in:
2025-10-09 18:43:09 +02:00
parent eb45650178
commit 00719b1933
14 changed files with 137 additions and 73 deletions

View File

@@ -7,15 +7,15 @@
#include "../types.h"
static void error_log(FILE *restrict stream, const char *restrict pfx, uint ln, const char *restrict file, const char *restrict fmt, va_list ap) {
static void error_log(FILE *restrict stream, const char *restrict pfx, uint ln, const char *restrict file, const char *restrict fmt, va_list ap)
{
fprintf(stream, "(%s:%u) [%s] '", file, ln, pfx);
vfprintf(stream, fmt, ap);
fprintf(stream, "'\n");
}
void error_debug(uint ln, const char *restrict file, const char *restrict fmt, ...) {
void error_debug(uint ln, const char *restrict file, const char *restrict fmt, ...)
{
#ifndef NDEBUG
#else
char *env = getenv("DEBUG");
@@ -28,28 +28,32 @@ void error_debug(uint ln, const char *restrict file, const char *restrict fmt, .
va_end(ap);
}
void error_info(uint ln, const char *restrict file, const char *restrict fmt, ...) {
void error_info(uint ln, const char *restrict file, const char *restrict fmt, ...)
{
va_list ap;
va_start(ap, fmt);
error_log(stdout, "\033[94mINF\033[0m", ln, file, fmt, ap);
va_end(ap);
}
void error_warn(uint ln, const char *restrict file, const char *restrict fmt, ...) {
void error_warn(uint ln, const char *restrict file, const char *restrict fmt, ...)
{
va_list ap;
va_start(ap, fmt);
error_log(stdout, "\033[93mWAR\033[0m", ln, file, fmt, ap);
va_end(ap);
}
void error_error(uint ln, const char *restrict file, const char *restrict fmt, ...) {
void error_error(uint ln, const char *restrict file, const char *restrict fmt, ...)
{
va_list ap;
va_start(ap, fmt);
error_log(stdout, "\033[91mERR\033[0m", ln, file, fmt, ap);
va_end(ap);
}
void error_fatal(uint ln, const char *restrict file, const char *restrict fmt, ...) {
void error_fatal(uint ln, const char *restrict file, const char *restrict fmt, ...)
{
va_list ap;
va_start(ap, fmt);
error_log(stdout, "\033[101mFAT\033[0m", ln, file, fmt, ap);