From: Matthew Fernandez Date: Thu, 22 Oct 2020 00:05:01 +0000 (-0700) Subject: rephrase some swapping code X-Git-Tag: 2.46.0~20^2^2~9^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60fcdde6cf8bbb015e4801f5e13218a3c9bc07c6;p=graphviz 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. --- 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)