diff options
author | Adam Kocoloski <kocolosk@apache.org> | 2010-06-16 14:53:06 +0000 |
---|---|---|
committer | Adam Kocoloski <kocolosk@apache.org> | 2010-06-16 14:53:06 +0000 |
commit | bc50bbf1e8bd7474f0cb91975dfbf7a7bbc1922b (patch) | |
tree | c042084aafff9e54c140828114a43fff89514392 /src/couchdb | |
parent | b3775dbe371acffea4ea44503cfdddc79278eca7 (diff) |
remove unused Bt from chunkify function
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@955244 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r-- | src/couchdb/couch_btree.erl | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/couchdb/couch_btree.erl b/src/couchdb/couch_btree.erl index a076b34c..d9eba774 100644 --- a/src/couchdb/couch_btree.erl +++ b/src/couchdb/couch_btree.erl @@ -271,29 +271,26 @@ complete_root(Bt, KPs) -> % written. Plus with the "case byte_size(term_to_binary(InList)) of" code % it's probably really inefficient. -% dialyzer says this pattern is never matched -% chunkify(_Bt, []) -> -% []; -chunkify(Bt, InList) -> +chunkify(InList) -> case byte_size(term_to_binary(InList)) of Size when Size > ?CHUNK_THRESHOLD -> NumberOfChunksLikely = ((Size div ?CHUNK_THRESHOLD) + 1), ChunkThreshold = Size div NumberOfChunksLikely, - chunkify(Bt, InList, ChunkThreshold, [], 0, []); + chunkify(InList, ChunkThreshold, [], 0, []); _Else -> [InList] end. -chunkify(_Bt, [], _ChunkThreshold, [], 0, OutputChunks) -> +chunkify([], _ChunkThreshold, [], 0, OutputChunks) -> lists:reverse(OutputChunks); -chunkify(_Bt, [], _ChunkThreshold, OutList, _OutListSize, OutputChunks) -> +chunkify([], _ChunkThreshold, OutList, _OutListSize, OutputChunks) -> lists:reverse([lists:reverse(OutList) | OutputChunks]); -chunkify(Bt, [InElement | RestInList], ChunkThreshold, OutList, OutListSize, OutputChunks) -> +chunkify([InElement | RestInList], ChunkThreshold, OutList, OutListSize, OutputChunks) -> case byte_size(term_to_binary(InElement)) of Size when (Size + OutListSize) > ChunkThreshold andalso OutList /= [] -> - chunkify(Bt, RestInList, ChunkThreshold, [], 0, [lists:reverse([InElement | OutList]) | OutputChunks]); + chunkify(RestInList, ChunkThreshold, [], 0, [lists:reverse([InElement | OutList]) | OutputChunks]); Size -> - chunkify(Bt, RestInList, ChunkThreshold, [InElement | OutList], OutListSize + Size, OutputChunks) + chunkify(RestInList, ChunkThreshold, [InElement | OutList], OutListSize + Size, OutputChunks) end. modify_node(Bt, RootPointerInfo, Actions, QueryOutput) -> @@ -336,7 +333,7 @@ get_node(#btree{fd = Fd}, NodePos) -> write_node(Bt, NodeType, NodeList) -> % split up nodes into smaller sizes - NodeListList = chunkify(Bt, NodeList), + NodeListList = chunkify(NodeList), % now write out each chunk and return the KeyPointer pairs for those nodes ResultList = [ begin |