Use pattern matching instead of length() BIF

This commit is contained in:
Scott Lystig Fritchie 2015-10-14 16:52:03 +09:00
parent 7439a2738d
commit d6a3180ecd

View file

@ -686,12 +686,11 @@ do_write(FHd, FHc, Filename, TaggedCsum, Offset, Size, Data, U) ->
% @private Given an offset and a size, return `true' if a byte range has
% <b>not</b> been written. Otherwise, return `false'.
is_byte_range_unwritten(Offset, Size, Unwritten) ->
case length(Unwritten) of
0 ->
case Unwritten of
[] ->
lager:critical("Unwritten byte list has 0 entries! This should never happen."),
false;
1 ->
{Eof, infinity} = hd(Unwritten),
[{Eof, infinity}] ->
Offset >= Eof;
_ ->
case lookup_unwritten(Offset, Size, Unwritten) of