浏览代码

ft: 代码修改

master
SisMaker 3 年前
父节点
当前提交
f352f2d114
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. +4
    -4
      src/utils/tpTermCut.erl

+ 4
- 4
src/utils/tpTermCut.erl 查看文件

@ -1,4 +1,5 @@
-module(tpTermCut).
-include("eTpf.hrl").
%% 使
@ -15,8 +16,6 @@ cut(_, Depth) when Depth > ?MaxDepth ->
cut(Bits, _) when is_bitstring(Bits), bit_size(Bits) > ?MaxBitSize ->
<<CutBits:?MaxBinSize/binary, _/bits>> = Bits,
<<CutBits/binary, "$truncated">>;
cut(Term, Depth) when is_list(Term), Depth =:= ?MaxDepth ->
['$truncated'];
cut(Term, Depth) when is_list(Term) ->
cutList(Term, Depth, 0, ?MaxListSize, 0, []);
cut(Term, Depth) when is_map(Term), Depth =:= ?MaxDepth ->
@ -33,11 +32,12 @@ cut(Term, _) ->
cutList([], _, _, _, _, Acc) ->
lists:reverse(Acc);
cutList([Term | Tail], Depth, Len, MaxLen, NumStructs, Acc) ->
case Len > MaxLen orelse NumStructs > ?MaxNestStruct of
case Len >= MaxLen orelse NumStructs >= ?MaxNestStruct of
true ->
lists:reverse(['$truncated' | Acc]);
lists:reverse(['$truncated33' | Acc]);
_ ->
%% if List was a cons, Tail can be anything
io:format("IMY********************1111 ~p~n", [{Len, NumStructs, Term}]),
cutList(Tail, Depth, Len + 1, MaxLen, NumStructs + isStruct(Term), [cut(Term, Depth + 1) | Acc])
end;
cutList(Term, Depth, _, _, _, Acc) -> %% if List was a cons [[[a,a,a|b],1,2,3]|bbbb]

正在加载...
取消
保存