From 17af50812c47f5dec7e02e443c551b9697715729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 26 Mar 2014 19:05:59 +0100 Subject: Remove outdated comments, all edoc, plus a few minor tweaks --- src/cowboy_bstr.erl | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src/cowboy_bstr.erl') diff --git a/src/cowboy_bstr.erl b/src/cowboy_bstr.erl index 92e3f29..98d2cf7 100644 --- a/src/cowboy_bstr.erl +++ b/src/cowboy_bstr.erl @@ -12,7 +12,6 @@ %% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF %% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -%% @doc Binary string manipulation. -module(cowboy_bstr). %% Binary strings. @@ -24,11 +23,9 @@ -export([char_to_lower/1]). -export([char_to_upper/1]). -%% @doc Capitalize a token. -%% %% The first letter and all letters after a dash are capitalized. %% This is the form seen for header names in the HTTP/1.1 RFC and -%% others. Note that using this form isn't required, as header name +%% others. Note that using this form isn't required, as header names %% are case insensitive, and it is only provided for use with eventual %% badly implemented clients. -spec capitalize_token(B) -> B when B::binary(). @@ -43,19 +40,14 @@ capitalize_token(<< C, Rest/bits >>, true, Acc) -> capitalize_token(<< C, Rest/bits >>, false, Acc) -> capitalize_token(Rest, false, << Acc/binary, (char_to_lower(C)) >>). -%% @doc Convert a binary string to lowercase. -spec to_lower(B) -> B when B::binary(). to_lower(B) -> << << (char_to_lower(C)) >> || << C >> <= B >>. -%% @doc Convert a binary string to uppercase. -spec to_upper(B) -> B when B::binary(). to_upper(B) -> << << (char_to_upper(C)) >> || << C >> <= B >>. -%% @doc Convert [A-Z] characters to lowercase. -%% @end -%% We gain noticeable speed by matching each value directly. -spec char_to_lower(char()) -> char(). char_to_lower($A) -> $a; char_to_lower($B) -> $b; @@ -85,7 +77,6 @@ char_to_lower($Y) -> $y; char_to_lower($Z) -> $z; char_to_lower(Ch) -> Ch. -%% @doc Convert [a-z] characters to uppercase. -spec char_to_upper(char()) -> char(). char_to_upper($a) -> $A; char_to_upper($b) -> $B; @@ -118,9 +109,7 @@ char_to_upper(Ch) -> Ch. %% Tests. -ifdef(TEST). - capitalize_token_test_() -> - %% {Header, Result} Tests = [ {<<"heLLo-woRld">>, <<"Hello-World">>}, {<<"Sec-Websocket-Version">>, <<"Sec-Websocket-Version">>}, @@ -131,5 +120,4 @@ capitalize_token_test_() -> {<<"Sec-WebSocket---Version">>, <<"Sec-Websocket---Version">>} ], [{H, fun() -> R = capitalize_token(H) end} || {H, R} <- Tests]. - -endif. -- cgit v1.2.3