From 6570a27c5ce258e9a4c38045b4fd561319dca3b2 Mon Sep 17 00:00:00 2001 From: stewartamiles Date: Thu, 23 Jul 2009 16:33:49 +0000 Subject: [PATCH] Integrated fix for cmockery "Issue 3: malloc.h not found on Mac OS Leopard". git-svn-id: http://cmockery.googlecode.com/svn/trunk@34 40f4469a-5155-0410-be90-2de3f0bae501 --- src/cmockery.c | 5 +++++ src/example/allocate_module.c | 6 ++++++ src/example/calculator.c | 5 +++++ windows/makefile | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/cmockery.c b/src/cmockery.c index 81f30f1..badcd6e 100755 --- a/src/cmockery.c +++ b/src/cmockery.c @@ -13,7 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#ifdef HAVE_MALLOC_H #include +#endif #include #ifndef _WIN32 #include diff --git a/src/example/allocate_module.c b/src/example/allocate_module.c index 9f11d46..a0387f9 100644 --- a/src/example/allocate_module.c +++ b/src/example/allocate_module.c @@ -13,7 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#ifdef HAVE_MALLOC_H #include +#endif +#include #if UNIT_TESTING extern void* _test_malloc(const size_t size, const char* file, const int line); diff --git a/src/example/calculator.c b/src/example/calculator.c index 803b26f..42f273f 100644 --- a/src/example/calculator.c +++ b/src/example/calculator.c @@ -16,8 +16,13 @@ // A calculator example used to demonstrate the cmockery testing library. +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include +#ifdef HAVE_MALLOC_H #include +#endif #include #include #include diff --git a/windows/makefile b/windows/makefile index 4d3e416..a6580f3 100644 --- a/windows/makefile +++ b/windows/makefile @@ -53,7 +53,7 @@ EXAMPLE_SOURCE_DIRECTORY=..\src\example !ENDIF # EXAMPLE_SOURCE_DIRECTORY # Compiler flags and commands. -CC_COMMAND=$(CC) /nologo /c /D_WIN32_WINNT=0x501 \ +CC_COMMAND=$(CC) /nologo /c /D_WIN32_WINNT=0x501 /DHAVE_MALLOC_H \ /I$(LIBRARY_SOURCE_DIRECTORY)\google $(CFLAGS) $(**) /Fo$(@) CC_COMMAND_UNIT_TEST=$(CC_COMMAND) /DUNIT_TESTING=1 \ /I$(EXAMPLE_SOURCE_DIRECTORY) -- 2.34.1