Commit ede0b1d3 authored by Li Zetao's avatar Li Zetao Committed by Ilya Dryomov

libceph: use min() to simplify code in ceph_dns_resolve_name()

When resolving name in ceph_dns_resolve_name(), the end address of name
is determined by the minimum value of delim_p and colon_p. So using min()
here is more in line with the context.
Signed-off-by: default avatarLi Zetao <lizetao1@huawei.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 2015716a
......@@ -1254,7 +1254,7 @@ static int ceph_dns_resolve_name(const char *name, size_t namelen,
colon_p = memchr(name, ':', namelen);
if (delim_p && colon_p)
end = delim_p < colon_p ? delim_p : colon_p;
end = min(delim_p, colon_p);
else if (!delim_p && colon_p)
end = colon_p;
else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment