On Fri, Mar 15, 2019 at 12:02:31AM -0500, Eric Blake wrote:
Upcoming patches want to add virDomainCheckpoint that behaves very
similarly to virDomainCheckpoint; the easiest way to share common code
is to give both classes a common base class. If this were C++, we'd
just use public member inheritance; but since it is C, we instead have
to touch EVERY use of member fields that will be relocated. To avoid
having to make future edits, wrap the majority of accesses behind
static inline functions, so that we only have to touch one place when
changing class inheritance; and temporarily rename the members to let
the compiler ensure we caught all uses.
While it helps review, I'd rather not include the rename in the git
history. Thankfully the next patch renames them to something else, not
back to the same name.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/datatypes.h | 22 +++++++---
src/datatypes.c | 10 ++---
src/esx/esx_driver.c | 66 ++++++++++++++---------------
src/libvirt-domain-snapshot.c | 24 +++++------
src/qemu/qemu_driver.c | 40 ++++++++---------
src/remote/remote_daemon_dispatch.c | 4 +-
src/remote/remote_driver.c | 4 +-
src/rpc/gendispatch.pl | 2 +-
src/test/test_driver.c | 20 ++++-----
src/vbox/vbox_common.c | 56 ++++++++++++------------
src/vz/vz_driver.c | 52 +++++++++++------------
11 files changed, 156 insertions(+), 144 deletions(-)
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano