[PATCH i-g-t 31/33] Run igt_swap.cocci
Lyude
lyude at redhat.com
Mon Jun 10 15:03:19 UTC 2019
From: Lyude Paul <lyude at redhat.com>
And replace a bunch of open-coded usages of igt_swap().
Signed-off-by: Lyude Paul <lyude at redhat.com>
---
lib/igt_aux.c | 6 ++----
tests/i915/gem_ctx_create.c | 6 ++----
tests/i915/gem_exec_big.c | 5 +----
tests/i915/gem_exec_gttfill.c | 5 +----
4 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 2648d0e4..716e8888 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -578,12 +578,10 @@ bool igt_aub_dump_enabled(void)
*/
void igt_exchange_int(void *array, unsigned i, unsigned j)
{
- int *int_arr, tmp;
+ int *int_arr;
int_arr = array;
- tmp = int_arr[i];
- int_arr[i] = int_arr[j];
- int_arr[j] = tmp;
+ igt_swap(int_arr[i], int_arr[j]);
}
/**
diff --git a/tests/i915/gem_ctx_create.c b/tests/i915/gem_ctx_create.c
index 1e2c40c4..244ae313 100644
--- a/tests/i915/gem_ctx_create.c
+++ b/tests/i915/gem_ctx_create.c
@@ -208,11 +208,9 @@ static void active(int fd, unsigned engine, int timeout, int ncpus)
static void xchg_u32(void *array, unsigned i, unsigned j)
{
- uint32_t *a = array, tmp;
+ uint32_t *a = array;
- tmp = a[i];
- a[i] = a[j];
- a[j] = tmp;
+ igt_swap(a[i], a[j]);
}
static unsigned __context_size(int fd)
diff --git a/tests/i915/gem_exec_big.c b/tests/i915/gem_exec_big.c
index 9da90ead..2e0a6316 100644
--- a/tests/i915/gem_exec_big.c
+++ b/tests/i915/gem_exec_big.c
@@ -118,11 +118,8 @@ static void xchg_reloc(void *array, unsigned i, unsigned j)
struct drm_i915_gem_relocation_entry *reloc = array;
struct drm_i915_gem_relocation_entry *a = &reloc[i];
struct drm_i915_gem_relocation_entry *b = &reloc[j];
- struct drm_i915_gem_relocation_entry tmp;
- tmp = *a;
- *a = *b;
- *b = tmp;
+ igt_swap(*a, *b);
}
static void execN(int fd, uint32_t handle, uint64_t batch_size, unsigned flags, char *ptr)
diff --git a/tests/i915/gem_exec_gttfill.c b/tests/i915/gem_exec_gttfill.c
index efd612bb..0cab6013 100644
--- a/tests/i915/gem_exec_gttfill.c
+++ b/tests/i915/gem_exec_gttfill.c
@@ -36,11 +36,8 @@ struct batch {
static void xchg_batch(void *array, unsigned int i, unsigned int j)
{
struct batch *batches = array;
- struct batch tmp;
- tmp = batches[i];
- batches[i] = batches[j];
- batches[j] = tmp;
+ igt_swap(batches[i], batches[j]);
}
static void submit(int fd, int gen,
--
2.21.0
More information about the Intel-gfx-trybot
mailing list