aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2017-09-14 16:35:27 +0200
committerSiri Hansen <[email protected]>2017-09-14 16:35:27 +0200
commit2b68cd320d28f6bf9b41bb8d52d34cef15e4baf2 (patch)
tree7f70e00e52467b9c12febde7a0e0757cc22458b6
parentbd36da0f509ee4e357fdf51b60f3dfcecc824eb8 (diff)
downloadotp-2b68cd320d28f6bf9b41bb8d52d34cef15e4baf2.tar.gz
otp-2b68cd320d28f6bf9b41bb8d52d34cef15e4baf2.tar.bz2
otp-2b68cd320d28f6bf9b41bb8d52d34cef15e4baf2.zip
kernel: Don't call other modules from simple error logger
error_logger implements a simple handler which is used when no other handler is active. This handler is used during system startup, when there is no guarantee that all modules are loaded and must therefore not use any other modules for the formatting. Commit 41b856a2cb270ef807beaa84afe1bb890de5f237 introduced a call to io_lib:printable_list/1, which is now removed.
-rw-r--r--lib/kernel/src/error_logger.erl33
1 files changed, 24 insertions, 9 deletions
diff --git a/lib/kernel/src/error_logger.erl b/lib/kernel/src/error_logger.erl
index f07ec52cfa..585507c545 100644
--- a/lib/kernel/src/error_logger.erl
+++ b/lib/kernel/src/error_logger.erl
@@ -499,16 +499,31 @@ display4(A = [_|_]) ->
display4(A) ->
erlang:display(A).
-
-string_p(Term) when is_list(Term) ->
- string_p1(lists:flatten(Term));
-string_p(_Term) ->
- false.
-
-string_p1([]) ->
+string_p([]) ->
false;
-string_p1(FlatList) ->
- io_lib:printable_list(FlatList).
+string_p(Term) ->
+ string_p1(Term).
+
+string_p1([H|T]) when is_integer(H), H >= $\040, H =< $\176 ->
+ string_p1(T);
+string_p1([H|T]) when is_integer(H), H >= 16#A0, H < 16#D800;
+ is_integer(H), H > 16#DFFF, H < 16#FFFE;
+ is_integer(H), H > 16#FFFF, H =< 16#10FFFF ->
+ string_p1(T);
+string_p1([$\n|T]) -> string_p1(T);
+string_p1([$\r|T]) -> string_p1(T);
+string_p1([$\t|T]) -> string_p1(T);
+string_p1([$\v|T]) -> string_p1(T);
+string_p1([$\b|T]) -> string_p1(T);
+string_p1([$\f|T]) -> string_p1(T);
+string_p1([$\e|T]) -> string_p1(T);
+string_p1([H|T]) when is_list(H) ->
+ case string_p1(H) of
+ true -> string_p1(T);
+ _ -> false
+ end;
+string_p1([]) -> true;
+string_p1(_) -> false.
-spec limit_term(term()) -> term().