[tracker/tracker-0.12: 15/202] nautilus: Don't re-define tracker_sparql_escape_string() instead re-use it
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.12: 15/202] nautilus: Don't re-define tracker_sparql_escape_string() instead re-use it
- Date: Thu, 6 Oct 2011 17:49:42 +0000 (UTC)
commit 7647c9e9d3dab32d795e502e6c0b4214ac36666e
Author: Martyn Russell <martyn lanedo com>
Date: Mon Sep 12 19:54:51 2011 +0100
nautilus: Don't re-define tracker_sparql_escape_string() instead re-use it
src/plugins/nautilus/tracker-tags-utils.c | 39 +++++-----------------------
1 files changed, 7 insertions(+), 32 deletions(-)
---
diff --git a/src/plugins/nautilus/tracker-tags-utils.c b/src/plugins/nautilus/tracker-tags-utils.c
index caaca81..08f45a2 100644
--- a/src/plugins/nautilus/tracker-tags-utils.c
+++ b/src/plugins/nautilus/tracker-tags-utils.c
@@ -23,6 +23,8 @@
#include <libnautilus-extension/nautilus-file-info.h>
+#include <libtracker-sparql/tracker-sparql.h>
+
#include "tracker-tags-utils.h"
/* Copied from src/libtracker-common/tracker-utils.c */
@@ -101,40 +103,13 @@ tracker_tags_get_filter_string (GStrv files,
gchar *
tracker_tags_escape_sparql_string (const gchar *str)
{
- GString *sparql;
-
- sparql = g_string_new ("");
- g_string_append_c (sparql, '"');
-
- while (*str != '\0') {
- gsize len = strcspn (str, "\t\n\r\"\\");
- g_string_append_len (sparql, str, len);
- str += len;
- switch (*str) {
- case '\t':
- g_string_append (sparql, "\\t");
- break;
- case '\n':
- g_string_append (sparql, "\\n");
- break;
- case '\r':
- g_string_append (sparql, "\\r");
- break;
- case '"':
- g_string_append (sparql, "\\\"");
- break;
- case '\\':
- g_string_append (sparql, "\\\\");
- break;
- default:
- continue;
- }
- str++;
- }
+ gchar *escaped, *retval;
- g_string_append_c (sparql, '"');
+ escaped = tracker_sparql_escape_string (str);
+ retval = g_strdup_printf ("\"%s\"", escaped);
+ g_free (escaped);
- return g_string_free (sparql, FALSE);
+ return retval;
}
gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]