[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 23 of 32 RFC] libxl: use libxl_*_init internally too
On Mon, 2012-01-16 at 16:16 +0000, Ian Jackson wrote: > 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 ? e.g. vif->model = strdup("rtl8139"). > > 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. I think my series has made more *_init functions have no possibility of failure but I don't think it is all of them. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |