[pulseaudio-discuss] Allowing anonymous structs and unions
Ahmed S. Darwish
darwish.07 at gmail.com
Wed Sep 23 02:01:59 PDT 2015
On Wed, Sep 23, 2015 at 10:34:06AM +0200, Ahmed S. Darwish wrote:
>
> So to summarize, such annotation explicitly shows the inheritance
> relationship, minimize code repeition in the struct defintions, and
> also saves us an extra compile-time dereference in shm.c, memfd.c,
> and privatemem.c code. It also really works in tandem with the
> earlier polymorphic union:
>
> union {
> pa_mem mem;
> union {
> pa_shm shm;
> pa_memfd memfd;
> pa_privatemem privatemem;
> } per_type;
> };
>
For extra-context if anyone did not yet check the memfd patches
in detail, the above union is used in two places:
- In mempools, according to their memory type
- In memimport segments. That is, in the case where we import
a memblock from another PA endpoint. In this case, the
imported memblock memory type (posix SHM or memfds) can be
quite different from the mempool it's locally attached to
(as is the usual case with PA_MEMBLOCK_IMPORTED blocks).
Thanks!
--
Darwish
http://darwish.chasingpointers.com
More information about the pulseaudio-discuss
mailing list