mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
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:
parent
72323bc6bb
commit
93348331bb
4 changed files with 10 additions and 21 deletions
|
|
@ -144,7 +144,7 @@ static const pa_daemon_conf default_conf = {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
pa_daemon_conf* pa_daemon_conf_new(void) {
|
pa_daemon_conf *pa_daemon_conf_new(void) {
|
||||||
pa_daemon_conf *c;
|
pa_daemon_conf *c;
|
||||||
|
|
||||||
c = pa_xnewdup(pa_daemon_conf, &default_conf, 1);
|
c = pa_xnewdup(pa_daemon_conf, &default_conf, 1);
|
||||||
|
|
@ -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",
|
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);
|
pa_win32_get_toplevel(NULL), PA_MAJOR, PA_MINOR);
|
||||||
#else
|
#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()) {
|
if (pa_run_from_build_tree()) {
|
||||||
pa_log_notice("Detected that we are run from the build tree, fixing search path.");
|
pa_log_notice("Detected that we are run from the build tree, fixing search path.");
|
||||||
c->dl_search_path = pa_xstrdup(PA_BUILDDIR "/.libs/");
|
c->dl_search_path = pa_xstrdup(PA_BUILDDIR "/.libs/");
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
#endif
|
|
||||||
c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
|
c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ struct pa_alsa_fdlist {
|
||||||
void *userdata;
|
void *userdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void io_cb(pa_mainloop_api*a, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata) {
|
static void io_cb(pa_mainloop_api *a, pa_io_event *e, int fd, pa_io_event_flags_t events, void *userdata) {
|
||||||
|
|
||||||
struct pa_alsa_fdlist *fdl = userdata;
|
struct pa_alsa_fdlist *fdl = userdata;
|
||||||
int err;
|
int err;
|
||||||
|
|
@ -132,7 +132,7 @@ static void io_cb(pa_mainloop_api*a, pa_io_event* e, int fd, pa_io_event_flags_t
|
||||||
snd_mixer_handle_events(fdl->mixer);
|
snd_mixer_handle_events(fdl->mixer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void defer_cb(pa_mainloop_api*a, pa_defer_event* e, void *userdata) {
|
static void defer_cb(pa_mainloop_api *a, pa_defer_event *e, void *userdata) {
|
||||||
struct pa_alsa_fdlist *fdl = userdata;
|
struct pa_alsa_fdlist *fdl = userdata;
|
||||||
unsigned num_fds, i;
|
unsigned num_fds, i;
|
||||||
int err, n;
|
int err, n;
|
||||||
|
|
@ -230,7 +230,7 @@ void pa_alsa_fdlist_free(struct pa_alsa_fdlist *fdl) {
|
||||||
pa_xfree(fdl);
|
pa_xfree(fdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pa_alsa_fdlist_set_mixer(struct pa_alsa_fdlist *fdl, snd_mixer_t *mixer_handle, pa_mainloop_api* m) {
|
int pa_alsa_fdlist_set_mixer(struct pa_alsa_fdlist *fdl, snd_mixer_t *mixer_handle, pa_mainloop_api *m) {
|
||||||
pa_assert(fdl);
|
pa_assert(fdl);
|
||||||
pa_assert(mixer_handle);
|
pa_assert(mixer_handle);
|
||||||
pa_assert(m);
|
pa_assert(m);
|
||||||
|
|
@ -2229,9 +2229,7 @@ pa_alsa_path* pa_alsa_path_new(const char *fname, pa_alsa_direction_t direction)
|
||||||
items[2].data = &p->name;
|
items[2].data = &p->name;
|
||||||
|
|
||||||
fn = pa_maybe_prefix_path(fname,
|
fn = pa_maybe_prefix_path(fname,
|
||||||
#if defined(__linux__) && !defined(__OPTIMIZE__)
|
|
||||||
pa_run_from_build_tree() ? PA_BUILDDIR "/modules/alsa/mixer/paths/" :
|
pa_run_from_build_tree() ? PA_BUILDDIR "/modules/alsa/mixer/paths/" :
|
||||||
#endif
|
|
||||||
PA_ALSA_PATHS_DIR);
|
PA_ALSA_PATHS_DIR);
|
||||||
|
|
||||||
r = pa_config_parse(fn, NULL, items, p);
|
r = pa_config_parse(fn, NULL, items, p);
|
||||||
|
|
@ -2250,7 +2248,7 @@ fail:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_alsa_path* pa_alsa_path_synthesize(const char*element, pa_alsa_direction_t direction) {
|
pa_alsa_path *pa_alsa_path_synthesize(const char *element, pa_alsa_direction_t direction) {
|
||||||
pa_alsa_path *p;
|
pa_alsa_path *p;
|
||||||
pa_alsa_element *e;
|
pa_alsa_element *e;
|
||||||
|
|
||||||
|
|
@ -3744,9 +3742,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel
|
||||||
fname = "default.conf";
|
fname = "default.conf";
|
||||||
|
|
||||||
fn = pa_maybe_prefix_path(fname,
|
fn = pa_maybe_prefix_path(fname,
|
||||||
#if defined(__linux__) && !defined(__OPTIMIZE__)
|
|
||||||
pa_run_from_build_tree() ? PA_BUILDDIR "/modules/alsa/mixer/profile-sets/" :
|
pa_run_from_build_tree() ? PA_BUILDDIR "/modules/alsa/mixer/profile-sets/" :
|
||||||
#endif
|
|
||||||
PA_ALSA_PROFILE_SETS_DIR);
|
PA_ALSA_PROFILE_SETS_DIR);
|
||||||
|
|
||||||
r = pa_config_parse(fn, NULL, items, ps);
|
r = pa_config_parse(fn, NULL, items, ps);
|
||||||
|
|
|
||||||
|
|
@ -2991,9 +2991,6 @@ pa_bool_t pa_run_from_build_tree(void) {
|
||||||
char *rp;
|
char *rp;
|
||||||
pa_bool_t b = FALSE;
|
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"))) {
|
if ((rp = pa_readlink("/proc/self/exe"))) {
|
||||||
b = pa_startswith(rp, PA_BUILDDIR);
|
b = pa_startswith(rp, PA_BUILDDIR);
|
||||||
pa_xfree(rp);
|
pa_xfree(rp);
|
||||||
|
|
|
||||||
|
|
@ -254,8 +254,13 @@ size_t pa_pipe_buf(int fd);
|
||||||
|
|
||||||
void pa_reset_personality(void);
|
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__)
|
#if defined(__linux__) && !defined(__OPTIMIZE__)
|
||||||
pa_bool_t pa_run_from_build_tree(void);
|
pa_bool_t pa_run_from_build_tree(void);
|
||||||
|
#else
|
||||||
|
static inline pa_bool_t pa_run_from_build_tree(void) {return FALSE;}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *pa_get_temp_dir(void);
|
const char *pa_get_temp_dir(void);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue