summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-04-16 13:19:51 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-04-16 13:19:51 +0000
commit8cb0672c580e9fb8beff576b0fa53f9c07978911 (patch)
tree591bdb7e78ed35c43f19fc15c4387daf081b106f
parent004502551bd53ae68a7dfee8bdb47831c9c39817 (diff)
downloadsamba-8cb0672c580e9fb8beff576b0fa53f9c07978911.tar.gz
samba-8cb0672c580e9fb8beff576b0fa53f9c07978911.tar.bz2
samba-8cb0672c580e9fb8beff576b0fa53f9c07978911.zip
Merge valgrind header usage from HEAD.
(This used to be commit 5c978e39f2879d900a1bcad535b489f4cd440906)
-rw-r--r--source3/include/includes.h21
-rw-r--r--source3/tdb/tdbbackup.c10
2 files changed, 17 insertions, 14 deletions
diff --git a/source3/include/includes.h b/source3/include/includes.h
index d406c07d06..3ff80d07ab 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -437,6 +437,23 @@
#include <com_err.h>
#endif
+/* Special macros that are no-ops except when run under Valgrind on
+ * x86. They've moved a little bit from valgrind 1.0.4 to 1.9.4 */
+#if HAVE_VALGRIND_MEMCHECK_H
+ /* memcheck.h includes valgrind.h */
+#include <valgrind/memcheck.h>
+#elif HAVE_VALGRIND_H
+#include <valgrind.h>
+#endif
+
+/* If we have --enable-developer and the valgrind header is present,
+ * then we're OK to use it. Set a macro so this logic can be done only
+ * once. */
+#if defined(DEVELOPER) && (HAVE_VALGRIND_H || HAVE_VALGRIND_VALGRIND_H)
+#define VALGRIND
+#endif
+
+
/* we support ADS if we want it and have krb5 and ldap libs */
#if defined(WITH_ADS) && defined(HAVE_KRB5) && defined(HAVE_LDAP)
#define HAVE_ADS
@@ -1212,10 +1229,6 @@ int smb_xvasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE(
time_t timegm(struct tm *tm);
#endif
-#if defined(VALGRIND)
-#define strlen(x) valgrind_strlen(x)
-#endif
-
/*
* Veritas File System. Often in addition to native.
* Quotas different.
diff --git a/source3/tdb/tdbbackup.c b/source3/tdb/tdbbackup.c
index 7b344de6c4..36ba7db918 100644
--- a/source3/tdb/tdbbackup.c
+++ b/source3/tdb/tdbbackup.c
@@ -303,13 +303,3 @@ static void usage(void)
return ret;
}
-
-#ifdef VALGRIND
-size_t valgrind_strlen(const char *s)
-{
- size_t count;
- for(count = 0; *s++; count++)
- ;
- return count;
-}
-#endif