2021-12-11 14:26:39 +01:00
|
|
|
#ifndef _UTIL_H
|
|
|
|
#define _UTIL_H
|
|
|
|
|
|
|
|
#define GUARD(p) if (!p) { diePerror(__func__); }
|
|
|
|
#define SGUARD(p) if (p < 0) { diePerror(__func__); }
|
|
|
|
|
|
|
|
#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
|
|
|
|
#define POSIX
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __WIN32__
|
|
|
|
#define WINDOWS
|
|
|
|
#endif
|
|
|
|
|
2021-12-13 15:47:21 +01:00
|
|
|
void die(const char* s);
|
|
|
|
void diePerror(const char* s);
|
|
|
|
uint8_t* readFile(char* path, size_t* size);
|
|
|
|
void freeFile(uint8_t* buf, size_t size);
|
|
|
|
|
2021-12-11 14:26:39 +01:00
|
|
|
#endif
|