linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftest/sgx: use swap() to make code cleaner
@ 2021-10-28  0:34 Yang Guang
  0 siblings, 0 replies; only message in thread
From: Yang Guang @ 2021-10-28  0:34 UTC (permalink / raw)
  To: Jarkko Sakkinen, Dave Hansen, Shuah Khan
  Cc: Yang Guang, Zeal Robot, linux-sgx, linux-kselftest, linux-kernel

Using swap() make it more readable.

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

diff --git a/tools/testing/selftests/sgx/sigstruct.c b/tools/testing/selftests/sgx/sigstruct.c
index 92bbc5a15c39..47eb0749dba4 100644
--- a/tools/testing/selftests/sgx/sigstruct.c
+++ b/tools/testing/selftests/sgx/sigstruct.c
@@ -59,13 +59,10 @@ static void reverse_bytes(void *data, int length)
 {
 	int i = 0;
 	int j = length - 1;
-	uint8_t temp;
 	uint8_t *ptr = data;
 
 	while (i < j) {
-		temp = ptr[i];
-		ptr[i] = ptr[j];
-		ptr[j] = temp;
+		swap(ptr[i], ptr[j]);
 		i++;
 		j--;
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-28  0:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28  0:34 [PATCH] selftest/sgx: use swap() to make code cleaner Yang Guang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).