[tracker] libtracker-data: Improve error checks on REPLACE implementation
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-data: Improve error checks on REPLACE implementation
- Date: Wed, 14 Dec 2016 19:43:32 +0000 (UTC)
commit a016c7b3e9a7a10fd94bc02ccda37a8bffc305de
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Dec 13 21:58:03 2016 +0100
libtracker-data: Improve error checks on REPLACE implementation
src/libtracker-data/tracker-db-interface-sqlite.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c
b/src/libtracker-data/tracker-db-interface-sqlite.c
index df30a21..4c84d55 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -593,7 +593,7 @@ function_sparql_replace (sqlite3_context *context,
TrackerDBReplaceFuncChecks *checks = &db_interface->replace_func_checks;
gboolean store_regex = FALSE, store_replace_regex = FALSE;
const gchar *input, *pattern, *replacement, *flags;
- gchar *err_str, *output, *replaced = NULL, *unescaped = NULL;
+ gchar *err_str, *output = NULL, *replaced = NULL, *unescaped = NULL;
GError *error = NULL;
GRegexCompileFlags regex_flags = 0;
GRegex *regex, *replace_regex;
@@ -716,13 +716,13 @@ function_sparql_replace (sqlite3_context *context,
replaced = g_regex_replace (replace_regex,
replacement, -1, 0, "\\\\g<\\1>", 0, &error);
- if (replaced) {
+ if (!error) {
/* All '\$' pairs are replaced by '$' */
unescaped = g_regex_replace (checks->unescape,
replaced, -1, 0, "$", 0, &error);
}
- if (unescaped) {
+ if (!error) {
output = g_regex_replace (regex, input, -1, 0, unescaped, 0, &error);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]