You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2021/02/16 17:31:18 UTC

[couchdb-jiffy] 04/12: Fix bug in bytes_per_red option

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-jiffy.git

commit f74b04fd11a0a21544c90941ae1e239907e4fe67
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Oct 22 09:53:26 2020 -0500

    Fix bug in bytes_per_red option
    
    Turns out this was never implemented correctly since it was referring to
    the original bytes_per_iter atom.
---
 c_src/jiffy.c | 1 +
 c_src/jiffy.h | 1 +
 c_src/util.c  | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/c_src/jiffy.c b/c_src/jiffy.c
index 03ded3e..dfca7c7 100644
--- a/c_src/jiffy.c
+++ b/c_src/jiffy.c
@@ -25,6 +25,7 @@ load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
     st->atom_force_utf8 = make_atom(env, "force_utf8");
     st->atom_iter = make_atom(env, "iter");
     st->atom_bytes_per_iter = make_atom(env, "bytes_per_iter");
+    st->atom_bytes_per_red = make_atom(env, "bytes_per_red");
     st->atom_return_maps = make_atom(env, "return_maps");
     st->atom_return_trailer = make_atom(env, "return_trailer");
     st->atom_has_trailer = make_atom(env, "has_trailer");
diff --git a/c_src/jiffy.h b/c_src/jiffy.h
index 6d19500..9c97945 100644
--- a/c_src/jiffy.h
+++ b/c_src/jiffy.h
@@ -34,6 +34,7 @@ typedef struct {
     ERL_NIF_TERM    atom_force_utf8;
     ERL_NIF_TERM    atom_iter;
     ERL_NIF_TERM    atom_bytes_per_iter;
+    ERL_NIF_TERM    atom_bytes_per_red;
     ERL_NIF_TERM    atom_return_maps;
     ERL_NIF_TERM    atom_return_trailer;
     ERL_NIF_TERM    atom_has_trailer;
diff --git a/c_src/util.c b/c_src/util.c
index 2890a63..f6dcb68 100644
--- a/c_src/util.c
+++ b/c_src/util.c
@@ -80,7 +80,7 @@ get_bytes_per_red(ErlNifEnv* env, ERL_NIF_TERM val, size_t* bpi)
         return 0;
     }
 
-    if(enif_compare(tuple[0], st->atom_bytes_per_iter) != 0) {
+    if(enif_compare(tuple[0], st->atom_bytes_per_red) != 0) {
         return 0;
     }