[tracker] libtracker-sparql: Use existing escape_string() in Builder
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-sparql: Use existing escape_string() in Builder
- Date: Sat, 19 Oct 2013 15:39:51 +0000 (UTC)
commit ed36d2747692a6f2e437a91fb1d130ebbbf24375
Author: Martyn Russell <martyn lanedo com>
Date: Sat Oct 19 15:13:33 2013 +0100
libtracker-sparql: Use existing escape_string() in Builder
the Builder's _object_string() had it's own duplicate version which was less
comprehensive too.
src/libtracker-sparql/tracker-builder.vala | 32 +---------------------------
1 files changed, 1 insertions(+), 31 deletions(-)
---
diff --git a/src/libtracker-sparql/tracker-builder.vala b/src/libtracker-sparql/tracker-builder.vala
index 6d07d1e..37ed03d 100644
--- a/src/libtracker-sparql/tracker-builder.vala
+++ b/src/libtracker-sparql/tracker-builder.vala
@@ -509,37 +509,7 @@ public class Tracker.Sparql.Builder : Object {
states.length--;
}
- str.append (" \"");
-
- char* p = literal;
- while (*p != '\0') {
- size_t len = Posix.strcspn ((string) p, "\t\n\r\"\\");
- str.append_len ((string) p, (long) len);
- p += len;
- switch (*p) {
- case '\t':
- str.append ("\\t");
- break;
- case '\n':
- str.append ("\\n");
- break;
- case '\r':
- str.append ("\\r");
- break;
- case '"':
- str.append ("\\\"");
- break;
- case '\\':
- str.append ("\\\\");
- break;
- default:
- continue;
- }
- p++;
- }
-
- str.append ("\"");
-
+ str.append_printf (" \"%s\"", escape_string (literal));
states += State.OBJECT;
length++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]