blob: 9c50becaaef96032d685e7b8dc93b5c924733eed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
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 <stdexcept>
#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;
|