On Thu, Jul 11, 2019 at 17:53:55 +0200, Michal Privoznik wrote:
This helper is cleaner than plain memcpy() because one doesn't
have to look into virPCIDeviceAddress struct to see if it
contains any strings / pointers.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/virpci.c | 6 ++++++
src/util/virpci.h | 2 ++
3 files changed, 9 insertions(+)
[...]
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 59f478dd41..03ce651f40 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1730,6 +1730,12 @@ virPCIDeviceAddressEqual(const virPCIDeviceAddress *addr1,
return false;
}
Please add a comment stating that this is a deep copy and also note with
the definitions of 'struct _virZPCIDeviceAddress' and
'struct _virPCIDeviceAddress' that there is a deep-copy function which
needs to be fixed when adding new members.
+void virPCIDeviceAddressCopy(virPCIDeviceAddressPtr dst,
+ const virPCIDeviceAddress *src)
+{
+ memcpy(dst, src, sizeof(*src));
+}
+
char *
virPCIDeviceAddressAsString(const virPCIDeviceAddress *addr)
{
ACK with the above addressed.