Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Better refactorings (from @kostis) to remove unmatched_returns

  • Loading branch information...
commit e53571308a781fc9f9edc2d25193ff9ff98664a6 1 parent a110325
David Reid authored
Showing with 20 additions and 22 deletions.
  1. +12 −14 src/mochiweb_request.erl
  2. +8 −8 src/mochiweb_socket_server.erl
View
26 src/mochiweb_request.erl
@@ -221,12 +221,13 @@ stream_body(MaxChunkSize, ChunkFun, FunState, MaxBodyLength) ->
Value when is_list(Value) ->
string:to_lower(Value)
end,
- _ = case Expect of
- "100-continue" ->
- start_raw_response({100, gb_trees:empty()});
- _Else ->
- ok
- end,
+ case Expect of
+ "100-continue" ->
+ _ = start_raw_response({100, gb_trees:empty()}),
+ ok;
+ _Else ->
+ ok
+ end,
case body_length() of
undefined ->
undefined;
@@ -399,14 +400,11 @@ should_close() ->
%% @doc Clean up any junk in the process dictionary, required before continuing
%% a Keep-Alive request.
cleanup() ->
- _ = [erase(K) || K <- [?SAVE_QS,
- ?SAVE_PATH,
- ?SAVE_RECV,
- ?SAVE_BODY,
- ?SAVE_BODY_LENGTH,
- ?SAVE_POST,
- ?SAVE_COOKIE,
- ?SAVE_FORCE_CLOSE]],
+ L = [?SAVE_QS, ?SAVE_PATH, ?SAVE_RECV, ?SAVE_BODY, ?SAVE_BODY_LENGTH,
+ ?SAVE_POST, ?SAVE_COOKIE, ?SAVE_FORCE_CLOSE],
+ lists:foreach(fun(K) ->
+ erase(K)
+ end, L),
ok.
%% @spec parse_qs() -> [{Key::string(), Value::string()}]
View
16 src/mochiweb_socket_server.erl
@@ -117,14 +117,14 @@ parse_options([{profile_fun, ProfileFun} | Rest], State) when is_function(Profil
start_server(State=#mochiweb_socket_server{ssl=Ssl, name=Name}) ->
- _ = case Ssl of
- true ->
- ok = mochiweb:ensure_started(crypto),
- ok = mochiweb:ensure_started(public_key),
- ok = mochiweb:ensure_started(ssl);
- false ->
- void
- end,
+ case Ssl of
+ true ->
+ ok = mochiweb:ensure_started(crypto),
+ ok = mochiweb:ensure_started(public_key),
+ ok = mochiweb:ensure_started(ssl);
+ false ->
+ ok
+ end,
case Name of
undefined ->
gen_server:start_link(?MODULE, State, []);
Please sign in to comment.
Something went wrong with that request. Please try again.