Corrections

Support an empty list of entries being added.  Also specify a tree
correctly in all from_orderedlist scenarios
This commit is contained in:
Martin Sumner 2017-01-23 00:22:53 +00:00
parent cc9494735b
commit 2c4c5c9597
2 changed files with 4 additions and 2 deletions

View file

@ -263,7 +263,7 @@
{"SST09",
{warn, "Read request exposes slot with bad CRC"}},
{"SST10",
{info, "Expansion sought to support pointer to pid ~w status ~w"}},
{debug, "Expansion sought to support pointer to pid ~w status ~w"}},
{"CDB01",
{info, "Opening file for writing with filename ~s"}},

View file

@ -360,7 +360,7 @@ load_level(LevelIdx, Level, PidFun, SQNFun) ->
{L0, MaxSQN} = lists:foldr(LowerLevelLoadFun,
{[], 0},
leveled_tree:to_list(Level)),
{leveled_tree:from_orderedlist(L0), MaxSQN}
{leveled_tree:from_orderedlist(L0, ?TREE_TYPE, ?TREE_WIDTH), MaxSQN}
end.
close_level(LevelIdx, Level, CloseEntryFun) when LevelIdx =< 1 ->
@ -389,6 +389,8 @@ pred_fun(_LevelIdx, _StartKey, EndKey) ->
EK < EndKey
end.
add_entry(_LevelIdx, Level, []) ->
Level;
add_entry(LevelIdx, Level, Entries) when is_list(Entries) ->
FirstEntry = lists:nth(1, Entries),
PredFun = pred_fun(LevelIdx,