summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchappedm@gmail.com <chappedm@gmail.com@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2012-11-04 22:53:01 +0000
committerchappedm@gmail.com <chappedm@gmail.com@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2012-11-04 22:53:01 +0000
commit5fe91d5623c2351ba4675db71822fc6be5e2cbce (patch)
treef6a42f703a30f44cff05df5b34e5009338b8e1c9
parent86a55316baf2a7c0718670fd7342b648e0ef4a87 (diff)
downloadgperftools-5fe91d5623c2351ba4675db71822fc6be5e2cbce.tar.gz
issue-450: Move includes for struct mallinfo from tcmalloc.cc to tcmalloc.h to fix compiler warnings from clang.
git-svn-id: http://gperftools.googlecode.com/svn/trunk@180 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
-rw-r--r--src/gperftools/tcmalloc.h.in12
-rw-r--r--src/tcmalloc.cc12
2 files changed, 11 insertions, 13 deletions
diff --git a/src/gperftools/tcmalloc.h.in b/src/gperftools/tcmalloc.h.in
index dbca6ec..feecf85 100644
--- a/src/gperftools/tcmalloc.h.in
+++ b/src/gperftools/tcmalloc.h.in
@@ -53,7 +53,17 @@
#define TC_VERSION_PATCH "@TC_VERSION_PATCH@"
#define TC_VERSION_STRING "gperftools @TC_VERSION_MAJOR@.@TC_VERSION_MINOR@@TC_VERSION_PATCH@"
-#include <stdlib.h> // for struct mallinfo, if it's defined
+// For struct mallinfo, if it's defined.
+#ifdef HAVE_STRUCT_MALLINFO
+// Malloc can be in several places on older versions of OS X.
+# if defined(HAVE_MALLOC_H)
+# include <malloc.h>
+# elif defined(HAVE_SYS_MALLOC_H)
+# include <sys/malloc.h>
+# elif defined(HAVE_MALLOC_MALLOC_H)
+# include <malloc/malloc.h>
+# endif
+#endif
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef PERFTOOLS_DLL_DECL
diff --git a/src/tcmalloc.cc b/src/tcmalloc.cc
index e9b51a4..9823230 100644
--- a/src/tcmalloc.cc
+++ b/src/tcmalloc.cc
@@ -131,18 +131,6 @@
#include "tcmalloc_guard.h" // for TCMallocGuard
#include "thread_cache.h" // for ThreadCache
-// We only need malloc.h for struct mallinfo.
-#ifdef HAVE_STRUCT_MALLINFO
-// Malloc can be in several places on older versions of OS X.
-# if defined(HAVE_MALLOC_H)
-# include <malloc.h>
-# elif defined(HAVE_SYS_MALLOC_H)
-# include <sys/malloc.h>
-# elif defined(HAVE_MALLOC_MALLOC_H)
-# include <malloc/malloc.h>
-# endif
-#endif
-
#if (defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)) && !defined(WIN32_OVERRIDE_ALLOCATORS)
# define WIN32_DO_PATCHING 1
#endif