diff options
| author | citrons <citrons@mondecitronne.com> | 2023-10-12 16:32:32 -0500 |
|---|---|---|
| committer | citrons <citrons@mondecitronne.com> | 2023-10-12 16:32:32 -0500 |
| commit | d1ba7e3713cd999635104591295d1923235c9289 (patch) | |
| tree | f639da0345b422b2702e4132ca5315669be7d240 /die.h | |
| parent | 818732592abbf3b2a2c8e3d66cdd056a104bade1 (diff) | |
make error handling worse
Diffstat (limited to 'die.h')
| -rw-r--r-- | die.h | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -1,13 +1,12 @@ +#ifndef DIE_H +#define DIE_H + #include <SDL.h> -#include <stdlib.h> +void die(void); +void sdl_error_assert(SDL_bool condition); -#define die(...) (SDL_Log(__VA_ARGS__), abort()) -static inline void sdl_error_assert(SDL_bool condition) { - if (!condition) { - SDL_Log("%s", SDL_GetError()); - // banish to hell forever - abort(); - } -} +#define die(...) (SDL_LogCritical(SDL_LOG_CATEGORY_ERROR, __VA_ARGS__), die()) #define sdl_error_assert(c) (sdl_error_assert(c && SDL_TRUE)) + +#endif |
