mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-09 08:25:16 +00:00
add more utilities
This commit is contained in:
parent
86e2d8b129
commit
d7f486fdc9
4 changed files with 47 additions and 0 deletions
26
rx/src/die.cpp
Normal file
26
rx/src/die.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
#include "die.hpp"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
void rx::die(const char *message, ...) {
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
std::vfprintf(stderr, message, args);
|
||||
std::fprintf(stderr, "\n");
|
||||
va_end(args);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
void rx::dieIf(bool condition, const char *message, ...) {
|
||||
if (condition) {
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
std::vfprintf(stderr, message, args);
|
||||
std::fprintf(stderr, "\n");
|
||||
va_end(args);
|
||||
std::abort();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue