Skip to content

Commit

Permalink
multi-line: fix Glib warning in case the multi-line regexp failes to …
Browse files Browse the repository at this point in the history
…compile

Signed-off-by: Balazs Scheidler <[email protected]>
  • Loading branch information
bazsi committed Oct 20, 2024
1 parent 968d0ab commit 3add5e7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/multi-line/multi-line-pattern.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
#include "multi-line/multi-line-pattern.h"
#include "messages.h"

#define MULTI_LINE_PATTERN_ERROR multi_line_pattern_error_quark()

static GQuark
multi_line_pattern_error_quark(void)
{
return g_quark_from_static_string("multi_line_pattern");
}

MultiLinePattern *
multi_line_pattern_compile(const gchar *regexp, GError **error)
{
Expand All @@ -41,7 +49,7 @@ multi_line_pattern_compile(const gchar *regexp, GError **error)
PCRE2_UCHAR error_message[128];

pcre2_get_error_message(rc, error_message, sizeof(error_message));
g_set_error(error, 0, 0,
g_set_error(error, MULTI_LINE_PATTERN_ERROR, 0,
"Error while compiling multi-line regexp as a PCRE expression, error=%s, error_at=%" G_GSIZE_FORMAT,
(gchar *) error_message, erroffset);
goto error;
Expand Down

0 comments on commit 3add5e7

Please sign in to comment.