[pulseaudio-discuss] [PATCH v2 03/12] pulsecore: Transform pa_mempool_new() into a factory method

David Henningsson david.henningsson at canonical.com
Tue Feb 16 13:13:21 UTC 2016



On 2016-02-12 16:55, Ahmed S. Darwish wrote:
> On Fri, Feb 12, 2016 at 03:06:59PM +0100, David Henningsson wrote:
>> Looks good mostly, just a few nitpicks.
>>
>> On 2016-02-12 01:10, Ahmed S. Darwish wrote:
> ...
>>> +
>>> +#include <stdbool.h>
>>> +
>>> +#include <pulsecore/macro.h>
>>> +
>>> +typedef enum pa_mem_type {
>>> +    PA_MEM_TYPE_SHARED_POSIX,         /* Data is shared and created using POSIX shm_open() */
>>> +    PA_MEM_TYPE_SHARED_MEMFD,         /* Data is shared and created using Linux memfd_create() */
>>> +    PA_MEM_TYPE_PRIVATE,              /* Data is private and created using classic memory allocation (malloc, etc.) */
>>
>> Actually, it's created using either mmap, posix_memallign, or malloc.
>>
>
> will clarify.
>
>>> +} pa_mem_type_t;
>>> +
>>> +static inline bool pa_mem_type_is_shared(pa_mem_type_t t) {
>>> +    return (t == PA_MEM_TYPE_SHARED_POSIX) || (t == PA_MEM_TYPE_SHARED_MEMFD);
>>> +}
>>> +
>>
>> Is the reason for having this as an inline function just to avoid a mem.c ?
>>
>
> Is the inline problematic in the first place? pa_mem_type_is_shared()
> is inherently just a type-safe macro...

I'm okay with a static inline here. Comment withdrawn. :-)

>
> If it's problematic there's gcc __attribute__((unused)), but
> that's even worse.
>
> Thanks,
>

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list