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
42
43
44
45
46
47
48
49
50
51
|
There is no _nl_msg_cat_cntr in musl libc and optimizations
based upon its unchanged value are not possible.
--- a/snapper/Regex.cc 2014-01-29 16:48:30.000000000 +0100
+++ b/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;
|