diff options
author | Lukas Larsson <[email protected]> | 2017-10-12 15:55:04 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2017-11-20 09:57:46 +0100 |
commit | f1666d981aab4e4cf94b91dc097675fa0b056c97 (patch) | |
tree | 3a592f71441ba7a750d430b73c0a8d696c5c7978 /lib/stdlib/src/io_lib.erl | |
parent | a1c796e7f6b86b4b506492ae6354382c565278d1 (diff) | |
download | otp-f1666d981aab4e4cf94b91dc097675fa0b056c97.tar.gz otp-f1666d981aab4e4cf94b91dc097675fa0b056c97.tar.bz2 otp-f1666d981aab4e4cf94b91dc097675fa0b056c97.zip |
stdlib: Make io_lib and io_lib_pretty use maps iterator
Diffstat (limited to 'lib/stdlib/src/io_lib.erl')
-rw-r--r-- | lib/stdlib/src/io_lib.erl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/stdlib/src/io_lib.erl b/lib/stdlib/src/io_lib.erl index 9d447418f8..3c8430b820 100644 --- a/lib/stdlib/src/io_lib.erl +++ b/lib/stdlib/src/io_lib.erl @@ -963,7 +963,18 @@ limit_tail(Other, D) -> %% maps:from_list() creates a map with the same internal ordering of %% the selected associations as in Map. limit_map(Map, D) -> - maps:from_list(erts_internal:maps_to_list(Map, D)). + limit_map(maps:iterator(Map), D, []). + +limit_map(_I, 0, Acc) -> + maps:from_list(Acc); +limit_map(I, D, Acc) -> + case maps:next(I) of + {K, V, NextI} -> + limit_map(NextI, D-1, [{K,V} | Acc]); + none -> + maps:from_list(Acc) + end. + %% maps:from_list(limit_map_body(erts_internal:maps_to_list(Map, D), D)). %% limit_map_body(_, 0) -> [{'...', '...'}]; |