25 lines
847 B
C
25 lines
847 B
C
#ifndef cmsg_private_h
|
|
#define cmsg_private_h
|
|
|
|
typedef struct cmsg_bytes_t {
|
|
size_t len;
|
|
void *bytes;
|
|
} cmsg_bytes_t;
|
|
|
|
#define EMPTY_BYTES ((cmsg_bytes_t) { .len = 0, .bytes = NULL })
|
|
|
|
extern cmsg_bytes_t cmsg_cstring_bytes(char const *cstr);
|
|
extern cmsg_bytes_t cmsg_bytes_malloc_dup(cmsg_bytes_t src);
|
|
extern cmsg_bytes_t cmsg_bytes_malloc(size_t amount);
|
|
extern void cmsg_bytes_free(cmsg_bytes_t bytes);
|
|
|
|
#define ICHECK(result, message) do { if ((result) == -1) { perror(message); exit(2); } } while (0)
|
|
#define BCHECK(result, message) do { if ((result) == 0) { perror(message); exit(2); } } while (0)
|
|
#define PCHECK(result, message) do { if ((result) == NULL) { perror(message); exit(2); } } while (0)
|
|
|
|
extern void die(char const *format, ...);
|
|
extern void warn(char const *format, ...);
|
|
extern void info(char const *format, ...);
|
|
|
|
#endif
|