From: Wei Liu <wei.liu2@citrix.com>
To: Olaf Hering <olaf@aepfle.de>
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
xen-devel@lists.xen.org
Subject: Re: new idl helper, append to Array
Date: Thu, 4 Feb 2016 10:48:35 +0000 [thread overview]
Message-ID: <20160204104835.GM23178@citrix.com> (raw)
In-Reply-To: <20160204100758.GA3492@aepfle.de>
On Thu, Feb 04, 2016 at 11:07:58AM +0100, Olaf Hering wrote:
> 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.
>
There is that. Yes, _init memset the whole structure to zeros.
Wei.
> Olaf
next prev parent reply other threads:[~2016-02-04 10:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-04 9:23 new idl helper, append to Array Olaf Hering
2016-02-04 9:58 ` Ian Campbell
2016-02-04 10:07 ` Olaf Hering
2016-02-04 10:48 ` Wei Liu [this message]
2016-02-05 9:55 ` Olaf Hering
2016-02-05 10:06 ` Ian Campbell
2016-02-04 10:45 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160204104835.GM23178@citrix.com \
--to=wei.liu2@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=olaf@aepfle.de \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).