Skip to content

Commit

Permalink
chore: fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
janl committed Aug 7, 2023
1 parent 6d1d1fa commit 072d467
Showing 1 changed file with 1 addition and 41 deletions.
42 changes: 1 addition & 41 deletions src/couch/src/couch_db.erl
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@
]).

-include_lib("couch/include/couch_db.hrl").
% TODO: can we do without this?
-include_lib("couch_mrview/include/couch_mrview.hrl").

-include("couch_db_int.hrl").

-define(DBNAME_REGEX,
Expand Down Expand Up @@ -321,9 +320,6 @@ open_doc(Db, Id, Options) ->
Else
end.

apply_open_options(Db, Options) ->
apply_open_options2(Db, Options).

apply_open_options(Db, {ok, Doc}, Options) ->
ok = validate_access(Db, Doc, Options),
apply_open_options1({ok, Doc}, Options);
Expand Down Expand Up @@ -1392,36 +1388,6 @@ doc_tag(#doc{meta = Meta}) ->
Else -> throw({invalid_doc_tag, Else})
end.

validate_update(Db, Doc) ->
case catch validate_access(Db, Doc) of
ok -> Doc;
Error -> Error
end.

validate_docs_access(Db, DocBuckets, DocErrors) ->
validate_docs_access1(Db, DocBuckets, {[], DocErrors}).

validate_docs_access1(_Db, [], {DocBuckets0, DocErrors}) ->
% DocBuckets1 = lists:reverse(lists:map(fun lists:reverse/1, DocBuckets0)),
DocBuckets =
case DocBuckets0 of
[[]] -> [];
Else -> Else
end,
{ok, DocBuckets, lists:reverse(DocErrors)};
validate_docs_access1(Db, [DocBucket | RestBuckets], {DocAcc, ErrorAcc}) ->
{NewBuckets, NewErrors} = lists:foldl(
fun(Doc, {Acc, ErrAcc}) ->
case catch validate_access(Db, Doc) of
ok -> {[Doc | Acc], ErrAcc};
Error -> {Acc, [{doc_tag(Doc), Error} | ErrAcc]}
end
end,
{[], ErrorAcc},
DocBucket
),
validate_docs_access1(Db, RestBuckets, {[NewBuckets | DocAcc], NewErrors}).

update_docs(Db, Docs0, Options, ?REPLICATED_CHANGES) ->
Docs = tag_docs(Docs0),

Expand Down Expand Up @@ -1824,12 +1790,6 @@ open_read_stream(Db, AttState) ->
is_active_stream(Db, StreamEngine) ->
couch_db_engine:is_active_stream(Db, StreamEngine).

changes_since(Db, StartSeq, Fun, Options, Acc) when is_record(Db, db) ->
case couch_db:has_access_enabled(Db) and not couch_db:is_admin(Db) of
true -> couch_mrview:query_changes_access(Db, StartSeq, Fun, Options, Acc);
false -> couch_db_engine:fold_changes(Db, StartSeq, Fun, Options, Acc)
end.

calculate_start_seq(_Db, _Node, Seq) when is_integer(Seq) ->
Seq;
calculate_start_seq(Db, Node, {Seq, Uuid}) ->
Expand Down

0 comments on commit 072d467

Please sign in to comment.