[pulseaudio-discuss] [PATCH 04/11] pulsecore: Split pa_shm mempool backend into pa_shm and pa_privatemem

Tanu Kaskinen tanuk at iki.fi
Tue Sep 22 22:49:27 PDT 2015


On Sun, 2015-09-20 at 23:30 +0200, Ahmed S. Darwish wrote:
> +int pa_privatemem_create(pa_privatemem *m, size_t size) {
> +    pa_assert(m);
> +    pa_assert(size > 0);
> +    pa_assert(size <= MAX_MEM_SIZE);
> +
> +    /* Each time we create a new SHM area, let's first drop all stale
> +     * ones */
> +    pa_shm_cleanup();

This seems unnecessary.

> diff --git a/src/pulsecore/privatemem.h b/src/pulsecore/privatemem.h
> new file mode 100644
> index 0000000..a6ae710
> --- /dev/null
> +++ b/src/pulsecore/privatemem.h
> @@ -0,0 +1,34 @@
> +#ifndef SRC_PULSECORE_PRIVATEMEM_H_
> +#define SRC_PULSECORE_PRIVATEMEM_H_

#define fooprivatememhfoo would be more consistent with other headers.

> diff --git a/src/pulsecore/shm.h b/src/pulsecore/shm.h
> index 9fe8e2f..0e6e9b6 100644
> --- a/src/pulsecore/shm.h
> +++ b/src/pulsecore/shm.h
> @@ -29,16 +28,17 @@ typedef struct pa_shm {
>      void *ptr;
>      size_t size;
>      bool do_unlink:1;
> -    bool shared:1;
>  } pa_shm;
>  
> -int pa_shm_create_rw(pa_shm *m, size_t size, bool shared, mode_t mode);
> +/* 1 GiB at max */
> +#define MAX_SHM_SIZE (PA_ALIGN(1024*1024*1024))

Identifiers defined in headers should use the "PA_" prefix.

-- 
Tanu


More information about the pulseaudio-discuss mailing list