aboutsummaryrefslogtreecommitdiff
path: root/src/univalue/univalue_write.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/univalue/univalue_write.cpp')
-rw-r--r--src/univalue/univalue_write.cpp21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/univalue/univalue_write.cpp b/src/univalue/univalue_write.cpp
index 1818f5c6f9..70762a1ef1 100644
--- a/src/univalue/univalue_write.cpp
+++ b/src/univalue/univalue_write.cpp
@@ -5,33 +5,14 @@
#include <ctype.h>
#include <stdio.h>
#include "univalue.h"
+#include "univalue_escapes.h"
// TODO: Using UTF8
using namespace std;
-static bool initEscapes;
-static const char *escapes[256];
-
-static void initJsonEscape()
-{
- escapes['"'] = "\\\"";
- escapes['\\'] = "\\\\";
- escapes['/'] = "\\/";
- escapes['\b'] = "\\b";
- escapes['\f'] = "\\f";
- escapes['\n'] = "\\n";
- escapes['\r'] = "\\r";
- escapes['\t'] = "\\t";
-
- initEscapes = true;
-}
-
static string json_escape(const string& inS)
{
- if (!initEscapes)
- initJsonEscape();
-
string outS;
outS.reserve(inS.size() * 2);