aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-02-05 16:17:55 +0100
committerLoïc Hoguin <[email protected]>2014-02-05 16:17:55 +0100
commit5d292f2cd55223ff3bbea7c221f22bc9eb24a0ae (patch)
tree0c5611946865b2f4471939f5823cbeb3059bb66d /src
parent521d7ed582d9b948031896c597170ef101d9f8b0 (diff)
downloadcowlib-5d292f2cd55223ff3bbea7c221f22bc9eb24a0ae.tar.gz
cowlib-5d292f2cd55223ff3bbea7c221f22bc9eb24a0ae.tar.bz2
cowlib-5d292f2cd55223ff3bbea7c221f22bc9eb24a0ae.zip
Use the inline macro for cow_http:parse_fullhost
Tidying the code a little.
Diffstat (limited to 'src')
-rw-r--r--src/cow_http.erl30
1 files changed, 3 insertions, 27 deletions
diff --git a/src/cow_http.erl b/src/cow_http.erl
index 5e8fa22..c85a221 100644
--- a/src/cow_http.erl
+++ b/src/cow_http.erl
@@ -18,6 +18,8 @@
-export([parse_fullpath/1]).
-export([parse_version/1]).
+-include("cow_inline.hrl").
+
%% @doc Extract host and port from a binary.
%%
%% Because the hostname is case insensitive it is converted
@@ -37,33 +39,7 @@ parse_fullhost(<< $], Rest/bits >>, true, Acc) ->
parse_fullhost(Rest, false, << Acc/binary, $] >>);
parse_fullhost(<< C, Rest/bits >>, E, Acc) ->
case C of
- $A -> parse_fullhost(Rest, E, << Acc/binary, $a >>);
- $B -> parse_fullhost(Rest, E, << Acc/binary, $b >>);
- $C -> parse_fullhost(Rest, E, << Acc/binary, $c >>);
- $D -> parse_fullhost(Rest, E, << Acc/binary, $d >>);
- $E -> parse_fullhost(Rest, E, << Acc/binary, $e >>);
- $F -> parse_fullhost(Rest, E, << Acc/binary, $f >>);
- $G -> parse_fullhost(Rest, E, << Acc/binary, $g >>);
- $H -> parse_fullhost(Rest, E, << Acc/binary, $h >>);
- $I -> parse_fullhost(Rest, E, << Acc/binary, $i >>);
- $J -> parse_fullhost(Rest, E, << Acc/binary, $j >>);
- $K -> parse_fullhost(Rest, E, << Acc/binary, $k >>);
- $L -> parse_fullhost(Rest, E, << Acc/binary, $l >>);
- $M -> parse_fullhost(Rest, E, << Acc/binary, $m >>);
- $N -> parse_fullhost(Rest, E, << Acc/binary, $n >>);
- $O -> parse_fullhost(Rest, E, << Acc/binary, $o >>);
- $P -> parse_fullhost(Rest, E, << Acc/binary, $p >>);
- $Q -> parse_fullhost(Rest, E, << Acc/binary, $q >>);
- $R -> parse_fullhost(Rest, E, << Acc/binary, $r >>);
- $S -> parse_fullhost(Rest, E, << Acc/binary, $s >>);
- $T -> parse_fullhost(Rest, E, << Acc/binary, $t >>);
- $U -> parse_fullhost(Rest, E, << Acc/binary, $u >>);
- $V -> parse_fullhost(Rest, E, << Acc/binary, $v >>);
- $W -> parse_fullhost(Rest, E, << Acc/binary, $w >>);
- $X -> parse_fullhost(Rest, E, << Acc/binary, $x >>);
- $Y -> parse_fullhost(Rest, E, << Acc/binary, $y >>);
- $Z -> parse_fullhost(Rest, E, << Acc/binary, $z >>);
- _ -> parse_fullhost(Rest, E, << Acc/binary, C >>)
+ ?INLINE_LOWERCASE(parse_fullhost, Rest, E, Acc)
end.
-ifdef(TEST).