From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [RFC 19/19] xl: Add new option dtdev Date: Wed, 18 Jun 2014 14:40:37 +0100 Message-ID: <53A196D5.6040304@linaro.org> References: <1402935486-29136-1-git-send-email-julien.grall@linaro.org> <1402935486-29136-20-git-send-email-julien.grall@linaro.org> <20140616171953.GC1773@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WxG6T-0002Jk-57 for xen-devel@lists.xenproject.org; Wed, 18 Jun 2014 13:40:41 +0000 Received: by mail-wi0-f170.google.com with SMTP id cc10so8546818wib.3 for ; Wed, 18 Jun 2014 06:40:39 -0700 (PDT) In-Reply-To: <20140616171953.GC1773@zion.uk.xensource.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.campbell@citrix.com, Stefano Stabellini , tim@xen.org, Ian Jackson , stefano.stabellini@citrix.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org Hi Wei, On 06/16/2014 06:19 PM, Wei Liu wrote: > On Mon, Jun 16, 2014 at 05:18:06PM +0100, Julien Grall wrote: > [...] >> + if (!xlu_cfg_get_list (config, "dtdev", &dtdevs, 0, 0)) { >> + d_config->num_dtdevs = 0; >> + d_config->dtdevs = NULL; >> + for (i = 0; (buf = xlu_cfg_get_listitem(dtdevs, i)) != NULL; i++) { >> + libxl_device_dt *dtdev; >> + >> + d_config->dtdevs = (libxl_device_dt *) realloc(d_config->dtdevs, sizeof (libxl_device_dt) * (d_config->num_dtdevs + 1)); >> + dtdev = d_config->dtdevs + d_config->num_dtdevs; >> + libxl_device_dt_init(dtdev); >> + > > There's a macro called ARRAY_EXTEND_INIT, you can probably use that. I can't use this macro because it requires to have a field devid in the structure. I don't think it worth to add this field just for code conciseness. Though I can add rename this macro into ARRAY_EXTEND_INIT_DEVID and introduce an ARRAY_EXTEND_INIT that could be use in more general case. Regards, -- Julien Grall