blob: fed75d8f6063ad0574544136e9d6f029b13f8006 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#ifndef PANIC_H
#define PANIC_H
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdbool.h>
#include <SDL3/SDL.h>
static void panic(const char *why, ...) {
if (!why) return;
va_list ap;
va_start(ap, why);
vfprintf(stderr, why, ap);
fprintf(stderr, "\n");
va_end(ap);
abort();
}
#define must(result) ({ \
typeof(result) must_result = result; \
if (!must_result) { \
panic("SDL: %s", SDL_GetError()); \
} \
must_result; \
})
#endif
|