diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2018-07-04 14:25:26 +0300 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2018-07-14 17:52:57 +0300 |
commit | c7e5715075b9a509d116a0ff06370021c687c3f4 (patch) | |
tree | 06494c45b402e1ba12732075fa8ec7c2a1bdefef | |
parent | acae6df6514bfded4e3b996e189d0255b746f5a4 (diff) |
ladspa-sink: fix search path
Having a single level macro for stringizing LADSPA_PATH doesn't work,
because the '#' preprocessor operator doesn't expand any macros in its
parameter. As a result, we used the string "LADSPA_PATH" as the search
path, and obviously no plugins were ever found.
This adds a two-level macro in macro.h and uses that to expand and
stringize LADSPA_PATH.
Bug link: https://bugs.freedesktop.org/show_bug.cgi?id=107078
-rw-r--r-- | src/modules/module-ladspa-sink.c | 14 | ||||
-rw-r--r-- | src/pulsecore/macro.h | 6 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index c365b3104..bdf1d4657 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -1054,15 +1054,13 @@ int pa__init(pa_module*m) { u->output = NULL; u->ss = ss; - /* If the LADSPA_PATH environment variable is not set, we use the - * LADSPA_PATH preprocessor macro instead. The macro can contain characters - * that need to be escaped (especially on Windows backslashes are common). - * The "#" preprocessor operator helpfully adds the required escaping while - * turning the LADSPA_PATH macro into a string. */ -#define QUOTE_MACRO(x) #x if (!(e = getenv("LADSPA_PATH"))) - e = QUOTE_MACRO(LADSPA_PATH); -#undef QUOTE_MACRO + /* The LADSPA_PATH preprocessor macro isn't a string literal (i.e. it + * doesn't contain quotes), because otherwise the build system would + * have an extra burden of getting the escaping right (Windows paths + * are especially tricky). PA_EXPAND_AND_STRINGIZE does the necessary + * escaping. */ + e = PA_EXPAND_AND_STRINGIZE(LADSPA_PATH); /* FIXME: This is not exactly thread safe */ t = pa_xstrdup(lt_dlgetsearchpath()); diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h index dbce5cd06..bb15b7f01 100644 --- a/src/pulsecore/macro.h +++ b/src/pulsecore/macro.h @@ -298,6 +298,12 @@ static inline size_t PA_ALIGN(size_t l) { ? (-1 - PA_INT_TYPE_MAX(type)) \ : (type) 0)) +/* The '#' preprocessor operator doesn't expand any macros that are in the + * parameter, which is why we need a separate macro for those cases where the + * parameter contains a macro that needs expanding. */ +#define PA_STRINGIZE(x) #x +#define PA_EXPAND_AND_STRINGIZE(x) PA_STRINGIZE(x) + /* We include this at the very last place */ #include <pulsecore/log.h> |