lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu,  4 Nov 2021 14:20:32 +0800
From:   davidcomponentone@...il.com
To:     jic23@...nel.org
Cc:     davidcomponentone@...il.com, lars@...afoo.de,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Yang Guang <yang.guang5@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: [PATCH] tools: iio: use swap() to make code cleaner

From: Yang Guang <yang.guang5@....com.cn>

Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.

Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Yang Guang <yang.guang5@....com.cn>
---
 tools/iio/iio_utils.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index aadee6d34c74..7a56c41fbded 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -290,15 +290,12 @@ int iioutils_get_param_float(float *output, const char *param_name,
 
 void bsort_channel_array_by_index(struct iio_channel_info *ci_array, int cnt)
 {
-	struct iio_channel_info temp;
 	int x, y;
 
 	for (x = 0; x < cnt; x++)
 		for (y = 0; y < (cnt - 1); y++)
 			if (ci_array[y].index > ci_array[y + 1].index) {
-				temp = ci_array[y + 1];
-				ci_array[y + 1] = ci_array[y];
-				ci_array[y] = temp;
+				swap(ci_array[y + 1], ci_array[y]);
 			}
 }
 
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ