You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/01/17 23:12:04 UTC

[33/50] [abbrv] git commit: No longer escape forward slashes

No longer escape forward slashes

After a few requests and some reflection I've decided to stop escaping
forward slashes in strings while still accepting the escaped version
through the decoder. This appears to mimic the behavior of other popular
JSON libraries I've checked (Ruby and Python).


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/e2b2c3a9
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/e2b2c3a9
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/e2b2c3a9

Branch: refs/heads/import
Commit: e2b2c3a91931af5911797efb90e51e6aa8c52305
Parents: 97d8269
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Jan 21 11:14:05 2013 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Mon Jan 21 11:14:05 2013 -0600

----------------------------------------------------------------------
 c_src/encoder.c    | 2 --
 test/004-strings.t | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/e2b2c3a9/c_src/encoder.c
----------------------------------------------------------------------
diff --git a/c_src/encoder.c b/c_src/encoder.c
index 911b9aa..640aa68 100644
--- a/c_src/encoder.c
+++ b/c_src/encoder.c
@@ -253,7 +253,6 @@ enc_string(Encoder* e, ERL_NIF_TERM val)
         switch((char) data[i]) {
             case '\"':
             case '\\':
-            case '/':
             case '\b':
             case '\f':
             case '\n':
@@ -300,7 +299,6 @@ enc_string(Encoder* e, ERL_NIF_TERM val)
         switch((char) data[i]) {
             case '\"':
             case '\\':
-            case '/':
                 e->p[e->i++] = '\\';
                 e->u[e->i++] = data[i];
                 i++;

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/e2b2c3a9/test/004-strings.t
----------------------------------------------------------------------
diff --git a/test/004-strings.t b/test/004-strings.t
index 17fb2b5..30fa0d5 100755
--- a/test/004-strings.t
+++ b/test/004-strings.t
@@ -6,7 +6,7 @@ main([]) ->
     code:add_pathz("ebin"),
     code:add_pathz("test"),
 
-    etap:plan(116),
+    etap:plan(118),
     util:test_good(good()),
     util:test_good(uescaped(), [uescape]),
     util:test_errors(errors()),
@@ -18,6 +18,7 @@ main([]) ->
 good() ->
     [
         {<<"\"\"">>, <<"">>},
+        {<<"\"/\"">>, <<"/">>},
         {<<"\"0\"">>, <<"0">>},
         {<<"\"foo\"">>, <<"foo">>},
         {<<"\"\\\"foobar\\\"\"">>, <<"\"foobar\"">>},