main shrubtools / proto / util.h
 1#ifndef UTIL_H
 2#define UTIL_H
 3
 4#include <stddef.h>
 5
 6#ifndef countof
 7#define countof(a) (sizeof(a) / sizeof((a)[0]))
 8#endif
 9
10void warn(const char *, ...);
11void die(const char *, ...);
12
13void *xmalloc(size_t);
14void *xcalloc(size_t, size_t);
15void *xreallocarray(void *, size_t, size_t);
16int xasprintf(char **, const char *, ...);
17char *xstrdup(const char *);
18char *xmemdup0(const char *, size_t);
19
20#endif