diff options
Diffstat (limited to 'utils.h')
| -rw-r--r-- | utils.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -4,14 +4,16 @@ #ifndef UTILS__H #define UTILS__H +#include <stdbool.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include "match.h" #define streq(a, b) (strcmp(a, b) == 0) -#define check(cond, ...) do { if (!(cond)) { (void)fprintf(stderr, __VA_ARGS__); (void)fwrite("\n", 1, 1, stderr); exit(1); } } while(0) +#define check(cond, ...) do { if (!(cond)) { (void)fprintf(stderr, __VA_ARGS__); (void)fwrite("\n", 1, 1, stderr); exit(EXIT_FAILURE); } } while(0) #define new(t) memcheck(calloc(1, sizeof(t))) #define xcalloc(a,b) memcheck(calloc(a,b)) #define xrealloc(a,b) memcheck(realloc(a,b)) @@ -23,9 +25,9 @@ const char *after_name(const char *str); __attribute__((pure, nonnull, returns_nonnull)) const char *after_spaces(const char *str); __attribute__((nonnull)) -int matchchar(const char **str, char c); +bool matchchar(const char **str, char c); __attribute__((nonnull)) -int matchstr(const char **str, const char *target); +bool matchstr(const char **str, const char *target); __attribute__((nonnull)) size_t unescape_string(char *dest, const char *src, size_t bufsize); __attribute__((returns_nonnull)) |
