branch: elpa/emacsql
commit 3e16afce8b2a7e0573816a7b3b30828c5f046b43
Author: Christopher Wellons <[email protected]>
Commit: Christopher Wellons <[email protected]>
Escape backslashes as well.
---
sqlite/emacsql.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sqlite/emacsql.c b/sqlite/emacsql.c
index a3f4484d7b..34b3481c10 100644
--- a/sqlite/emacsql.c
+++ b/sqlite/emacsql.c
@@ -9,14 +9,14 @@
char* escape(const char *message) {
int i, count = 0, length_orig = strlen(message);
for (i = 0; i < length_orig; i++) {
- if (message[i] == '"') {
+ if (strchr("\"\\", message[i])) {
count++;
}
}
char *copy = malloc(length_orig + count + 1);
char *p = copy;
while (*message) {
- if (*message == '"') {
+ if (strchr("\"\\", *message)) {
*p = '\\';
p++;
}