summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-01-29 15:06:46 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-01-29 15:06:46 -0500
commite89b125d341c9ade21a6aef97ea5ed8aa3084c93 (patch)
treef799fcd92f2b52cd3a098d9f39200b8a89b15d80
parent8199f5c1c599a39ba0a9c4ace0bacde95b4bb483 (diff)
parent3cdf67e77da64ba1235265836f29b228deca3642 (diff)
downloadbfs-e89b125d341c9ade21a6aef97ea5ed8aa3084c93.tar.xz
Merge pull request #81 from data-man:oniguruma_1
-rw-r--r--Makefile5
-rw-r--r--eval.c2
-rw-r--r--expr.h2
-rw-r--r--parse.c2
-rw-r--r--regexp.h27
-rw-r--r--util.c2
-rw-r--r--util.h3
7 files changed, 37 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 18a51d3..8af4a99 100644
--- a/Makefile
+++ b/Makefile
@@ -111,6 +111,11 @@ ifneq ($(filter release,$(MAKECMDGOALS)),)
CFLAGS := $(DEFAULT_CFLAGS) -O3 -flto -DNDEBUG
endif
+ifeq ($(USE_ONIGURUMA),1)
+LOCAL_LDLIBS += -lonig
+LOCAL_CFLAGS += -DBFS_USE_ONIGURUMA=1
+endif
+
ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS)
ALL_CFLAGS = $(ALL_CPPFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) $(DEPFLAGS)
ALL_LDFLAGS = $(ALL_CFLAGS) $(LOCAL_LDFLAGS) $(LDFLAGS)
diff --git a/eval.c b/eval.c
index ec2701b..b5dfeed 100644
--- a/eval.c
+++ b/eval.c
@@ -37,13 +37,13 @@
#include "time.h"
#include "trie.h"
#include "util.h"
+#include "regexp.h"
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <grp.h>
#include <pwd.h>
-#include <regex.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
diff --git a/expr.h b/expr.h
index c25d1ca..a4e6c0d 100644
--- a/expr.h
+++ b/expr.h
@@ -25,8 +25,8 @@
#include "eval.h"
#include "exec.h"
#include "printf.h"
+#include "regexp.h"
#include "stat.h"
-#include <regex.h>
#include <stdbool.h>
#include <stddef.h>
#include <sys/types.h>
diff --git a/parse.c b/parse.c
index 8ff47c2..2bf5992 100644
--- a/parse.c
+++ b/parse.c
@@ -41,6 +41,7 @@
#include "time.h"
#include "typo.h"
#include "util.h"
+#include "regexp.h"
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
@@ -48,7 +49,6 @@
#include <grp.h>
#include <limits.h>
#include <pwd.h>
-#include <regex.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
diff --git a/regexp.h b/regexp.h
new file mode 100644
index 0000000..8654b58
--- /dev/null
+++ b/regexp.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+ * bfs *
+ * Copyright (C) 2022 Tavian Barnes <tavianator@tavianator.com> and *
+ * BFS contributors *
+ * *
+ * Permission to use, copy, modify, and/or distribute this software for any *
+ * purpose with or without fee is hereby granted. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES *
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF *
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR *
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES *
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN *
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
+ ****************************************************************************/
+
+#ifndef BFS_REGEXP_H
+#define BFS_REGEXP_H
+
+#if BFS_USE_ONIGURUMA == 1
+ #include <onigposix.h>
+#else
+ #include <regex.h>
+#endif
+
+#endif // BFS_REGEXP_H
diff --git a/util.c b/util.c
index 71b3c53..9e221a8 100644
--- a/util.c
+++ b/util.c
@@ -16,12 +16,12 @@
#include "util.h"
#include "dstring.h"
+#include "regexp.h"
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <langinfo.h>
#include <nl_types.h>
-#include <regex.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/util.h b/util.h
index 37c03fa..893651e 100644
--- a/util.h
+++ b/util.h
@@ -20,10 +20,9 @@
#ifndef BFS_UTIL_H
#define BFS_UTIL_H
-
+#include "regexp.h"
#include <fcntl.h>
#include <fnmatch.h>
-#include <regex.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>