diff mbox series

selftest/sgx: use swap() to make code cleaner

Message ID 20211028003444.7046-1-yang.guang5@zte.com.cn (mailing list archive)
State New
Headers show
Series selftest/sgx: use swap() to make code cleaner | expand

Commit Message

CGEL Oct. 28, 2021, 12:34 a.m. UTC
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 mbox series

Patch

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--;
 	}