From 4d9fd4c4aa7f96f0cbbe8147202e572c99c46741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 26 Jan 2019 10:21:39 +0100 Subject: [PATCH] core: fix compilation of empty regular expression (not allowed on FreeBSD) --- ChangeLog.adoc | 1 + src/core/wee-string.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 6e14834ff..2505b4ff9 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -32,6 +32,7 @@ New features:: Bug fixes:: + * core: fix compilation of empty regular expression (not allowed on FreeBSD) * core: fix forced highlight on messages sent to other buffers (issue #1277) * buflist: add alternate key codes for kbd:[F1]/kbd:[F2] and kbd:[Alt+F1]/kbd:[Alt+F2] (compatibility with terminals) * buflist: fix warning displayed when script buffers.pl is loaded (issue #1274) diff --git a/src/core/wee-string.c b/src/core/wee-string.c index 320b6aa3e..5380ec8d4 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -1204,7 +1204,10 @@ string_regcomp (void *preg, const char *regex, int default_flags) return -1; ptr_regex = string_regex_flags (regex, default_flags, &flags); - return regcomp ((regex_t *)preg, ptr_regex, flags); + + return regcomp ((regex_t *)preg, + (ptr_regex && ptr_regex[0]) ? ptr_regex : "^", + flags); } /*