Use the RAW flag when building the regexps.

Also, plugged a memory leak when retrieving the match position.
This commit is contained in:
LemonBoy 2016-06-23 13:25:23 +02:00 committed by Ailin Nemui
commit 5dcf291f21
3 changed files with 16 additions and 13 deletions

View file

@ -546,7 +546,7 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
preg = NULL;
if (regexp) {
preg = g_regex_new(text, (case_sensitive ? 0 : G_REGEX_CASELESS), 0, NULL);
preg = g_regex_new(text, G_REGEX_RAW | (case_sensitive ? 0 : G_REGEX_CASELESS), 0, NULL);
if (preg == NULL)
return NULL;
@ -602,7 +602,7 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
}
}
if (regexp)
if (preg != NULL)
g_regex_unref(preg);
g_string_free(str, TRUE);
return matches;