From: Ian Jackson Subject: Re: [PATCH 05/23] libxl: init: Provide a gc later in libxl_ctx_alloc Date: Thu, 19 Dec 2013 17:26:12 +0000 Message-ID: <21171.11316.170743.655256@mariner.uk.xensource.com> References: <1387305337-15355-1-git-send-email-ian.jackson@eu.citrix.com> <1387305337-15355-6-git-send-email-ian.jackson@eu.citrix.com> <1387457482.9925.61.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1387457482.9925.61.camel@kazak.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: Ian Campbell Cc: Shriram Rajagopalan , George Dunlap , xen-devel@lists.xensource.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [PATCH 05/23] libxl: init: Provide a gc later in libxl_ctx_alloc"): > On Tue, 2013-12-17 at 18:35 +0000, Ian Jackson wrote: > > Provide libxl__gc *gc for the second half of libxl_ctx_alloc. > > (For the first half of the function, gc is in scope but set to NULL.) > > libxl uses -Wno-declaration-after-statement so it would be valid to just > declare it at the point it becomes valid, would avoid mistakes with > people adding uses before this point. However, that would involve changing the "goto out" in the malloc failure case to something else, because "goto out" would jump past the initialisation of gc to NULL. The malloc failure case can't be handled with our usual fatal error logic because that depends on having a ctx. I guess we could have a dummy ctx but it would get fiddly. Ian.