You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/07/13 20:45:30 UTC

[31/43] jiffy commit: updated refs/heads/upstream to 446e284

Tweak the nil encoding logic

I must've managed to miss the PR update from Stanislav the other day
when merging this.


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

Branch: refs/heads/upstream
Commit: 5eb499d73e52be6518b9e3e705be220788529ede
Parents: 2dbf89f
Author: Paul J. Davis <pa...@gmail.com>
Authored: Sat Aug 23 05:49:12 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Sat Aug 23 05:50:21 2014 -0500

----------------------------------------------------------------------
 c_src/encoder.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5eb499d7/c_src/encoder.c
----------------------------------------------------------------------
diff --git a/c_src/encoder.c b/c_src/encoder.c
index b6ea141..992b5d5 100644
--- a/c_src/encoder.c
+++ b/c_src/encoder.c
@@ -713,11 +713,15 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
             stack = enif_make_list_cell(env, e->atoms->ref_array, stack);
             stack = enif_make_list_cell(env, item, stack);
         } else if(enif_compare(curr, e->atoms->atom_null) == 0 
-                    || (e->use_nil && enif_compare(curr, e->atoms->atom_nil) == 0)) {
             if(!enc_literal(e, "null", 4)) {
                 ret = enc_error(e, "null");
                 goto done;
-            }        
+            }
+        } else if(e->use_nil && enif_compare(curr, e->atoms->atom_nil) == 0)) {
+            if(!enc_literal(e, "null", 4)) {
+                ret = enc_error(e, "null");
+                goto done;
+            }
         } else if(enif_compare(curr, e->atoms->atom_true) == 0) {
             if(!enc_literal(e, "true", 4)) {
                 ret = enc_error(e, "true");