[pulseaudio-discuss] [PATCH] RFC: Remove symdef header generation

Arun Raghavan arun at arunraghavan.net
Wed Dec 6 23:12:21 UTC 2017



On Thu, 7 Dec 2017, at 03:57 AM, Tanu Kaskinen wrote:
> 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.

Sure, that works.

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

I'm okay with that (we can rename to something more generic if we we
find this being reused).

Thanks for the review, I'll go ahed and complete this now.

Cheers,
Arun


More information about the pulseaudio-discuss mailing list