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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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...

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

Thanks,

-- 
Darwish
http://darwish.chasingpointers.com


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux