On Fri, Mar 29, 2019 at 07:12:00AM -0500, Eric Blake wrote:
On 3/29/19 3:40 AM, Richard W.M. Jones wrote:
>>> + nbdkit_extents_free (extents2);
>>> +
>>
>> Should we be using the CLEANUP_EXTENTS_FREE macro here and in other filters?
>
> At the moment the CLEANUP_* macros are only available to server code,
> not to plugins or filters. They would certainly make plugins and
> filters easier to write. I would really like attribute((cleanup)) to
> turn up in ISO C one day :-)
Justifying it in plugins may or may not be doable (we'd have to have
proper inclusion guards so that the cleanup functions are only declared
for capable compilers.
Would it soud too bad to provide the macros to plugins and say that for
out-of-tree plugins you need to make sure that attribute cleanup is supported by
your compiler if you are using said macros?
For filters it may be easier: we already document
that all filters might as well live in-tree because we don't guarantee a
stable API (case in point - we broke API between 1.11.9 and 1.11.10, and
didn't think twice about it). So we know our filters are being compiled
with a capable compiler. I don't know if we are installing
nbdkit-filters.h in a public location, but it really isn't all that
useful outside of nbdkit sources.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org