From 3e812cbcf08868c7eefbf584d0e1f2e6c0b5f1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 22 Oct 2013 14:16:45 +0200 Subject: Simplify parse_fullpath code --- src/cow_http.erl | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/cow_http.erl b/src/cow_http.erl index 704933b..5e8fa22 100644 --- a/src/cow_http.erl +++ b/src/cow_http.erl @@ -89,16 +89,11 @@ parse_fullpath(Fullpath) -> parse_fullpath(<<>>, Path) -> {Path, <<>>}; -parse_fullpath(<< $?, Rest/binary >>, Path) -> - parse_fullpath_qs(Rest, Path, <<>>); +parse_fullpath(<< $?, Qs/binary >>, Path) -> + {Path, Qs}; parse_fullpath(<< C, Rest/binary >>, SoFar) -> parse_fullpath(Rest, << SoFar/binary, C >>). -parse_fullpath_qs(<<>>, Path, Qs) -> - {Path, Qs}; -parse_fullpath_qs(<< C, Rest/binary >>, Path, SoFar) -> - parse_fullpath_qs(Rest, Path, << SoFar/binary, C >>). - -ifdef(TEST). parse_fullpath_test() -> {<<"*">>, <<>>} = parse_fullpath(<<"*">>), -- cgit v1.2.3