Commit 89166c82 authored by Giuseppe Ottaviano's avatar Giuseppe Ottaviano Committed by Facebook Github Bot 3

Make Malloc.h self-contained again

Summary: D3743475 adds to `Malloc.h` a dependency on another folly header, which breaks it when used in stand-alone mode. This diff moves the include to the right `#ifdef` section.

Reviewed By: Gownta

Differential Revision: D3757819

fbshipit-source-id: 71664ca6a3a47b6e4449a4ef603fedf052c5df3b
parent b646787c
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#pragma once #pragma once
#define FOLLY_MALLOC_H_ #define FOLLY_MALLOC_H_
#include <folly/portability/BitsFunctexcept.h>
/** /**
* Define various MALLOCX_* macros normally provided by jemalloc. We define * Define various MALLOCX_* macros normally provided by jemalloc. We define
* them so that we don't have to include jemalloc.h, in case the program is * them so that we don't have to include jemalloc.h, in case the program is
...@@ -42,6 +40,7 @@ ...@@ -42,6 +40,7 @@
#if defined(_GLIBCXX_USE_FB) && !defined(_LIBSTDCXX_FBSTRING) #if defined(_GLIBCXX_USE_FB) && !defined(_LIBSTDCXX_FBSTRING)
#include <folly/detail/Malloc.h> #include <folly/detail/Malloc.h>
#include <folly/portability/BitsFunctexcept.h>
#include <string> #include <string>
...@@ -87,13 +86,19 @@ extern "C" int mallctlbymib(const size_t*, size_t, void*, size_t*, void*, ...@@ -87,13 +86,19 @@ extern "C" int mallctlbymib(const size_t*, size_t, void*, size_t*, void*,
size_t) size_t)
__attribute__((__weak__)); __attribute__((__weak__));
#include <bits/functexcept.h>
#define FOLLY_HAVE_MALLOC_H 1 #define FOLLY_HAVE_MALLOC_H 1
#else
#else // !defined(_LIBSTDCXX_FBSTRING)
#include <folly/detail/Malloc.h> /* nolint */ #include <folly/detail/Malloc.h> /* nolint */
#include <folly/portability/BitsFunctexcept.h> /* nolint */
#endif #endif
// for malloc_usable_size // for malloc_usable_size
// NOTE: FreeBSD 9 doesn't have malloc.h. It's defitions // NOTE: FreeBSD 9 doesn't have malloc.h. Its definitions
// are found in stdlib.h. // are found in stdlib.h.
#if FOLLY_HAVE_MALLOC_H #if FOLLY_HAVE_MALLOC_H
#include <malloc.h> #include <malloc.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment