RFC: do we want/need the "Ptr" typedefs for internal code ?

Peter Krempa pkrempa at redhat.com
Wed Mar 10 07:50:07 UTC 2021


On Tue, Mar 09, 2021 at 17:44:16 +0000, Daniel Berrange wrote:
> One of the conventions we have had since the early days of libvirt is
> that every struct typedef, has a corresponding "Ptr" typedef too.
> 
> For example
> 
>     typedef struct _virDomainDef virDomainDef;
>     typedef virDomainDef *virDomainDefPtr;

[...]

> We can't do anything about the use "Ptr" in the include/ files because
> that is public ABI. We can potentially eliminate "Ptr" types everywhere
> else in the codebase, even the src/libvirt*.c files corresponding to
> the public includes.
> 
> Does anyone have suggestions for how these "Ptr" typedefs are
> benefiting libvirt ? Would anyone miss them ?

I don't usually declare them for internal types any more. I will not
mourn if we discourage them from now on.

I'd just prefer if we either big-bang rewrite all of it or just
discourage it's use in new code and let it gradually die, but not
encourage any semi-concetrated effort to remove the use of them, since
that creates a stream of steady and long enduring churn.

Basically don't make a GSoC project or file an public 'bite-sized'
task for it.




More information about the libvir-list mailing list