From: Ian Jackson Subject: Re: [PATCH 23 of 32 RFC] libxl: use libxl_*_init internally too Date: Mon, 16 Jan 2012 16:16:37 +0000 Message-ID: <20244.19813.629009.581935@mariner.uk.xensource.com> References: <0d3abdb6c01894e4e074.1326716121@cosworth.uk.xensource.com> <20244.19379.430191.296744@mariner.uk.xensource.com> <1326730504.14689.17.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: <1326730504.14689.17.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [Xen-devel] [PATCH 23 of 32 RFC] libxl: use libxl_*_init internally too"): > I think the reason is that sometimes they might allocate memory. Many of > them don't (I don't know about vfb in particular) and I don't know > whether we prefer consistency in similar functions or avoiding pointless > return values (I prefer the former so as to avoid needing to change the > public API in the future when we find that we have introduced a way for > a function to fail). Why might they need to allocate memory ? > Possibly in the new world order (where init ~= memset and setdefaults > does thework) this will no longer be the case, but then the same will > become true of the setdefaults function. Yes. I think it's OK for setdefaults to be able to fail. Having infallible init functions is a real boon because it makes the caller's memory management much easier, because they can always safely dispose. Ian.