Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

tidier cleanup #3

Closed
wants to merge 2 commits into from

1 participant

@metajack

I recently discovered the tidier tool for cleaning up Erlang code automatically. While testing it, I ran it on jsonerl.erl, and these minor changes are what it found.

There is also some dead code removal that was found by tidier's author, Kostis.

metajack added some commits
@metajack metajack Removed dead code.
Found by Kostis Sagonas.
d487948
@metajack metajack Tidied up code.
Changes found by tidier tool.
0516f2a
@metajack

Three years is a long time. Closing this.

@metajack metajack closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 26, 2010
  1. @metajack

    Removed dead code.

    metajack authored
    Found by Kostis Sagonas.
  2. @metajack

    Tidied up code.

    metajack authored
    Changes found by tidier tool.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 9 deletions.
  1. +3 −9 jsonerl.erl
View
12 jsonerl.erl
@@ -448,7 +448,7 @@ tokenize_number(B, eint1, S=#decoder{offset=O}, Acc) ->
{{float, lists:reverse(Acc)}, S}
end.
-tokenize(B, S=#decoder{offset=O}) ->
+tokenize(B, S=#decoder{offset=O, state=State}) ->
case B of
<<_:O/binary, C, _/binary>> when ?IS_WHITESPACE(C) ->
tokenize(B, ?INC_CHAR(S, C));
@@ -476,7 +476,7 @@ tokenize(B, S=#decoder{offset=O}) ->
orelse C =:= $- ->
tokenize_number(B, S);
<<_:O/binary>> ->
- trim = S#decoder.state,
+ trim = State,
{eof, S}
end.
@@ -487,7 +487,6 @@ tokenize(B, S=#decoder{offset=O}) ->
obj_new() ->
{}.
-is_obj(Tuples) when is_tuple(Tuples) -> is_obj(tuple_to_list(Tuples));
is_obj(Tuples) when is_list(Tuples) ->
F = fun ({K, _}) when is_binary(K) ->
true;
@@ -550,12 +549,7 @@ equiv_object(T1, T2) ->
equiv_list([], []) ->
true;
equiv_list([V1 | L1], [V2 | L2]) ->
- case equiv(V1, V2) of
- true ->
- equiv_list(L1, L2);
- false ->
- false
- end.
+ equiv(V1, V2) andalso equiv_list(L1, L2).
% ------------ TESTS ---------------------
Something went wrong with that request. Please try again.