summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-01-14 16:41:15 -0500
committerJakob Kaivo <jkk@ung.org>2020-01-14 16:41:15 -0500
commit7cffb54ce1a5956fdd41741a66de4026fe3ba2ac (patch)
tree7ba867c17f7ed057a87ca9d04aa54b77c523b20c /main.c
parent74b1b3157e2c8f2445c7ea161cec13da32e52434 (diff)
don't be different if NDEBUG is defined
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/main.c b/main.c
index 5c60715..c04f168 100644
--- a/main.c
+++ b/main.c
@@ -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) {