Permalink
Browse files

indendation cleanup

  • Loading branch information...
1 parent c90c603 commit 6e96a140da32bd97b945b65f994be8c3ffb06db0 @klacke committed Mar 3, 2011
View
@@ -103,9 +103,9 @@
redirect_scheme_port/1, redirect_scheme/1,
tmpdir/0, tmpdir/1, split_at/2,
id_dir/1, ctl_file/1]).
-
-
-
+
+
+
-import(lists, [reverse/1, reverse/2]).
@@ -141,10 +141,10 @@ add_server(DocRoot, SL) when is_list(DocRoot),is_list(SL) ->
%% Change #auth in authdirs to {Dir, #auth} if needed
Fun = fun
(A = #auth{dir = [Dir]}, Acc) -> [{Dir, A}| Acc];
- (A, Acc) -> [A| Acc]
- end,
- Authdirs = lists:foldr(Fun, [], SC#sconf.authdirs),
- yaws_config:add_sconf(SC#sconf{authdirs = Authdirs}).
+ (A, Acc) -> [A| Acc]
+ end,
+Authdirs = lists:foldr(Fun, [], SC#sconf.authdirs),
+yaws_config:add_sconf(SC#sconf{authdirs = Authdirs}).
create_gconf(GL, Id) when is_list(GL) ->
setup_gconf(GL, yaws_config:make_default_gconf(false, Id)).
@@ -890,46 +890,6 @@ parse_qvalue(_) ->
three_digits_to_integer(D1, D2, D3) ->
100*(D1-$0)+10*(D2-$0)+D3-$0.
-%% has_buggy_deflate(UserAgent, Mime) ->
-%% UA = parse_ua(UserAgent),
-%% in_ua(
-%% fun("Mozilla/5.0") ->
-%% in_comment(
-%% fun("rv:0."++_) ->
-%% true;
-%% ("Konqueror"++_) ->
-%% true;
-%% (_) ->
-%% false
-%% end,
-%% UA);
-%% ("Mozilla/4.0") ->
-%% in_comment(
-%% fun("MSIE"++_) ->
-%% % The fact that IE is
-%% % broken does of
-%% % course mean that we
-%% % will have to abondon
-%% % `deflate' (in favor
-%% % of `gzip')
-%% % altogether. To
-%% % do...
-%% true;
-%% (_) ->
-%% false
-%% end,
-%% UA);
-%% ("AppleWebKit"++_) ->
-%% true;
-%% ("Galeon"++_) ->
-%% true;
-%% ("w3m"++_) ->
-%% % Problems when saving.
-%% Mime /= "text/html";
-%% (_) ->
-%% false
-%% end,
-%% UA).
%% Gzip encoding
View
@@ -315,30 +315,38 @@ parse_multi(header, [H|T], Boundary, Acc, Res, Tmp) ->
parse_multi(header, [], Boundary, Acc, Res, Tmp) ->
{cont, {header, [], Boundary, Acc, Tmp}, Res};
+%% store in case no match
parse_multi(body, [B|T], [B|T1], Acc, Res, _Tmp) ->
- parse_multi(boundary, T, T1, Acc, Res, {[B|T], [B|T1]}); %% store in case no match
+ parse_multi(boundary, T, T1, Acc, Res, {[B|T], [B|T1]});
parse_multi(body, [H|T], Boundary, Acc, Res, Tmp) ->
parse_multi(body, T, Boundary, [H|Acc], Res, Tmp);
-parse_multi(body, [], Boundary, [], Res, Tmp) -> %% would be empty partial body result
+%% would be empty partial body result
+parse_multi(body, [], Boundary, [], Res, Tmp) ->
{cont, {body, [], Boundary, [], Tmp}, Res};
-parse_multi(body, [], Boundary, Acc, Res, Tmp) -> %% make a partial body result
+%% make a partial body result
+parse_multi(body, [], Boundary, Acc, Res, Tmp) ->
{cont, {body, [], Boundary, [], Tmp}, [{part_body, lists:reverse(Acc)}|Res]};
parse_multi(boundary, [B|T], [B|T1], Acc, Res, Tmp) ->
parse_multi(boundary, T, T1, Acc, Res, Tmp);
-parse_multi(boundary, [_H|_T], [_B|_T1], start, Res, {[D|T2], Bound}) -> %% false alarm
+%% false alarm
+parse_multi(boundary, [_H|_T], [_B|_T1], start, Res, {[D|T2], Bound}) ->
parse_multi(body, T2, Bound, [D], Res, []);
-parse_multi(boundary, [_H|_T], [_B|_T1], Acc, Res, {[D|T2], Bound}) -> %% false alarm
+%% false alarm
+parse_multi(boundary, [_H|_T], [_B|_T1], Acc, Res, {[D|T2], Bound}) ->
parse_multi(body, T2, Bound, [D|Acc], Res, []);
-parse_multi(boundary, [], [B|T1], Acc, Res, Tmp) -> %% run out of body
+%% run out of body
+parse_multi(boundary, [], [B|T1], Acc, Res, Tmp) ->
{cont, {boundary, [], [B|T1], Acc, Tmp}, Res};
parse_multi(boundary, [], [], start, Res, {_, Bound}) ->
{cont, {is_end, [], Bound, [], []}, Res};
parse_multi(boundary, [], [], Acc, Res, {_, Bound}) ->
{cont, {is_end, [], Bound, [], []}, [{body, lists:reverse(Acc)}|Res]};
-parse_multi(boundary, [H|T], [], start, Res, {_, Bound}) -> %% matched whole boundary!
+%% matched whole boundary!
+parse_multi(boundary, [H|T], [], start, Res, {_, Bound}) ->
parse_multi(is_end, [H|T], Bound, [], Res, []);
-parse_multi(boundary, [H|T], [], Acc, Res, {_, Bound}) -> %% matched whole boundary!
+%% matched whole boundary!
+parse_multi(boundary, [H|T], [], Acc, Res, {_, Bound}) ->
parse_multi(is_end, [H|T], Bound, [], [{body, lists:reverse(Acc)}|Res], []);
parse_multi(is_end, "--"++_, _Boundary, _Acc, Res, _Tmp) ->
View
@@ -132,7 +132,8 @@ compile_file(C, LineNo, Chars = "<verbatim>" ++ _Tail, html,
?Debug("start verbatim:~p",[LineNo]),
Len = length(Chars),
C2 = C#comp{outfile = ["<pre>\n"]}, %% use as accumulator
- compile_file(C2, LineNo+1, line() , verbatim , Len, [{data, NumChars} | Ack], Es);
+ compile_file(C2, LineNo+1, line() , verbatim , Len,
+ [{data, NumChars} | Ack], Es);
compile_file(C, LineNo, Chars = "</verbatim>" ++ _Tail, verbatim,
NumChars, Ack, Es) ->
@@ -149,7 +150,7 @@ compile_file(C, LineNo, Chars, verbatim, NumChars, Ack,Es) ->
false ->
C2 = C#comp{outfile = [yaws_api:htmlize(Chars) | C#comp.outfile]},
compile_file(C2, LineNo+1, line(), verbatim, NumChars +
- length(Chars), Ack,Es)
+ length(Chars), Ack,Es)
end;
compile_file(C, LineNo, _Chars = "</erl>" ++ Tail, erl, NumChars, Ack, Es) ->
@@ -160,7 +161,8 @@ compile_file(C, LineNo, _Chars = "</erl>" ++ Tail, erl, NumChars, Ack, Es) ->
case get(use_yfile_name) of
true ->
file:write_file("../../ebin/" ++
- filename:rootname(C#comp.outfile)++".beam",
+ filename:rootname(
+ C#comp.outfile)++".beam",
Binary);
_ ->
ok
@@ -203,7 +205,7 @@ compile_file(C, LineNo, Chars, erl, NumChars, Ack,Es) ->
?Debug("Gen: ~s", [Chars]),
io:format(C#comp.outfd, "~s", [Chars]),
compile_file(C, LineNo+1, line(), erl, NumChars +
- length(Chars), Ack,Es)
+ length(Chars), Ack,Es)
end;
compile_file(C, LineNo, [], html, NumChars, Ack, Es) ->
@@ -467,17 +469,18 @@ report_warnings(C, Ws0) ->
File = "./" ++ filename:basename(C#comp.infile),
SLine = C#comp.startline - 10,
Ws1 = lists:flatmap(fun({{_F,_L},Eds}) ->
- format_message(File, SLine, Eds);
+ format_message(File, SLine, Eds);
({_F,Eds}) ->
- format_message(File, SLine, Eds)
+ format_message(File, SLine, Eds)
end,
Ws0),
Ws = ordsets:from_list(Ws1),
lists:foreach(fun({_,Str}) -> io:put_chars(Str) end, Ws).
format_message(F, SLine, [{Line0,Mod,E}|Es]) ->
Line = Line0 + SLine,
- M = {{F,Line},io_lib:format("~s:~w: Warning: ~s\n", [F,Line,Mod:format_error(E)])},
+ M = {{F,Line},io_lib:format("~s:~w: Warning: ~s\n",
+ [F,Line,Mod:format_error(E)])},
[M|format_message(F, SLine, Es)];
format_message(F, SLine, [{Mod,E}|Es]) ->
M = {none,io_lib:format("~s: Warning: ~s\n", [F,Mod:format_error(E)])},
Oops, something went wrong. Retry.

0 comments on commit 6e96a14

Please sign in to comment.