[libvirt] [PATCH v1 08/31] virpci: Introduce virPCIDeviceAddressCopy
Peter Krempa
pkrempa at redhat.com
Tue Jul 16 12:17:45 UTC 2019
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 at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190716/4663fe4e/attachment-0001.sig>
More information about the libvir-list
mailing list