-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.h
More file actions
36 lines (25 loc) · 644 Bytes
/
util.h
File metadata and controls
36 lines (25 loc) · 644 Bytes
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
29
30
31
32
33
34
35
36
#ifndef UTIL_H
#define UTIL_H
#include <stddef.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/* utility routines */
#ifdef __GNUC__
# define GCC_ATTR(x) x
#else
# define GCC_ATTR(x)
#endif
/* Memory allocation (fatal error if allocation fails) */
void *xmalloc(size_t n);
char *xstrdup(const char *s);
/* Error handling */
void err_fatal(const char *fmt, ...) GCC_ATTR(__attribute__((format(printf, 1, 2))));
void verr_fatal(const char *fmt, va_list args);
#define NOT_IMPLEMENTED(what) \
err_fatal("%s:%d: Not implemented: %s\n", __FILE__, __LINE__, what)
#ifdef __cplusplus
}
#endif
#endif // UTIL_H