diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-10-04 00:10:43 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-10-04 00:10:43 +0200 |
commit | 8222f1200fc2db90fdfde17f5f958f04272f9ade (patch) | |
tree | c1456c452eb2e79ade956d412272e8e4869d48db /src/pulsecore/core-util.c | |
parent | 7a1a1478819c0f4716f0612f1121a0429f455fa9 (diff) |
add new API function pa_in_valgrind() to check for
Diffstat (limited to 'src/pulsecore/core-util.c')
-rw-r--r-- | src/pulsecore/core-util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 0bc5cb40..dde34d7b 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -2472,3 +2472,18 @@ char *pa_uname_string(void) { return pa_sprintf_malloc("%s %s %s %s", u.sysname, u.machine, u.release, u.version); } + +#ifdef HAVE_VALGRIND_MEMCHECK_H +pa_bool_t pa_in_valgrind(void) { + static int b = 0; + + /* To make heisenbugs a bit simpler to find we check for $VALGRIND + * here instead of really checking whether we run in valgrind or + * not. */ + + if (b < 1) + b = getenv("VALGRIND") ? 2 : 1; + + return b > 1; +} +#endif |