On 9/19/19 7:56 AM, Richard W.M. Jones wrote:
b_conn_handle fields exportsize and can_* have a special meaning
when
they are -1. It means that the value of the field has not been
computed and cached yet.
The struct was being initialized using memset (_, -1, _) which does
indeed have the effect of setting all the fields to -1, although it's
somewhat non-obvious to say the least.
This commit replaces it with ordinary field initialization, also
setting h->handle to NULL. By keeping the initialization function
next to the struct definition, hopefully they will be updated in
tandem in future.
GCC 9.2.1 actually optimizes this back into the memset equivalent
using inline AVX instructions, so good job there!
Simple refactoring, should have no effect on how the code works.
See commit d60d0f4248610fc1d116dc9f249526d20913c9a3.
ACK. And affects 3 and 4 of my pending spec cleanup patches, but yours
should go in first (I'll rebase mine, because I'm working on refactoring
those for less code duplication anyway).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org