21 lines
427 B
C
21 lines
427 B
C
#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
|
|
|
|
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);
|
|
|
|
#endif
|