Integrated fix for cmockery "Issue 3: malloc.h not found on Mac OS Leopard".
authorstewartamiles <stewartamiles@40f4469a-5155-0410-be90-2de3f0bae501>
Thu, 23 Jul 2009 16:33:49 +0000 (16:33 +0000)
committerstewartamiles <stewartamiles@40f4469a-5155-0410-be90-2de3f0bae501>
Thu, 23 Jul 2009 16:33:49 +0000 (16:33 +0000)
git-svn-id: http://cmockery.googlecode.com/svn/trunk@34 40f4469a-5155-0410-be90-2de3f0bae501

src/cmockery.c
src/example/allocate_module.c
src/example/calculator.c
windows/makefile

index 81f30f1..badcd6e 100755 (executable)
  * 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 <malloc.h>
+#endif
 #include <setjmp.h>
 #ifndef _WIN32
 #include <signal.h>
index 9f11d46..a0387f9 100644 (file)
  * 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 <malloc.h>
+#endif
+#include <sys/types.h>
 
 #if UNIT_TESTING
 extern void* _test_malloc(const size_t size, const char* file, const int line);
index 803b26f..42f273f 100644 (file)
 
 // A calculator example used to demonstrate the cmockery testing library.
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include <assert.h>
+#ifdef HAVE_MALLOC_H
 #include <malloc.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 4d3e416..a6580f3 100644 (file)
@@ -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)