From 6ae13b5f8b827bc87a8cf3306c3caa1b97e49df3 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Thu, 30 Sep 2010 12:03:15 +0000 Subject: Removing ?getv macros. With OTP releases up to R13B03 it's not possible to define a 2 macro functions with the same name and different arities. (Only allowed in R13B04 and R14). git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1003025 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_btree.erl | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/couchdb/couch_btree.erl') diff --git a/src/couchdb/couch_btree.erl b/src/couchdb/couch_btree.erl index 3331e2eb..0e47bac7 100644 --- a/src/couchdb/couch_btree.erl +++ b/src/couchdb/couch_btree.erl @@ -16,7 +16,6 @@ -export([fold/4, full_reduce/1, final_reduce/2, foldl/3, foldl/4]). -export([fold_reduce/4, lookup/2, get_state/1, set_options/2]). --include("couch_db.hrl"). -define(CHUNK_THRESHOLD, 16#4ff). -record(btree, @@ -71,10 +70,10 @@ final_reduce(Reduce, {KVs, Reductions}) -> final_reduce(Reduce, {[], [Red | Reductions]}). fold_reduce(#btree{root=Root}=Bt, Fun, Acc, Options) -> - Dir = ?getv(dir, Options, fwd), - StartKey = ?getv(start_key, Options), - EndKey = ?getv(end_key, Options), - KeyGroupFun = ?getv(key_group_fun, Options, fun(_,_) -> true end), + Dir = couch_util:get_value(dir, Options, fwd), + StartKey = couch_util:get_value(start_key, Options), + EndKey = couch_util:get_value(end_key, Options), + KeyGroupFun = couch_util:get_value(key_group_fun, Options, fun(_,_) -> true end), {StartKey2, EndKey2} = case Dir of rev -> {EndKey, StartKey}; @@ -108,9 +107,9 @@ convert_fun_arity(Fun) when is_function(Fun, 3) -> Fun. % Already arity 3 make_key_in_end_range_function(#btree{less=Less}, fwd, Options) -> - case ?getv(end_key_gt, Options) of + case couch_util:get_value(end_key_gt, Options) of undefined -> - case ?getv(end_key, Options) of + case couch_util:get_value(end_key, Options) of undefined -> fun(_Key) -> true end; LastKey -> @@ -120,9 +119,9 @@ make_key_in_end_range_function(#btree{less=Less}, fwd, Options) -> fun(Key) -> Less(Key, EndKey) end end; make_key_in_end_range_function(#btree{less=Less}, rev, Options) -> - case ?getv(end_key_gt, Options) of + case couch_util:get_value(end_key_gt, Options) of undefined -> - case ?getv(end_key, Options) of + case couch_util:get_value(end_key, Options) of undefined -> fun(_Key) -> true end; LastKey -> @@ -143,10 +142,10 @@ foldl(Bt, Fun, Acc, Options) -> fold(#btree{root=nil}, _Fun, Acc, _Options) -> {ok, {[], []}, Acc}; fold(#btree{root=Root}=Bt, Fun, Acc, Options) -> - Dir = ?getv(dir, Options, fwd), + Dir = couch_util:get_value(dir, Options, fwd), InRange = make_key_in_end_range_function(Bt, Dir, Options), Result = - case ?getv(start_key, Options) of + case couch_util:get_value(start_key, Options) of undefined -> stream_node(Bt, [], Bt#btree.root, InRange, Dir, convert_fun_arity(Fun), Acc); -- cgit v1.2.3