~pixelherodev/c3lib

ref: tmp c3lib/util.h -rw-r--r-- 811 bytes
ddd78966Noam Preil tmp 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
char* aprintf(const char *fmt, ...);
void error(const char *fmt, ...);
char *h_path_resolve(char *unknown);
char* file_read(const char *const path, size_t *size);
size_t file_len(FILE *file, const char *const path);
char *file_rel_dir(char *orig, char *new, size_t new_len, size_t *out_len);
void c3oom(void);

#define _STR(x) #x
#define STR(x) _STR(x)
#define ERROR(msg, ...) error("%s:%d: error: " msg "\n", __FILE__, __LINE__,   __VA_ARGS__);
#define WARN(msg, ...) error("%s:%d: warning: " msg "\n", __FILE__, __LINE__,   __VA_ARGS__);
#define FATAL(msg, ...) { error("%s:%d: error: " msg "\n", __FILE__, __LINE__,   __VA_ARGS__); abort(); }
#define FATAL_EXIT(msg, ...) { error("%s:%d: error: " msg "\n", __FILE__, __LINE__,   __VA_ARGS__); exit(1); }
#define OOM() { WARN("Out of memory!", 0); c3oom(); }