Use pattern matching instead of length() BIF
This commit is contained in:
parent
7439a2738d
commit
d6a3180ecd
1 changed files with 3 additions and 4 deletions
|
@ -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
|
% @private Given an offset and a size, return `true' if a byte range has
|
||||||
% <b>not</b> been written. Otherwise, return `false'.
|
% <b>not</b> been written. Otherwise, return `false'.
|
||||||
is_byte_range_unwritten(Offset, Size, Unwritten) ->
|
is_byte_range_unwritten(Offset, Size, Unwritten) ->
|
||||||
case length(Unwritten) of
|
case Unwritten of
|
||||||
0 ->
|
[] ->
|
||||||
lager:critical("Unwritten byte list has 0 entries! This should never happen."),
|
lager:critical("Unwritten byte list has 0 entries! This should never happen."),
|
||||||
false;
|
false;
|
||||||
1 ->
|
[{Eof, infinity}] ->
|
||||||
{Eof, infinity} = hd(Unwritten),
|
|
||||||
Offset >= Eof;
|
Offset >= Eof;
|
||||||
_ ->
|
_ ->
|
||||||
case lookup_unwritten(Offset, Size, Unwritten) of
|
case lookup_unwritten(Offset, Size, Unwritten) of
|
||||||
|
|
Loading…
Reference in a new issue