From 6238bc22b5ca4da5fa334c7f35ac3b0b052b70de Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Tue, 22 Feb 2022 14:03:35 +0100
Subject: Handle regcomp() errors as log messages.

---
 src/core/logs.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/core/logs.h b/src/core/logs.h
index a58a5a8..e8df8bd 100644
--- a/src/core/logs.h
+++ b/src/core/logs.h
@@ -130,6 +130,15 @@ void log_variadic_message(LogMessageType, const char *, ...);
     }                                                                                                   \
     while (0)
 
+#define LOG_ERROR_REGCOMP(preg, errcode)                                                                \
+    do                                                                                                  \
+    {                                                                                                   \
+        char __msg[1024];                                                                               \
+        regerror(errcode, preg, __msg, sizeof(__msg));                                                  \
+        log_variadic_message(LMT_EXT_ERROR, "[%s:%u] regcomp: %s", __FUNCTION__, __LINE__, __msg);      \
+    }                                                                                                   \
+    while (0)
+
 #define LOG_ERROR_OPENSSL                                                                               \
     do                                                                                                  \
     {                                                                                                   \
-- 
cgit v0.11.2-87-g4458