mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
add new API function pa_in_valgrind() to check for
This commit is contained in:
parent
7a1a147881
commit
8222f1200f
2 changed files with 28 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@
|
|||
#include <pulse/gccmacro.h>
|
||||
#include <pulsecore/macro.h>
|
||||
|
||||
#ifndef PACKAGE
|
||||
#error "Please include config.h before including this file!"
|
||||
#endif
|
||||
|
||||
struct timeval;
|
||||
|
||||
/* These resource limits are pretty new on Linux, let's define them
|
||||
|
|
@ -193,4 +197,13 @@ pa_bool_t pa_in_system_mode(void);
|
|||
char *pa_machine_id(void);
|
||||
char *pa_uname_string(void);
|
||||
|
||||
|
||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
|
||||
pa_bool_t pa_in_valgrind(void);
|
||||
#else
|
||||
static inline pa_bool_t pa_in_valgrind(void) {
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue