diff options
-rw-r--r-- | main.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1,9 +1,10 @@ #define _XOPEN_SOURCE 700 -#include <assert.h> #include <fcntl.h> #include <regex.h> #include <sys/mman.h> #include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include "maje.h" @@ -37,8 +38,13 @@ static bool matches(const struct majefile * restrict file, const regex_t * restr char *find_main(struct majefile *sources) { regex_t re; - int rc = regcomp(&re, "int[[:space:]]+main[[:space:]\\(]", REG_EXTENDED | REG_NEWLINE | REG_NOSUB); - assert(rc == 0); + int rc = regcomp(&re, "int[[:space:]]+main[[:space:]\\(]", + REG_EXTENDED | REG_NEWLINE | REG_NOSUB); + if (rc != 0) { + fprintf(stderr, "maje: regcomp() failed\n"); + abort(); + } + char *ret = NULL; for (struct majefile *src = sources; src != NULL; src = src->next) { |