server: Remove tricksy initialization of struct b_conn_handle.
commit5cdf4d6c89bdb802be234f2fccc8157b7228b546
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 19 Sep 2019 12:36:38 +0000 (19 13:36 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 19 Sep 2019 13:33:59 +0000 (19 14:33 +0100)
treea5dc9f9758802e57ca2bd153554bf8a0e001b4c4
parent7ed83d1436501e931246c580c4db106f372c2b42
server: Remove tricksy initialization of struct b_conn_handle.

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.
server/connections.c
server/internal.h