From 92e40f4f3b8e153b86093996d2a6d2a1160e105d Mon Sep 17 00:00:00 2001
From: Laurent Bercot
Date: Sat, 11 May 2019 06:22:36 +0000
Subject: Add tryemptyregex/skalibs_regcomp, prepare for 2.8.1.0
---
NEWS | 6 ++++++
configure | 1 +
doc/index.html | 2 +-
doc/upgrade.html | 11 +++++++++++
package/info | 2 +-
src/include/skalibs/posixplz.h | 8 ++++++++
src/sysdeps/tryemptyregex.c | 16 ++++++++++++++++
7 files changed, 44 insertions(+), 2 deletions(-)
create mode 100644 src/sysdeps/tryemptyregex.c
diff --git a/NEWS b/NEWS
index d5db501..17d0e04 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
Changelog for skalibs.
+In 2.8.1.0
+----------
+
+ - Added skalibs_regcomp(), accepting empty regexes on BSDs.
+
+
In 2.8.0.1
----------
diff --git a/configure b/configure
index a793676..b9dc50e 100755
--- a/configure
+++ b/configure
@@ -548,6 +548,7 @@ EOF
choose cl namespaces NAMESPACES 'namespaces'
choose cl nsgetparent NSGETPARENT 'NS_GET_PARENT'
choose cl explicit_bzero EXPLICIT_BZERO 'explicit_bzero()'
+ choose clr emptyregex EMPTYREGEX 'regcomp() accept empty regexes'
echo '#endif' >> $sysdeps/sysdeps.h
fi
diff --git a/doc/index.html b/doc/index.html
index 1c0191e..5b51583 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -60,7 +60,7 @@ with a standard C development environment
Download
- - The current released version of skalibs is 2.8.0.1.
+ - The current released version of skalibs is 2.8.1.0.
- Alternatively, you can checkout a copy of the
skalibs
git repository:
diff --git a/doc/upgrade.html b/doc/upgrade.html
index 3c550ed..c074e66 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -16,6 +16,17 @@
skarnet.org
+ in 2.8.1.0
+
+
+ - New functions:
+
+ - skalibs_regcomp(), which accepts empty regexes even
+when regcomp()
+does not (e.g. the BSDs).
+
+
+
in 2.8.0.1
diff --git a/package/info b/package/info
index d425b4a..dfb2538 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=skalibs
-version=2.8.0.1
+version=2.8.1.0
category=prog
package_macro_name=SKALIBS
diff --git a/src/include/skalibs/posixplz.h b/src/include/skalibs/posixplz.h
index 639a7c4..22cdf3a 100644
--- a/src/include/skalibs/posixplz.h
+++ b/src/include/skalibs/posixplz.h
@@ -5,6 +5,7 @@
#include
#include
+#include
#include
#include
@@ -44,4 +45,11 @@ extern int mkhtemp (char const *, char *) ;
extern int mkctemp (char *, mode_t, dev_t) ;
extern int mkbtemp (char *, mode_t, dev_t) ;
+
+ /*
+ Wrappers around functions that should be specified better.
+ */
+
+#define skalibs_regcomp(re, s, flags) regcomp(re, (s)[0] ? (s) : ".*", flags)
+
#endif
diff --git a/src/sysdeps/tryemptyregex.c b/src/sysdeps/tryemptyregex.c
new file mode 100644
index 0000000..a2243f7
--- /dev/null
+++ b/src/sysdeps/tryemptyregex.c
@@ -0,0 +1,16 @@
+/* ISC license. */
+
+#include
+
+int main (void)
+{
+ regex_t re ;
+ int r = regcomp(&re, "", REG_EXTENDED | REG_NOSUB) ;
+ switch (r)
+ {
+ case 0 : break ;
+ case REG_ESPACE : return 111 ;
+ default : return 1 ;
+ }
+ return !!regexec(&re, "a", 0, 0, 0) ;
+}
--
cgit v1.2.3