staging: lustre: libcfs: Use swap() in cfs_hash_bd_order()

Use swap() function instead of using a temporary variable for swapping
two variables.

The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
type T;
T a,b,c;
@@
- a = b;
- b = c;
- c = a;
+ swap(b, c);
//<smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Amitoj Kaur Chawla 2016-02-24 03:12:47 +05:30 коммит произвёл Greg Kroah-Hartman
Родитель cb77659272
Коммит 4d2a71d02b
1 изменённых файлов: 2 добавлений и 6 удалений

Просмотреть файл

@ -803,12 +803,8 @@ cfs_hash_bd_order(struct cfs_hash_bd *bd1, struct cfs_hash_bd *bd2)
if (rc == 0) {
bd2->bd_bucket = NULL;
} else if (rc > 0) { /* swab bd1 and bd2 */
struct cfs_hash_bd tmp;
tmp = *bd2;
*bd2 = *bd1;
*bd1 = tmp;
} else if (rc > 0) {
swap(*bd1, *bd2); /* swap bd1 and bd2 */
}
}