From 6c6db011c2064597526c6f36878a282238dd2bf2 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Mon, 27 Sep 2010 19:14:37 +0000 Subject: Replacing calls to couch_util:get_value with ?getv git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1001879 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_doc.erl | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/couchdb/couch_doc.erl') diff --git a/src/couchdb/couch_doc.erl b/src/couchdb/couch_doc.erl index f8c874b0..1063f501 100644 --- a/src/couchdb/couch_doc.erl +++ b/src/couchdb/couch_doc.erl @@ -195,26 +195,26 @@ transfer_fields([{<<"_rev">>, _Rev} | Rest], Doc) -> transfer_fields([{<<"_attachments">>, {JsonBins}} | Rest], Doc) -> Atts = lists:map(fun({Name, {BinProps}}) -> - case couch_util:get_value(<<"stub">>, BinProps) of + case ?getv(<<"stub">>, BinProps) of true -> - Type = couch_util:get_value(<<"content_type">>, BinProps), - RevPos = couch_util:get_value(<<"revpos">>, BinProps, nil), - DiskLen = couch_util:get_value(<<"length">>, BinProps), + Type = ?getv(<<"content_type">>, BinProps), + RevPos = ?getv(<<"revpos">>, BinProps, nil), + DiskLen = ?getv(<<"length">>, BinProps), {Enc, EncLen} = att_encoding_info(BinProps), #att{name=Name, data=stub, type=Type, att_len=EncLen, disk_len=DiskLen, encoding=Enc, revpos=RevPos}; _ -> - Type = couch_util:get_value(<<"content_type">>, BinProps, + Type = ?getv(<<"content_type">>, BinProps, ?DEFAULT_ATTACHMENT_CONTENT_TYPE), - RevPos = couch_util:get_value(<<"revpos">>, BinProps, 0), - case couch_util:get_value(<<"follows">>, BinProps) of + RevPos = ?getv(<<"revpos">>, BinProps, 0), + case ?getv(<<"follows">>, BinProps) of true -> - DiskLen = couch_util:get_value(<<"length">>, BinProps), + DiskLen = ?getv(<<"length">>, BinProps), {Enc, EncLen} = att_encoding_info(BinProps), #att{name=Name, data=follows, type=Type, encoding=Enc, att_len=EncLen, disk_len=DiskLen, revpos=RevPos}; _ -> - Value = couch_util:get_value(<<"data">>, BinProps), + Value = ?getv(<<"data">>, BinProps), Bin = base64:decode(Value), LenBin = size(Bin), #att{name=Name, data=Bin, type=Type, att_len=LenBin, @@ -225,8 +225,8 @@ transfer_fields([{<<"_attachments">>, {JsonBins}} | Rest], Doc) -> transfer_fields(Rest, Doc#doc{atts=Atts}); transfer_fields([{<<"_revisions">>, {Props}} | Rest], Doc) -> - RevIds = couch_util:get_value(<<"ids">>, Props), - Start = couch_util:get_value(<<"start">>, Props), + RevIds = ?getv(<<"ids">>, Props), + Start = ?getv(<<"start">>, Props), if not is_integer(Start) -> throw({doc_validation, "_revisions.start isn't an integer."}); not is_list(RevIds) -> @@ -261,12 +261,12 @@ transfer_fields([Field | Rest], #doc{body=Fields}=Doc) -> transfer_fields(Rest, Doc#doc{body=[Field|Fields]}). att_encoding_info(BinProps) -> - DiskLen = couch_util:get_value(<<"length">>, BinProps), - case couch_util:get_value(<<"encoding">>, BinProps) of + DiskLen = ?getv(<<"length">>, BinProps), + case ?getv(<<"encoding">>, BinProps) of undefined -> {identity, DiskLen}; Enc -> - EncodedLen = couch_util:get_value(<<"encoded_length">>, BinProps, DiskLen), + EncodedLen = ?getv(<<"encoded_length">>, BinProps, DiskLen), {list_to_existing_atom(?b2l(Enc)), EncodedLen} end. @@ -338,7 +338,7 @@ att_to_bin(#att{data=DataFun, att_len=Len}) when is_function(DataFun)-> ). get_validate_doc_fun(#doc{body={Props}}=DDoc) -> - case couch_util:get_value(<<"validate_doc_update">>, Props) of + case ?getv(<<"validate_doc_update">>, Props) of undefined -> nil; _Else -> @@ -473,7 +473,7 @@ doc_from_multi_part_stream(ContentType, DataFun) -> end. mp_parse_doc({headers, H}, []) -> - case couch_util:get_value("content-type", H) of + case ?getv("content-type", H) of {"application/json", _} -> fun (Next) -> mp_parse_doc(Next, []) -- cgit v1.2.3