Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Escaping of forward slashes has been enabled. Otherwise tools such as…

… Anzu or Tornado have to do it on their own - which hurts performance.
  • Loading branch information...
commit a016e4c7fd3d31b9503350bc8702348792dcef8a 1 parent 824a42b
W. Mark Kubacki authored

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. +3 3 ultrajsonenc.c
6 ultrajsonenc.c
@@ -65,7 +65,7 @@ static const JSUINT8 g_asciiOutputTable[256] =
65 65 {
66 66 /* 0x00 */ 0, 30, 30, 30, 30, 30, 30, 30, 10, 12, 14, 30, 16, 18, 30, 30,
67 67 /* 0x10 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
68   -/* 0x20 */ 1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1/*24*/,
  68 +/* 0x20 */ 1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 24,
69 69 /* 0x30 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
70 70 /* 0x40 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
71 71 /* 0x50 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 22, 1, 1, 1,
@@ -139,7 +139,7 @@ int Buffer_EscapeStringUnvalidated (JSOBJ obj, JSONObjectEncoder *enc, const cha
139 139
140 140 case '\"': (*of++) = '\\'; (*of++) = '\"'; break;
141 141 case '\\': (*of++) = '\\'; (*of++) = '\\'; break;
142   - //case '/': (*of++) = '\\'; (*of++) = '/'; break;
  142 + case '/': (*of++) = '\\'; (*of++) = '/'; break;
143 143 case '\b': (*of++) = '\\'; (*of++) = 'b'; break;
144 144 case '\f': (*of++) = '\\'; (*of++) = 'f'; break;
145 145 case '\n': (*of++) = '\\'; (*of++) = 'n'; break;
@@ -339,7 +339,7 @@ int Buffer_EscapeStringValidated (JSOBJ obj, JSONObjectEncoder *enc, const char
339 339 case 18:
340 340 case 20:
341 341 case 22:
342   - //case 24: (enable for / escaping)
  342 + case 24:
343 343 *(of++) = *( (char *) (g_escapeChars + utflen + 0));
344 344 *(of++) = *( (char *) (g_escapeChars + utflen + 1));
345 345 io ++;

1 comment on commit a016e4c

Jonas Tärnström

Feel free to add tests for this and give me a pull request and I'll merge it into the master.

Thanks!

Please sign in to comment.
Something went wrong with that request. Please try again.