diff options
author | Max Kellermann <max@duempel.org> | 2009-03-09 19:10:18 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-09 19:10:18 +0100 |
commit | 940af669b3a703145185c947e31d1d3374bc66da (patch) | |
tree | 35e85b3089e4db8a6d4b02b611034f6f99e0207a /src/poison.h | |
parent | fd76e29fbaac10158e47fcec44133a038fb23909 (diff) | |
download | mpd-940af669b3a703145185c947e31d1d3374bc66da.tar.gz mpd-940af669b3a703145185c947e31d1d3374bc66da.tar.xz mpd-940af669b3a703145185c947e31d1d3374bc66da.zip |
poison: added valgrind support
If the header valgrind/memcheck.h is available, add
VALGRIND_MAKE_MEM_NOACCESS() and VALGRIND_MAKE_MEM_UNDEFINED()
support, which enables nice warnings in the valgrind memory checker.
Diffstat (limited to 'src/poison.h')
-rw-r--r-- | src/poison.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/poison.h b/src/poison.h index d37ff233e..fa924a31b 100644 --- a/src/poison.h +++ b/src/poison.h @@ -20,6 +20,12 @@ #define MPD_POISON_H #ifndef NDEBUG +#include "config.h" + +#ifdef HAVE_VALGRIND_MEMCHECK_H +#include <valgrind/memcheck.h> +#endif + #include <string.h> #endif @@ -37,6 +43,10 @@ poison_noaccess(void *p, size_t length) (void)length; #else memset(p, 0x01, length); + +#ifdef HAVE_VALGRIND_MEMCHECK_H + VALGRIND_MAKE_MEM_NOACCESS(p, length); +#endif #endif } @@ -54,6 +64,10 @@ poison_undefined(void *p, size_t length) (void)length; #else memset(p, 0x02, length); + +#ifdef HAVE_VALGRIND_MEMCHECK_H + VALGRIND_MAKE_MEM_UNDEFINED(p, length); +#endif #endif } |