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--; }
linux-kselftest-mirror@lists.linaro.org