void-packages/srcpkgs/snapper/patches/0003-musl-_nl_msg_cat_cntr....

61 lines
1.3 KiB
Diff

From 554bf69b4cfb5e91a20f0df0ac0fef918648fb48 Mon Sep 17 00:00:00 2001
From: Nathan Owens <ndowens04@gmail.com>
Date: Wed, 18 Dec 2019 18:26:02 -0600
Subject: [PATCH 3/4] musl-_nl_msg_cat_cntr
Signed-off-by: Nathan Owens <ndowens04@gmail.com>
---
snapper/Regex.cc | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/snapper/Regex.cc b/snapper/Regex.cc
index da8f862..6b2cd2d 100644
--- snapper/Regex.cc
+++ snapper/Regex.cc
@@ -21,9 +21,9 @@
#include <stdexcept>
#include "snapper/Regex.h"
-
+#ifdef __GLIBC__
extern int _nl_msg_cat_cntr;
-
+#endif
namespace snapper
{
@@ -40,8 +40,10 @@ Regex::Regex (const string& pattern, int cflags, unsigned int nm)
regerror(errcode, &rx, error, esize);
throw std::runtime_error(string("Regex compilation error: ") + error);
}
+#ifdef __GLIBC__
my_nl_msg_cat_cntr = _nl_msg_cat_cntr;
- rm = new regmatch_t[nm];
+#endif
+ rm = new regmatch_t[nm];
}
@@ -55,11 +57,16 @@ Regex::~Regex ()
bool
Regex::match (const string& str, int eflags) const
{
- if (my_nl_msg_cat_cntr != _nl_msg_cat_cntr) {
+#ifdef __GLIBC__
+ if (my_nl_msg_cat_cntr != _nl_msg_cat_cntr)
+#endif
+ {
regfree (&rx);
regcomp (&rx, pattern.c_str (), cflags);
+#ifdef __GLIBC__
my_nl_msg_cat_cntr = _nl_msg_cat_cntr;
- }
+#endif
+ }
last_str = str;
--
2.24.1