diff options
| author | Tim Watson <tim@rabbitmq.com> | 2012-11-05 11:03:01 +0000 |
|---|---|---|
| committer | Tim Watson <tim@rabbitmq.com> | 2012-11-05 11:03:01 +0000 |
| commit | cf41870967cd5e058cab1a439b82256d02374c2d (patch) | |
| tree | 75ce02cf9a5e871647b665f4deec9e5e13be2ffb /src | |
| parent | 7ab7f6fdd600db691c15b40787f93a1e7cb973e7 (diff) | |
| download | rabbitmq-server-git-cf41870967cd5e058cab1a439b82256d02374c2d.tar.gz | |
refactor parse_expiration
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_basic.erl | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl index 6e5c503b62..ca18087df4 100644 --- a/src/rabbit_basic.erl +++ b/src/rabbit_basic.erl @@ -259,19 +259,18 @@ header_routes(HeadersTable) -> binary_to_list(HeaderKey), Type}}) end || HeaderKey <- ?ROUTING_HEADERS]). +parse_expiration(#'P_basic'{expiration = undefined}) -> + {ok, undefined}; parse_expiration(#'P_basic'{expiration = Expiration}) -> - case Expiration of - undefined -> {ok, undefined}; - B -> case string:to_integer(binary_to_list(B)) of - {error, no_integer} = E -> - E; - {N, ""} -> - case rabbit_misc:check_expiry_size(N) of - ok -> {ok, N}; - E = {error, _} -> E - end; - {_, S} -> - {error, {leftover_string, S}} - end + case string:to_integer(binary_to_list(Expiration)) of + {error, no_integer} = E -> + E; + {N, ""} -> + case rabbit_misc:check_expiry_size(N) of + ok -> {ok, N}; + E = {error, _} -> E + end; + {_, S} -> + {error, {leftover_string, S}} end. |
