Checking for the existence of the REG_ENHANCED regex flag, and
using it when it's available (which it is on OS X systems). This completes the fix for Savannah bug #47325. Patch by Thomas Rosenau. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5759 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
b55e8d7b34
commit
2f817a6740
|
@ -1,3 +1,8 @@
|
||||||
|
2016-03-22 Thomas Rosenau <thomasr@fantasymail.de>
|
||||||
|
* configure.ac, src/*.c: Check for the existence of the REG_ENHANCED
|
||||||
|
regex flag, and use it when it's available (on OS X systems). This
|
||||||
|
completes the fix for Savannah bug #47325.
|
||||||
|
|
||||||
2016-03-21 Benno Schulenberg <bensberg@justemail.net>
|
2016-03-21 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/browser.c (findnextfile): Trim a duplicate variable.
|
* src/browser.c (findnextfile): Trim a duplicate variable.
|
||||||
* src/browser.c (browser_refresh, findnextfile): Rename four vars.
|
* src/browser.c (browser_refresh, findnextfile): Rename four vars.
|
||||||
|
|
19
configure.ac
19
configure.ac
|
@ -572,6 +572,19 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([for enhanced regular expression flag], nano_cv_flag_reg_extended,
|
||||||
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <regex.h>]],
|
||||||
|
[[
|
||||||
|
#ifndef REG_ENHANCED
|
||||||
|
error: No REG_ENHANCED support!
|
||||||
|
#endif
|
||||||
|
]])],
|
||||||
|
[nano_cv_flag_reg_extended="REG_EXTENDED | REG_ENHANCED"],
|
||||||
|
[nano_cv_flag_reg_extended="REG_EXTENDED"])])
|
||||||
|
|
||||||
|
AC_DEFINE_UNQUOTED(NANO_REG_EXTENDED, $nano_cv_flag_reg_extended,
|
||||||
|
[Flag(s) to use to get the full range of extended regular expressions])
|
||||||
|
|
||||||
if test x$color_support = xyes; then
|
if test x$color_support = xyes; then
|
||||||
# Now check for the end-of-word boundary support (/< and />).
|
# Now check for the end-of-word boundary support (/< and />).
|
||||||
AC_MSG_CHECKING([for GNU-style word boundary regex support])
|
AC_MSG_CHECKING([for GNU-style word boundary regex support])
|
||||||
|
@ -601,7 +614,7 @@ int main(void)
|
||||||
size_t nmatch;
|
size_t nmatch;
|
||||||
regmatch_t pmatch;
|
regmatch_t pmatch;
|
||||||
|
|
||||||
if (regcomp(&r, "\\\\>", REG_EXTENDED|REG_NOSUB))
|
if (regcomp(&r, "\\\\>", $nano_cv_flag_reg_extended|REG_NOSUB))
|
||||||
return 1;
|
return 1;
|
||||||
if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
|
if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -639,8 +652,8 @@ int main(void)
|
||||||
AC_MSG_WARN([*** Couldn't successfully compile basic color test with or without _XOPEN_SOURCE_EXTENDED])
|
AC_MSG_WARN([*** Couldn't successfully compile basic color test with or without _XOPEN_SOURCE_EXTENDED])
|
||||||
AC_MSG_WARN([*** This build may not compile. Consider configuring with --disable-color or installing ncurses])),
|
AC_MSG_WARN([*** This build may not compile. Consider configuring with --disable-color or installing ncurses])),
|
||||||
AC_MSG_WARN([*** Can't check need for _XOPEN_SOURCE_EXTENDED when cross-compiling]))
|
AC_MSG_WARN([*** Can't check need for _XOPEN_SOURCE_EXTENDED when cross-compiling]))
|
||||||
fi
|
# fi
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether LINES and COLS can be redefined])
|
AC_MSG_CHECKING([whether LINES and COLS can be redefined])
|
||||||
AC_TRY_RUN([
|
AC_TRY_RUN([
|
||||||
|
|
|
@ -147,7 +147,7 @@ bool found_in_list(regexlisttype *head, const char *shibboleth)
|
||||||
regex_t rgx;
|
regex_t rgx;
|
||||||
|
|
||||||
for (item = head; item != NULL; item = item->next) {
|
for (item = head; item != NULL; item = item->next) {
|
||||||
regcomp(&rgx, fixbounds(item->full_regex), REG_EXTENDED);
|
regcomp(&rgx, fixbounds(item->full_regex), NANO_REG_EXTENDED);
|
||||||
|
|
||||||
if (regexec(&rgx, shibboleth, 0, NULL, 0) == 0) {
|
if (regexec(&rgx, shibboleth, 0, NULL, 0) == 0) {
|
||||||
regfree(&rgx);
|
regfree(&rgx);
|
||||||
|
|
|
@ -2424,7 +2424,7 @@ int main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
quoterc = regcomp("ereg, quotestr, REG_EXTENDED);
|
quoterc = regcomp("ereg, quotestr, NANO_REG_EXTENDED);
|
||||||
|
|
||||||
if (quoterc == 0) {
|
if (quoterc == 0) {
|
||||||
/* We no longer need quotestr, just quotereg. */
|
/* We no longer need quotestr, just quotereg. */
|
||||||
|
|
|
@ -831,7 +831,7 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* If the regex string is malformed, skip it. */
|
/* If the regex string is malformed, skip it. */
|
||||||
if (!nregcomp(regexstring, REG_EXTENDED | REG_NOSUB))
|
if (!nregcomp(regexstring, NANO_REG_EXTENDED | REG_NOSUB))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Copy the regex into a struct, and hook this in at the end. */
|
/* Copy the regex into a struct, and hook this in at the end. */
|
||||||
|
@ -1010,9 +1010,9 @@ void parse_rcfile(FILE *rcstream
|
||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
else if (strcasecmp(keyword, "color") == 0)
|
else if (strcasecmp(keyword, "color") == 0)
|
||||||
parse_colors(ptr, REG_EXTENDED);
|
parse_colors(ptr, NANO_REG_EXTENDED);
|
||||||
else if (strcasecmp(keyword, "icolor") == 0)
|
else if (strcasecmp(keyword, "icolor") == 0)
|
||||||
parse_colors(ptr, REG_EXTENDED | REG_ICASE);
|
parse_colors(ptr, NANO_REG_EXTENDED | REG_ICASE);
|
||||||
else if (strcasecmp(keyword, "linter") == 0)
|
else if (strcasecmp(keyword, "linter") == 0)
|
||||||
pick_up_name("linter", ptr, &live_syntax->linter);
|
pick_up_name("linter", ptr, &live_syntax->linter);
|
||||||
else if (strcasecmp(keyword, "formatter") == 0)
|
else if (strcasecmp(keyword, "formatter") == 0)
|
||||||
|
|
|
@ -48,7 +48,7 @@ bool regexp_init(const char *regexp)
|
||||||
|
|
||||||
assert(!regexp_compiled);
|
assert(!regexp_compiled);
|
||||||
|
|
||||||
rc = regcomp(&search_regexp, fixbounds(regexp), REG_EXTENDED
|
rc = regcomp(&search_regexp, fixbounds(regexp), NANO_REG_EXTENDED
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
|
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue