mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-17 06:05:44 +01:00
don't make the functions extern anymore, as we're no longer doing ffi.
This commit is contained in:
20
src/error.h
20
src/error.h
@@ -8,11 +8,11 @@
|
||||
|
||||
#define ERROR_BUF_SIZE 128
|
||||
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) extern inline void debug(char const*, ...); // prints a '\n' suffixed debug msg to stdout with a maximum buf size of @ref ERROR_BUF_SIZE
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) extern inline void info(char const*, ...); // prints a '\n' suffixed info msg to stdout with a maximum buf size of @ref ERROR_BUF_SIZE
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) extern inline void warn(char const*, ...); // prints a '\n' suffixed warn msg to stderr with a maximum buf size of @ref ERROR_BUF_SIZE
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) extern inline void error(char const*, ...); // prints a '\n' suffixed error msg to stderr with a maximum buf size of @ref ERROR_BUF_SIZE
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) noreturn extern inline void fatal(char const*, ...); // prints a '\n' suffixed fatal msg to stderr with a maximum buf size of @ref ERROR_BUF_SIZE and immediately aborts execution
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) static inline void debug(char const*, ...); // prints a '\n' suffixed debug msg to stdout with a maximum buf size of @ref ERROR_BUF_SIZE
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) static inline void info(char const*, ...); // prints a '\n' suffixed info msg to stdout with a maximum buf size of @ref ERROR_BUF_SIZE
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) static inline void warn(char const*, ...); // prints a '\n' suffixed warn msg to stderr with a maximum buf size of @ref ERROR_BUF_SIZE
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) static inline void error(char const*, ...); // prints a '\n' suffixed error msg to stderr with a maximum buf size of @ref ERROR_BUF_SIZE
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) noreturn static inline void fatal(char const*, ...); // prints a '\n' suffixed fatal msg to stderr with a maximum buf size of @ref ERROR_BUF_SIZE and immediately aborts execution
|
||||
|
||||
// macro to write fmt vardiac args to buf
|
||||
#define WRITE_VA_ARGS(buf, fmt) \
|
||||
@@ -23,31 +23,31 @@ atrb_nonnull(1) atrb_format(printf, 1, 2) noreturn extern inline void fatal(char
|
||||
va_end(args); \
|
||||
};
|
||||
|
||||
extern inline void debug(char const* restrict fmt, ...) {
|
||||
static inline void debug(char const* restrict fmt, ...) {
|
||||
char buf[ERROR_BUF_SIZE] = {0};
|
||||
WRITE_VA_ARGS(buf, fmt);
|
||||
printf("\033[95mD: \"%s\"\033[0m\n", buf); // reduced parameter use by not using fprintf
|
||||
}
|
||||
|
||||
extern inline void info(char const* fmt, ...) {
|
||||
static inline void info(char const* fmt, ...) {
|
||||
char buf[ERROR_BUF_SIZE] = {0};
|
||||
WRITE_VA_ARGS(buf, fmt);
|
||||
printf("I: \"%s\"\n", buf);
|
||||
}
|
||||
|
||||
extern inline void warn(char const* fmt, ...) {
|
||||
static inline void warn(char const* fmt, ...) {
|
||||
char buf[ERROR_BUF_SIZE] = {0};
|
||||
WRITE_VA_ARGS(buf, fmt);
|
||||
fprintf(stderr, "\033[93mW: \"%s\"\033[0m\n", buf);
|
||||
}
|
||||
|
||||
extern inline void error(char const* fmt, ...) {
|
||||
static inline void error(char const* fmt, ...) {
|
||||
char buf[ERROR_BUF_SIZE] = {0};
|
||||
WRITE_VA_ARGS(buf, fmt);
|
||||
fprintf(stderr, "\033[91mE: \"%s\"\033[0m\n", buf);
|
||||
}
|
||||
|
||||
extern inline void fatal(char const* fmt, ...) {
|
||||
static inline void fatal(char const* fmt, ...) {
|
||||
char buf[ERROR_BUF_SIZE] = {0};
|
||||
WRITE_VA_ARGS(buf, fmt);
|
||||
fprintf(stderr, "\033[101mF: \"%s\"\033[0m\n", buf);
|
||||
|
||||
Reference in New Issue
Block a user