diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-01-14 16:41:15 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-01-14 16:41:15 -0500 |
commit | 7cffb54ce1a5956fdd41741a66de4026fe3ba2ac (patch) | |
tree | 7ba867c17f7ed057a87ca9d04aa54b77c523b20c | |
parent | 74b1b3157e2c8f2445c7ea161cec13da32e52434 (diff) |
don't be different if NDEBUG is defined
-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) { |