From: Ian Campbell Subject: Re: [PATCH V5 24/32] libxl: copy function for builtin types Date: Tue, 20 May 2014 14:39:49 +0100 Message-ID: <1400593189.6946.56.camel@kazak.uk.xensource.com> References: <1400018054-26038-1-git-send-email-wei.liu2@citrix.com> <1400018054-26038-25-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1400018054-26038-25-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, 2014-05-13 at 22:54 +0100, Wei Liu wrote: > These functions will be used in later patch to deep-copy a structure. > > Functions introduced: > * libxl_string_list_copy > * libxl_key_value_list_copy > * libxl_hwcap_copy > * libxl_mac_copy > * libxl_cpuid_policy_list_copy > * libxl_string_copy > * libxl_bitmap_copy_alloc > > Signed-off-by: Wei Liu Acked-by: Ian Campbell > +void libxl_hwcap_copy(libxl_ctx *ctx,libxl_hwcap *dst, libxl_hwcap *src) > +{ > + int i; > + > + for (i = 0; i < 8; i++) > + (*dst)[i] = (*src)[i]; > +} > + > +void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src) > +{ > + int i; > + > + for (i = 0; i < 6; i++) > + (*dst)[i] = (*src)[i]; These two might be candidates for using memcpy. > diff --git a/tools/libxl/libxl_uuid.h b/tools/libxl/libxl_uuid.h > index 37c4d5f..041b927 100644 > --- a/tools/libxl/libxl_uuid.h > +++ b/tools/libxl/libxl_uuid.h > @@ -61,7 +61,6 @@ void libxl_uuid_copy(libxl_ctx *ctx, libxl_uuid *dst, const libxl_uuid *src); > #if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x040500 > void libxl_uuid_copy(dst, src) libxl_uuid_copy(NULL, dst, src) > #endif > - Stray change. > void libxl_uuid_clear(libxl_uuid *uuid); > int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2); > uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid);