diff options
author | Loïc Hoguin <[email protected]> | 2011-10-26 20:13:36 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2011-10-26 20:13:36 +0200 |
commit | 819eb219e7d61b7df5692ce55ec33090b163fb5e (patch) | |
tree | 1e0950b11dd73b94a3dbcbf396fe65a79ff5941d /src/cowboy_http.erl | |
parent | 725e2729966aff18da1a84ae9a1fbd2506afc03f (diff) | |
download | cowboy-819eb219e7d61b7df5692ce55ec33090b163fb5e.tar.gz cowboy-819eb219e7d61b7df5692ce55ec33090b163fb5e.tar.bz2 cowboy-819eb219e7d61b7df5692ce55ec33090b163fb5e.zip |
Rename private function quality/2 into qvalue/2
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r-- | src/cowboy_http.erl | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index ee8902a..28346f1 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -119,7 +119,7 @@ media_range_param_attr(Data, Fun, Type, SubType, Acc) -> -spec media_range_param_value(binary(), fun(), binary(), binary(), [{binary(), binary()}], binary()) -> any(). media_range_param_value(Data, Fun, Type, SubType, Acc, <<"q">>) -> - quality(Data, + qvalue(Data, fun (Rest, Quality) -> accept_ext(Rest, Fun, Type, SubType, Acc, Quality, []) end); @@ -247,30 +247,30 @@ quoted_string(<< C, Rest/bits >>, Fun, Acc) -> quoted_string(Rest, Fun, << Acc/binary, C >>). %% @doc Parse a quality value. --spec quality(binary(), fun()) -> any(). -quality(<< $0, $., Rest/bits >>, Fun) -> - quality(Rest, Fun, 0, 100); -quality(<< $0, Rest/bits >>, Fun) -> +-spec qvalue(binary(), fun()) -> any(). +qvalue(<< $0, $., Rest/bits >>, Fun) -> + qvalue(Rest, Fun, 0, 100); +qvalue(<< $0, Rest/bits >>, Fun) -> Fun(Rest, 0); -quality(<< $1, $., $0, $0, $0, Rest/bits >>, Fun) -> +qvalue(<< $1, $., $0, $0, $0, Rest/bits >>, Fun) -> Fun(Rest, 1000); -quality(<< $1, $., $0, $0, Rest/bits >>, Fun) -> +qvalue(<< $1, $., $0, $0, Rest/bits >>, Fun) -> Fun(Rest, 1000); -quality(<< $1, $., $0, Rest/bits >>, Fun) -> +qvalue(<< $1, $., $0, Rest/bits >>, Fun) -> Fun(Rest, 1000); -quality(<< $1, Rest/bits >>, Fun) -> +qvalue(<< $1, Rest/bits >>, Fun) -> Fun(Rest, 1000); -quality(_Data, _Fun) -> +qvalue(_Data, _Fun) -> {error, badarg}. --spec quality(binary(), fun(), integer(), 1 | 10 | 100) -> any(). -quality(Data, Fun, Q, 0) -> +-spec qvalue(binary(), fun(), integer(), 1 | 10 | 100) -> any(). +qvalue(Data, Fun, Q, 0) -> Fun(Data, Q); -quality(<< C, Rest/bits >>, Fun, Q, M) +qvalue(<< C, Rest/bits >>, Fun, Q, M) when C =:= $0; C =:= $1; C =:= $2; C =:= $3; C =:= $4; C =:= $5; C =:= $6; C =:= $7; C =:= $8; C =:= $9 -> - quality(Rest, Fun, Q + (C - $0) * M, M div 10); -quality(Data, Fun, Q, _M) -> + qvalue(Rest, Fun, Q + (C - $0) * M, M div 10); +qvalue(Data, Fun, Q, _M) -> Fun(Data, Q). %% Interpretation. |