From c06ea4e44caee74486e2931154021a0d0e6c8066 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:08:52 +0200 Subject: check_curl: pre compile regex for string matching --- plugins/check_curl.d/config.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'plugins/check_curl.d/config.h') diff --git a/plugins/check_curl.d/config.h b/plugins/check_curl.d/config.h index 9de68713..9acd4048 100644 --- a/plugins/check_curl.d/config.h +++ b/plugins/check_curl.d/config.h @@ -8,6 +8,7 @@ #include #include #include "curl/curl.h" +#include "regex.h" enum { MAX_RE_SIZE = 1024, @@ -87,7 +88,13 @@ typedef struct { char *cookie_jar_file; int maximum_age; + + // the original regex string from the command line char regexp[MAX_RE_SIZE]; + + // the compiled regex for usage later + regex_t compiled_regex; + mp_state_enum state_regex; bool invert_regex; bool verify_peer_and_host; @@ -136,6 +143,7 @@ check_curl_config check_curl_config_init() { .maximum_age = -1, .regexp = {}, + .compiled_regex = {}, .state_regex = STATE_CRITICAL, .invert_regex = false, .verify_peer_and_host = false, -- cgit v1.2.3-74-g34f1