Commit d9d58f04 authored by Guo Zhengkui's avatar Guo Zhengkui Committed by Ilya Dryomov

libceph: use swap() macro instead of taking tmp variable

Fix the following coccicheck warning:
net/ceph/crush/mapper.c:1077:8-9: WARNING opportunity for swap()

by using swap() for the swapping of variable values and drop
the tmp variable that is not needed any more.
Signed-off-by: default avatarGuo Zhengkui <guozhengkui@vivo.com>
Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 261998c3
...@@ -906,7 +906,6 @@ int crush_do_rule(const struct crush_map *map, ...@@ -906,7 +906,6 @@ int crush_do_rule(const struct crush_map *map,
int recurse_to_leaf; int recurse_to_leaf;
int wsize = 0; int wsize = 0;
int osize; int osize;
int *tmp;
const struct crush_rule *rule; const struct crush_rule *rule;
__u32 step; __u32 step;
int i, j; int i, j;
...@@ -1073,9 +1072,7 @@ int crush_do_rule(const struct crush_map *map, ...@@ -1073,9 +1072,7 @@ int crush_do_rule(const struct crush_map *map,
memcpy(o, c, osize*sizeof(*o)); memcpy(o, c, osize*sizeof(*o));
/* swap o and w arrays */ /* swap o and w arrays */
tmp = o; swap(o, w);
o = w;
w = tmp;
wsize = osize; wsize = osize;
break; break;
......
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