sink-input: adjust log level of empty-pop operations
[platform/upstream/pulseaudio.git] / src / pulsecore / ltdl-helper.c
1 /***
2   This file is part of PulseAudio.
3
4   Copyright 2004-2006 Lennart Poettering
5   Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
6
7   PulseAudio is free software; you can redistribute it and/or modify
8   it under the terms of the GNU Lesser General Public License as published
9   by the Free Software Foundation; either version 2.1 of the License,
10   or (at your option) any later version.
11
12   PulseAudio is distributed in the hope that it will be useful, but
13   WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   General Public License for more details.
16
17   You should have received a copy of the GNU Lesser General Public License
18   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
19 ***/
20
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
24
25 #include <stdlib.h>
26 #include <ctype.h>
27
28 #include <pulse/xmalloc.h>
29
30 #include <pulsecore/core-util.h>
31 #include <pulsecore/macro.h>
32
33 #include "ltdl-helper.h"
34
35 pa_void_func_t pa_load_sym(lt_dlhandle handle, const char *module, const char *symbol) {
36     char *sn, *c;
37     pa_void_func_t f;
38
39     pa_assert(handle);
40     pa_assert(symbol);
41
42     f = (pa_void_func_t) lt_dlsym(handle, symbol);
43
44     if (f)
45         return f;
46
47     if (!module)
48         return NULL;
49
50     /* As the .la files might have been cleansed from the system, we should
51      * try with the ltdl prefix as well. */
52
53     sn = pa_sprintf_malloc("%s_LTX_%s", module, symbol);
54
55     for (c = sn; *c; c++)
56         if (!isalnum((unsigned char)*c))
57             *c = '_';
58
59     f = (pa_void_func_t) lt_dlsym(handle, sn);
60     pa_xfree(sn);
61
62     return f;
63 }