[PATCH] RFC: Remove symdef header generation

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

 



On Tue, 2017-12-05 at 10:56 +0530, Arun Raghavan wrote:
> ---
>  src/modules/module-allow-passthrough.c |  5 +++--
>  src/modules/module-null-sink.c         |  6 +++---
>  src/pulsecore/module.h                 | 29 +++++++++++++++++++++++++++++
>  3 files changed, 35 insertions(+), 5 deletions(-)

Thanks, this seems nicer than using m4 magic.

> diff --git a/src/modules/module-allow-passthrough.c b/src/modules/module-allow-passthrough.c
> index aea81cb52..5fda6878a 100644
> --- a/src/modules/module-allow-passthrough.c
> +++ b/src/modules/module-allow-passthrough.c
> @@ -25,6 +25,9 @@
>  
>  #include <pulse/xmalloc.h>
>  
> +#define PA_MODULE_NAME module_allow_passthrough
> +#include <pulsecore/module.h>
> +

This works only if nothing else has included module.h first. I think it
would be more robust to define PA_MODULE_NAME with the -D compiler
option.

> diff --git a/src/pulsecore/module.h b/src/pulsecore/module.h
> index ec2de0b94..d20c80258 100644
> --- a/src/pulsecore/module.h
> +++ b/src/pulsecore/module.h
> @@ -92,4 +92,33 @@ void pa_module_hook_connect(pa_module *m, pa_hook *hook, pa_hook_priority_t prio
>      bool pa__load_once(void) { return b; }                 \
>      struct __stupid_useless_struct_to_allow_trailing_semicolon
>  
> +/* Check if we're defining a module */
> +#ifdef PA_MODULE_NAME
> +
> +/* Jump through some double-indirection hoops to get PA_MODULE_NAME substituted before the concatenation */
> +#define _PA_MACRO_CONCAT1(a, b) a ## b
> +#define _PA_MACRO_CONCAT(a, b) _PA_MACRO_CONCAT1(a, b)

Bikeshedding: I don't like the _PA_ prefix, since these macros aren't
meant to be used elsewhere. My suggestion is just "MACRO_CONCAT".

-- 
Tanu

https://www.patreon.com/tanuk


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

  Powered by Linux