51 lines
1.1 KiB
Diff
51 lines
1.1 KiB
Diff
There is no _nl_msg_cat_cntr in musl libc and optimizations
|
|
based upon its unchanged value are not possible.
|
|
|
|
--- snapper/Regex.cc 2014-01-29 16:48:30.000000000 +0100
|
|
+++ snapper/Regex.cc 2015-08-30 11:07:34.613193993 +0200
|
|
@@ -22,7 +22,9 @@
|
|
|
|
#include "snapper/Regex.h"
|
|
|
|
+#if defined(__GLIBC__)
|
|
extern int _nl_msg_cat_cntr;
|
|
+#endif
|
|
|
|
|
|
namespace snapper
|
|
@@ -34,7 +36,9 @@
|
|
nm (cflags & REG_NOSUB ? 0 : nm)
|
|
{
|
|
regcomp (&rx, pattern, cflags);
|
|
+#if defined(__GLIBC__)
|
|
my_nl_msg_cat_cntr = _nl_msg_cat_cntr;
|
|
+#endif
|
|
rm = new regmatch_t[nm];
|
|
}
|
|
|
|
@@ -45,7 +49,9 @@
|
|
nm (cflags & REG_NOSUB ? 0 : nm)
|
|
{
|
|
regcomp (&rx, pattern.c_str (), cflags);
|
|
+#if defined(__GLIBC__)
|
|
my_nl_msg_cat_cntr = _nl_msg_cat_cntr;
|
|
+#endif
|
|
rm = new regmatch_t[nm];
|
|
}
|
|
|
|
@@ -60,11 +66,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;
|
|
|