diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-05-11 06:22:36 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-05-11 06:22:36 +0000 |
commit | 92e40f4f3b8e153b86093996d2a6d2a1160e105d (patch) | |
tree | 59c223865b9bce061ddf32f3fcd0f31df6911ace | |
parent | ab0416faed65154c408e4fb5066cd8433a4bfa11 (diff) | |
download | skalibs-92e40f4f3b8e153b86093996d2a6d2a1160e105d.tar.gz skalibs-92e40f4f3b8e153b86093996d2a6d2a1160e105d.tar.xz skalibs-92e40f4f3b8e153b86093996d2a6d2a1160e105d.zip |
Add tryemptyregex/skalibs_regcomp, prepare for 2.8.1.0
-rw-r--r-- | NEWS | 6 | ||||
-rwxr-xr-x | configure | 1 | ||||
-rw-r--r-- | doc/index.html | 2 | ||||
-rw-r--r-- | doc/upgrade.html | 11 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | src/include/skalibs/posixplz.h | 8 | ||||
-rw-r--r-- | src/sysdeps/tryemptyregex.c | 16 |
7 files changed, 44 insertions, 2 deletions
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 </li> <h3> Download </h3> <ul> - <li> The current released version of skalibs is <a href="skalibs-2.8.0.1.tar.gz">2.8.0.1</a>. </li> + <li> The current released version of skalibs is <a href="skalibs-2.8.1.0.tar.gz">2.8.1.0</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/skalibs/">skalibs git repository</a>: 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 @@ <a href="//skarnet.org/">skarnet.org</a> </p> +<h2> in 2.8.1.0 </h2> + +<ul> + <li> New functions: + <ul> + <li> <tt>skalibs_regcomp()</tt>, which accepts empty regexes even +when <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/regcomp.html">regcomp()</a> +does not (e.g. the BSDs). </li> + </ul> </li> +</ul> + <h2> in 2.8.0.1 </h2> <ul> 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 <sys/types.h> #include <sys/stat.h> +#include <regex.h> #include <skalibs/gccattributes.h> #include <skalibs/functypes.h> @@ -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 <regex.h> + +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) ; +} |