Move compile-time checks around pa_run_from_build_tree to core-util

To make the code cleaner and have the checks all in one place.
This commit is contained in:
Maarten Bosmans 2011-03-22 16:02:24 +01:00 committed by Colin Guthrie
parent 72323bc6bb
commit 93348331bb
4 changed files with 10 additions and 21 deletions

View file

@ -153,19 +153,10 @@ pa_daemon_conf* pa_daemon_conf_new(void) {
c->dl_search_path = pa_sprintf_malloc("%s" PA_PATH_SEP "lib" PA_PATH_SEP "pulse-%d.%d" PA_PATH_SEP "modules",
pa_win32_get_toplevel(NULL), PA_MAJOR, PA_MINOR);
#else
#if defined(__linux__) && !defined(__OPTIMIZE__)
/* We abuse __OPTIMIZE__ as a check whether we are a debug build
* or not. If we are and are run from the build tree then we
* override the search path to point to our build tree */
if (pa_run_from_build_tree()) {
pa_log_notice("Detected that we are run from the build tree, fixing search path.");
c->dl_search_path = pa_xstrdup(PA_BUILDDIR "/.libs/");
} else
#endif
c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
#endif

View file

@ -2229,9 +2229,7 @@ pa_alsa_path* pa_alsa_path_new(const char *fname, pa_alsa_direction_t direction)
items[2].data = &p->name;
fn = pa_maybe_prefix_path(fname,
#if defined(__linux__) && !defined(__OPTIMIZE__)
pa_run_from_build_tree() ? PA_BUILDDIR "/modules/alsa/mixer/paths/" :
#endif
PA_ALSA_PATHS_DIR);
r = pa_config_parse(fn, NULL, items, p);
@ -3744,9 +3742,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel
fname = "default.conf";
fn = pa_maybe_prefix_path(fname,
#if defined(__linux__) && !defined(__OPTIMIZE__)
pa_run_from_build_tree() ? PA_BUILDDIR "/modules/alsa/mixer/profile-sets/" :
#endif
PA_ALSA_PROFILE_SETS_DIR);
r = pa_config_parse(fn, NULL, items, ps);

View file

@ -2991,9 +2991,6 @@ pa_bool_t pa_run_from_build_tree(void) {
char *rp;
pa_bool_t b = FALSE;
/* We abuse __OPTIMIZE__ as a check whether we are a debug build
* or not. */
if ((rp = pa_readlink("/proc/self/exe"))) {
b = pa_startswith(rp, PA_BUILDDIR);
pa_xfree(rp);

View file

@ -254,8 +254,13 @@ size_t pa_pipe_buf(int fd);
void pa_reset_personality(void);
/* We abuse __OPTIMIZE__ as a check whether we are a debug build
* or not. If we are and are run from the build tree then we
* override the search path to point to our build tree */
#if defined(__linux__) && !defined(__OPTIMIZE__)
pa_bool_t pa_run_from_build_tree(void);
#else
static inline pa_bool_t pa_run_from_build_tree(void) {return FALSE;}
#endif
const char *pa_get_temp_dir(void);