[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] new idl helper, append to Array



On Thu, Feb 04, Ian Campbell wrote:

> I think the append_to variant is probably least gross.

libxl_device_vscsidev_append_to_vscsictrl() would work too.

This is what I will use for the time being (modulo introduced runtime bugs):

void libxl_device_vscsictrl_append_vscsidev(libxl_ctx *ctx,
                                            libxl_device_vscsictrl *ctrl,
                                            libxl_device_vscsidev *dev)
{
    GC_INIT(ctx);
    ctrl->vscsidevs = libxl__realloc(NOGC, ctrl->vscsidevs, sizeof(*dev) * 
(ctrl->num_vscsidevs + 1));
    libxl_device_vscsidev_init(ctrl->vscsidevs + ctrl->num_vscsidevs);
    libxl_device_vscsidev_copy(CTX, ctrl->vscsidevs + ctrl->num_vscsidevs, dev);
    ctrl->num_vscsidevs++;
    GC_FREE;
}


> Wei, is it necessary to init the dst before copy into it?

It would clear the padding between members, a plain copy will leave them
uninitialized.

Olaf

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.