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: Li Zetao <lizetao1@huawei.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
2015716adb
commit
ede0b1d30b
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user