From 60fcdde6cf8bbb015e4801f5e13218a3c9bc07c6 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Wed, 21 Oct 2020 17:05:01 -0700 Subject: [PATCH] rephrase some swapping code C allows you to assign structs in this way, so there's no need to use a more confusing memcpy sequence. --- lib/sfio/sfswap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sfio/sfswap.c b/lib/sfio/sfswap.c index a607a5f04..0ed17c3af 100644 --- a/lib/sfio/sfswap.c +++ b/lib/sfio/sfswap.c @@ -77,9 +77,9 @@ Sfio_t *sfswap(Sfio_t * f1, Sfio_t * f2) f2flags = f2->flags; /* swap image and pool entries */ - memcpy((void *) (&tmp), (void *) f1, sizeof(Sfio_t)); - memcpy((void *) f1, (void *) f2, sizeof(Sfio_t)); - memcpy((void *) f2, (void *) (&tmp), sizeof(Sfio_t)); + tmp = *f1; + *f1 = *f2; + *f2 = tmp; if (f2pool >= 0) f1->pool->sf[f2pool] = f1; if (f1pool >= 0) -- 2.40.0