Permalink
Browse files

Cosmetic: List comprehension instead of recursion

  • Loading branch information...
1 parent 97352b5 commit a4cdaf8dfad00e0215843d16ff870f92b3030ac4 @majek majek committed Oct 18, 2011
Showing with 5 additions and 7 deletions.
  1. +5 −7 src/sockjs_filters.erl
View
@@ -347,13 +347,11 @@ fmt_htmlfile(Body) ->
fmt(Fmt, Args) -> iolist_to_binary(io_lib:format(Fmt, Args)).
-url_escape("", _Chars) ->
- "";
-url_escape([Char | Rest], Chars) ->
- case lists:member(Char, Chars) of
- true -> [hex(Char) | url_escape(Rest, Chars)];
- false -> [Char | url_escape(Rest, Chars)]
- end.
+url_escape(Str, Chars) ->
+ [case lists:member(Char, Chars) of
+ true -> hex(Char);
+ false -> Char
+ end || Char <- Str].
hex(C) ->
<<High0:4, Low0:4>> = <<C>>,

0 comments on commit a4cdaf8

Please sign in to comment.