Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplify internal function because it is never passed a deep list

Thanks for Kostis for helping me figure this one out
  • Loading branch information...
commit b5047470370618c655a80bc1e2388af3a69feee7 1 parent 6968c8c
@Vagabond Vagabond authored
Showing with 5 additions and 10 deletions.
  1. +5 −10 src/lager_format.erl
View
15 src/lager_format.erl
@@ -473,19 +473,14 @@ adjust(Data, Pad, left) -> [Data|Pad];
adjust(Data, Pad, right) -> [Pad|Data].
%% Flatten and truncate a deep list to at most N elements.
-
flat_trunc(List, N) when is_integer(N), N >= 0 ->
- flat_trunc(List, N, [], []).
+ flat_trunc(List, N, []).
-flat_trunc(L, 0, _, R) when is_list(L) ->
+flat_trunc(L, 0, R) when is_list(L) ->
lists:reverse(R);
-flat_trunc([H|T], N, S, R) when is_list(H) ->
- flat_trunc(H, N, [T|S], R);
-flat_trunc([H|T], N, S, R) ->
- flat_trunc(T, N-1, S, [H|R]);
-flat_trunc([], N, [H|S], R) ->
- flat_trunc(H, N, S, R);
-flat_trunc([], _, [], R) ->
+flat_trunc([H|T], N, R) ->
+ flat_trunc(T, N-1, [H|R]);
+flat_trunc([], _, R) ->
lists:reverse(R).
%% A deep version of string:chars/2,3
Please sign in to comment.
Something went wrong with that request. Please try again.