summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_util.erl
diff options
context:
space:
mode:
authorNoah Slater <nslater@apache.org>2009-07-06 00:33:50 +0000
committerNoah Slater <nslater@apache.org>2009-07-06 00:33:50 +0000
commit282b96ddd9a84b740788c2358ec0f5fedafb7cc6 (patch)
treefb48e605ceb8079d0195d3b1ec0eca7110fa7ef2 /src/couchdb/couch_util.erl
parentb5cc085d3bc6316063f14adedf20632ee904875d (diff)
trimmed trailing whitespace
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@791350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_util.erl')
-rw-r--r--src/couchdb/couch_util.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/couchdb/couch_util.erl b/src/couchdb/couch_util.erl
index 1a2929e4..7cf19354 100644
--- a/src/couchdb/couch_util.erl
+++ b/src/couchdb/couch_util.erl
@@ -56,7 +56,7 @@ terminate_linked(Reason) ->
new_uuid() ->
list_to_binary(to_hex(crypto:rand_bytes(16))).
-
+
to_hex([]) ->
[];
to_hex(Bin) when is_binary(Bin) ->
@@ -73,7 +73,7 @@ parse_term(Bin) when is_binary(Bin)->
parse_term(List) ->
{ok, Tokens, _} = erl_scan:string(List ++ "."),
erl_parse:parse_term(Tokens).
-
+
% returns a random integer
rand32() ->
@@ -193,15 +193,15 @@ collate(A, B, Options) when is_binary(A), is_binary(B) ->
should_flush() ->
should_flush(?FLUSH_MAX_MEM).
-
+
should_flush(MemThreshHold) ->
{memory, ProcMem} = process_info(self(), memory),
- BinMem = lists:foldl(fun({_Id, Size, _NRefs}, Acc) -> Size+Acc end,
+ BinMem = lists:foldl(fun({_Id, Size, _NRefs}, Acc) -> Size+Acc end,
0, element(2,process_info(self(), binary))),
if ProcMem+BinMem > 2*MemThreshHold ->
garbage_collect(),
{memory, ProcMem2} = process_info(self(), memory),
- BinMem2 = lists:foldl(fun({_Id, Size, _NRefs}, Acc) -> Size+Acc end,
+ BinMem2 = lists:foldl(fun({_Id, Size, _NRefs}, Acc) -> Size+Acc end,
0, element(2,process_info(self(), binary))),
if ProcMem2+BinMem2 > MemThreshHold ->
true;
@@ -230,7 +230,7 @@ encodeBase64(Bs) when list(Bs) ->
encodeBase64(list_to_binary(Bs), <<>>);
encodeBase64(Bs) ->
encodeBase64(Bs, <<>>).
-
+
encodeBase64(<<B:3/binary, Bs/binary>>, Acc) ->
<<C1:6, C2:6, C3:6, C4:6>> = B,
encodeBase64(Bs, <<Acc/binary, (enc(C1)), (enc(C2)), (enc(C3)), (enc(C4))>>);