From: Ian Jackson Subject: Re: [PATCH 10/20] libxl: Make libxl__zalloc et al tolerate a NULL gc Date: Tue, 20 Mar 2012 16:26:56 +0000 Message-ID: <20328.45008.897291.861035@mariner.uk.xensource.com> References: <1331915215-10477-1-git-send-email-ian.jackson@eu.citrix.com> <1331915215-10477-11-git-send-email-ian.jackson@eu.citrix.com> <1332238900.9223.169.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1332238900.9223.169.camel@zakaz.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: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [Xen-devel] [PATCH 10/20] libxl: Make libxl__zalloc et al tolerate a NULL gc"): > On Fri, 2012-03-16 at 16:26 +0000, Ian Jackson wrote: > > Arrange that if we pass NULL as a gc, we simply don't register the > > pointer. This instantly gives us non-gc'ing but error-checking > > versions of malloc, realloc, vasprintf, etc. ... > Acked-by: Ian Campbell Thanks. > We could consider __attribute__((nonnull)) for the other helper > functions in that section of libxl_internal.h. The only function in that section which isn't declared as taking gc_opt (ie which can't be passed NULL) is libxl__free_all, and it seems unlikely anyone would mistakenly pass 0 to it (esp. since it has few callers). Ian.