To declare malloc/free we should use stdlib.h/cstdlib.

libgm2/ChangeLog:

        * libm2iso/wrapclock.cc: Use stdlib.h instead of
        malloc.h.
        * libm2iso/wrapsock.c: Likewise.
        * libm2iso/wraptime.cc: Likewise.

Signed-off-by: Iain Sandoe <[email protected]>
---
 libgm2/libm2iso/wrapclock.cc |  4 ++--
 libgm2/libm2iso/wrapsock.c   |  2 +-
 libgm2/libm2iso/wraptime.cc  | 14 +++++++++-----
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/libgm2/libm2iso/wrapclock.cc b/libgm2/libm2iso/wrapclock.cc
index 31ddeb573f8..540a8b9ae6d 100644
--- a/libgm2/libm2iso/wrapclock.cc
+++ b/libgm2/libm2iso/wrapclock.cc
@@ -135,7 +135,7 @@ EXPORT(SetTimeRealtime) (void *ts)
 extern "C" struct timespec *
 EXPORT(InitTimespec) (void)
 {
-#if defined(HAVE_STRUCT_TIMESPEC) && defined(HAVE_MALLOC_H)
+#if defined(HAVE_STRUCT_TIMESPEC) && defined(HAVE_STDLIB_H)
   return (struct timespec *)malloc (sizeof (struct timespec));
 #else
   return NULL;
@@ -157,7 +157,7 @@ EXPORT(InitTimespec) (void)
 extern "C" struct timespec *
 EXPORT(KillTimespec) (void *ts)
 {
-#if defined(HAVE_MALLOC_H)
+#if defined(HAVE_STDLIB_H)
   free (ts);
 #endif
   return NULL;
diff --git a/libgm2/libm2iso/wrapsock.c b/libgm2/libm2iso/wrapsock.c
index 805271ef70d..79f3db96064 100644
--- a/libgm2/libm2iso/wrapsock.c
+++ b/libgm2/libm2iso/wrapsock.c
@@ -77,7 +77,7 @@ extern void m2iso_M2RTS_RegisterModule (const char 
*modulename, const char *libn
 #include "malloc.h"
 #endif
 
-#if defined(HAVE_MALLOC_H)
+#if defined(HAVE_SIGNAL_H)
 #include "signal.h"
 #endif
 
diff --git a/libgm2/libm2iso/wraptime.cc b/libgm2/libm2iso/wraptime.cc
index ed5f05e5932..9c28f9e59f3 100644
--- a/libgm2/libm2iso/wraptime.cc
+++ b/libgm2/libm2iso/wraptime.cc
@@ -43,6 +43,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If 
not, see
 #include "time.h"
 #endif
 
+#if defined(HAVE_STDLIB_H)
+#include <stdlib.h>
+#endif
+
 #if defined(HAVE_MALLOC_H)
 #include "malloc.h"
 #endif
@@ -77,7 +81,7 @@ EXPORT(InitTimeval) (void)
 extern "C" struct timeval *
 EXPORT(KillTimeval) (void *tv)
 {
-#if defined(HAVE_MALLOC_H)
+#if defined(HAVE_STDLIB_H)
   free (tv);
 #endif
   return NULL;
@@ -85,7 +89,7 @@ EXPORT(KillTimeval) (void *tv)
 
 /* InitTimezone returns a newly created opaque type.  */
 
-#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_MALLOC_H)
+#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_STDLIB_H)
 extern "C" struct timezone *
 EXPORT(InitTimezone) (void)
 {
@@ -102,7 +106,7 @@ EXPORT(InitTimezone) (void)
 /* KillTimezone - deallocates the memory associated with an opaque
    type.  */
 
-#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_MALLOC_H)
+#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_STDLIB_H)
 extern "C" struct timezone *
 EXPORT(KillTimezone) (struct timezone *tv)
 {
@@ -119,7 +123,7 @@ EXPORT(KillTimezone) (void *tv)
 
 /* InitTM - returns a newly created opaque type.  */
 
-#if defined(HAVE_SYS_TIME_H) && defined(HAVE_MALLOC_H)
+#if defined(HAVE_SYS_TIME_H) && defined(HAVE_STDLIB_H)
 extern "C" struct tm *
 EXPORT(InitTM) (void)
 {
@@ -138,7 +142,7 @@ EXPORT(InitTM) (void)
 extern "C" struct tm *
 EXPORT(KillTM) (struct tm *tv)
 {
-#if defined(HAVE_MALLOC_H)
+#if defined(HAVE_STDLIB_H)
   free (tv);
 #endif
   return NULL;
-- 
2.50.1 (Apple Git-155)

Reply via email to