You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2023/05/08 19:51:00 UTC

[couchdb] 03/03: Specify minor_version 1 in term_to_binary

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

jaydoane pushed a commit to branch otp-26-compat
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 995c76a78e0b2f0929cd65e4f04e05156c05721f
Author: Jay Doane <ja...@apache.org>
AuthorDate: Mon May 8 12:41:47 2023 -0700

    Specify minor_version 1 in term_to_binary
    
    In Erlang/OTP 26, the default minor_version changed from 1 to 2, so
    make minor version explicit in `term_to_binary/2` via existing macro.
---
 src/couch_mrview/src/couch_mrview.erl      | 2 +-
 src/couch_mrview/src/couch_mrview_util.erl | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/couch_mrview/src/couch_mrview.erl b/src/couch_mrview/src/couch_mrview.erl
index c0f6ff49b..1a4a3ebcc 100644
--- a/src/couch_mrview/src/couch_mrview.erl
+++ b/src/couch_mrview/src/couch_mrview.erl
@@ -261,7 +261,7 @@ query_all_docs(Db, Args, Callback, Acc) when is_list(Args) ->
 query_all_docs(Db, Args0, Callback, Acc) ->
     Sig = couch_util:with_db(Db, fun(WDb) ->
         {ok, Info} = couch_db:get_db_info(WDb),
-        couch_index_util:hexsig(couch_hash:md5_hash(term_to_binary(Info)))
+        couch_index_util:hexsig(couch_hash:md5_hash(?term_to_bin(Info)))
     end),
     Args1 = Args0#mrargs{view_type = map},
     Args2 = couch_mrview_util:validate_all_docs_args(Db, Args1),
diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl
index 440eb7222..5913aa3d0 100644
--- a/src/couch_mrview/src/couch_mrview_util.erl
+++ b/src/couch_mrview/src/couch_mrview_util.erl
@@ -265,7 +265,7 @@ ddoc_to_mrst(DbName, #doc{id = Id, body = {Fields}}) ->
         partitioned = Partitioned
     },
     SigInfo = {Views, Language, DesignOpts, couch_index_util:sort_lib(Lib)},
-    {ok, IdxState#mrst{sig = couch_hash:md5_hash(term_to_binary(SigInfo))}}.
+    {ok, IdxState#mrst{sig = couch_hash:md5_hash(?term_to_bin(SigInfo))}}.
 
 set_view_type(_Args, _ViewName, []) ->
     throw({not_found, missing_named_view});
@@ -315,7 +315,7 @@ view_sig(Db, State, View, #mrargs{include_docs = true} = Args) ->
     UpdateSeq = couch_db:get_update_seq(Db),
     PurgeSeq = couch_db:get_purge_seq(Db),
     Term = view_sig_term(BaseSig, UpdateSeq, PurgeSeq),
-    couch_index_util:hexsig(couch_hash:md5_hash(term_to_binary(Term)));
+    couch_index_util:hexsig(couch_hash:md5_hash(?term_to_bin(Term)));
 view_sig(Db, State, {_Nth, _Lang, View}, Args) ->
     view_sig(Db, State, View, Args);
 view_sig(_Db, State, View, Args0) ->
@@ -327,7 +327,7 @@ view_sig(_Db, State, View, Args0) ->
         extra = []
     },
     Term = view_sig_term(Sig, UpdateSeq, PurgeSeq, Args),
-    couch_index_util:hexsig(couch_hash:md5_hash(term_to_binary(Term))).
+    couch_index_util:hexsig(couch_hash:md5_hash(?term_to_bin(Term))).
 
 view_sig_term(BaseSig, UpdateSeq, PurgeSeq) ->
     {BaseSig, UpdateSeq, PurgeSeq}.
@@ -1114,7 +1114,7 @@ sig_vsn_2x(State) ->
     KSI = proplists:get_value(<<"keyseq_indexed">>, DesignOpts, false),
     Views = [old_view_format(V, SI, KSI) || V <- State#mrst.views],
     SigInfo = {Views, Language, DesignOpts, couch_index_util:sort_lib(Lib)},
-    couch_hash:md5_hash(term_to_binary(SigInfo)).
+    couch_hash:md5_hash(?term_to_bin(SigInfo)).
 
 old_view_format(View, SI, KSI) ->
     {