There is no _nl_msg_cat_cntr in musl libc and optimizations based upon its unchanged value are not possible. --- a/snapper/Regex.cc +++ b/snapper/Regex.cc @@ -22,7 +22,9 @@ #include #include "snapper/Regex.h" +#if defined(__GLIBC__) extern int _nl_msg_cat_cntr; +#endif namespace snapper @@ -40,7 +42,9 @@ regerror(errcode, &rx, error, esize); throw std::runtime_error(string("Regex compilation error: ") + error); } +#if defined(__GLIBC__) my_nl_msg_cat_cntr = _nl_msg_cat_cntr; +#endif rm = new regmatch_t[nm]; } @@ -55,11 +59,15 @@ bool Regex::match (const string& str, int eflags) const { +#if defined(__GLIBC__) if (my_nl_msg_cat_cntr != _nl_msg_cat_cntr) { +#endif regfree (&rx); regcomp (&rx, pattern.c_str (), cflags); +#if defined(__GLIBC__) my_nl_msg_cat_cntr = _nl_msg_cat_cntr; } +#endif last_str = str;