mirror of
https://github.com/gbdev/rgbds.git
synced 2026-09-23 22:27:06 +00:00
Refactor warning diagnostic code to reduce repeated output logic
This commit is contained in:
+2
-5
@@ -6,6 +6,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "diagnostics.hpp" // vfatalx
|
||||
#include "helpers.hpp"
|
||||
#include "platform.hpp"
|
||||
#include "style.hpp"
|
||||
@@ -156,13 +157,9 @@ void Usage::printAndExit(int code) const {
|
||||
|
||||
void Usage::printAndExit(char const *fmt, ...) const {
|
||||
va_list args;
|
||||
style_Set(stderr, STYLE_RED, true);
|
||||
fputs("FATAL: ", stderr);
|
||||
style_Reset(stderr);
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
vfatalx(fmt, args);
|
||||
va_end(args);
|
||||
putc('\n', stderr);
|
||||
|
||||
printAndExit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user