diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-06-09 00:48:13 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-06-09 00:48:13 +0300 |
commit | ee5e75888e5852313ddfea6e7acd1f36cf3afd62 (patch) | |
tree | a2b41abb8adce77d336926aad26fb6521f46ce5a /src/common.c | |
parent | 6bd9fe43cf00d9522ca5437f1b13e91e3a718621 (diff) |
allow streaming strings to be escaped in a json compatible way; #2276
Diffstat (limited to 'src/common.c')
-rw-r--r-- | src/common.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c index 8dc2b520dc..f954923a5f 100644 --- a/src/common.c +++ b/src/common.c @@ -226,6 +226,13 @@ void json_escape_string(char *dst, const char *src, size_t size) { *d = '\0'; } +void json_fix_string(char *s) { + for( ; *s ;s++) { + if(unlikely(*s == '\\')) *s = '/'; + else if(unlikely(*s == '"')) *s = '\''; + } +} + int sleep_usec(usec_t usec) { #ifndef NETDATA_WITH_USLEEP |