]> granicus.if.org Git - curl/commitdiff
Moved potential inclusion of system's malloc.h and memory.h header files to
authorYang Tse <yangsita@gmail.com>
Tue, 21 Apr 2009 10:26:58 +0000 (10:26 +0000)
committerYang Tse <yangsita@gmail.com>
Tue, 21 Apr 2009 10:26:58 +0000 (10:26 +0000)
setup_once.h.  Inclusion of each header file is based on the definition of
NEED_MALLOC_H and NEED_MEMORY_H respectively.

23 files changed:
CHANGES
acinclude.m4
ares/CHANGES
ares/acinclude.m4
ares/ares_init.c
ares/configure.ac
ares/setup_once.h
configure.ac
lib/curl_addrinfo.c
lib/hostares.c
lib/hostasyn.c
lib/hostip.c
lib/hostip4.c
lib/hostip6.c
lib/hostsyn.c
lib/hostthre.c
lib/ldap.c
lib/memdebug.h
lib/setup_once.h
lib/socks.c
lib/socks_gssapi.c
lib/socks_sspi.c
packages/vms/config-vms.h

diff --git a/CHANGES b/CHANGES
index d5317e8c065520d16546b3a42ba38d4b07aa9079..6c9bc82a45a2f403a8733b1a34cf17269f919158 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,11 @@
 
                                   Changelog
 
+Yang Tse (21 Apr 2009)
+- Moved potential inclusion of system's malloc.h and memory.h header files to
+  setup_once.h.  Inclusion of each header file is based on the definition of
+  NEED_MALLOC_H and NEED_MEMORY_H respectively.
+
 Daniel Stenberg (20 Apr 2009)
 - Leanic Lefever reported a crash and did some detailed research on why and
   how it occurs (http://curl.haxx.se/mail/lib-2009-04/0289.html). The
index c4b7a1395f3f77055b53f0230c5ac2fc8d8c7e0a..4ed4f01be92f49daf79716709fb6ca4c1a2f492c 100644 (file)
@@ -893,6 +893,58 @@ AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
 ])
 
 
+dnl CURL_CHECK_HEADER_MEMORY
+dnl -------------------------------------------------
+dnl Check for compilable and valid memory.h header,
+dnl and check if it is needed even with stdlib.h for
+dnl memory related functions.
+
+AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [
+  AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+#include <memory.h>
+      ]],[[
+        void *p = malloc(10);
+        void *q = calloc(10,10);
+        free(p);
+        free(q);
+      ]])
+    ],[
+      ac_cv_header_memory_h="yes"
+    ],[
+      ac_cv_header_memory_h="no"
+    ])
+  ])
+  if test "$ac_cv_header_memory_h" = "yes"; then
+    AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1,
+      [Define to 1 if you have the memory.h header file.])
+    #
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+#include <stdlib.h>
+      ]],[[
+        void *p = malloc(10);
+        void *q = calloc(10,10);
+        free(p);
+        free(q);
+      ]])
+    ],[
+      curl_cv_need_header_memory_h="no"
+    ],[
+      curl_cv_need_header_memory_h="yes"
+    ])
+    #
+    case "$curl_cv_need_header_memory_h" in
+      yes)
+        AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1,
+          [Define to 1 if you need the memory.h header file even with stdlib.h])
+        ;;
+    esac
+  fi
+])
+
+
 dnl CURL_CHECK_TYPE_SOCKLEN_T
 dnl -------------------------------------------------
 dnl Check for existing socklen_t type, and provide
index 90ee71113751db078207324fb978f2b549b24134..3fe0cf836b7b7c78de5d454b2bc649afff0edf9c 100644 (file)
@@ -1,5 +1,10 @@
   Changelog for the c-ares project
 
+* April 21 2009 (Yang Tse)
+- Moved potential inclusion of system's malloc.h and memory.h header files to
+  setup_once.h.  Inclusion of each header file is based on the definition of
+  NEED_MALLOC_H and NEED_MEMORY_H respectively.
+
 * March 11 2009 (Yang Tse)
 - Japheth Cleaver fixed acountry.c replacing u_long with unsigned long.
 
index 879643dc4e97d31c6631f9bfbcba5c64900602ce..790d1c74bd9d1eae58e95d12a84c0c9093c7f7dc 100644 (file)
@@ -360,6 +360,58 @@ AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
 ])
 
 
+dnl CURL_CHECK_HEADER_MEMORY
+dnl -------------------------------------------------
+dnl Check for compilable and valid memory.h header,
+dnl and check if it is needed even with stdlib.h for
+dnl memory related functions.
+
+AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [
+  AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+#include <memory.h>
+      ]],[[
+        void *p = malloc(10);
+        void *q = calloc(10,10);
+        free(p);
+        free(q);
+      ]])
+    ],[
+      ac_cv_header_memory_h="yes"
+    ],[
+      ac_cv_header_memory_h="no"
+    ])
+  ])
+  if test "$ac_cv_header_memory_h" = "yes"; then
+    AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1,
+      [Define to 1 if you have the memory.h header file.])
+    #
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+#include <stdlib.h>
+      ]],[[
+        void *p = malloc(10);
+        void *q = calloc(10,10);
+        free(p);
+        free(q);
+      ]])
+    ],[
+      curl_cv_need_header_memory_h="no"
+    ],[
+      curl_cv_need_header_memory_h="yes"
+    ])
+    #
+    case "$curl_cv_need_header_memory_h" in
+      yes)
+        AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1,
+          [Define to 1 if you need the memory.h header file even with stdlib.h])
+        ;;
+    esac
+  fi
+])
+
+
 dnl CURL_CHECK_TYPE_SOCKLEN_T
 dnl -------------------------------------------------
 dnl Check for existing socklen_t type, and provide
index e8d9ab1d09c48460b3866ab8dfeef4a56ef15d07..635efceed9a7f36cc8eeca69670bfe7aae2aaaf2 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$ */
 
 /* Copyright 1998 by the Massachusetts Institute of Technology.
- * Copyright (C) 2007-2008 by Daniel Stenberg
+ * Copyright (C) 2007-2009 by Daniel Stenberg
  *
  * Permission to use, copy, modify, and distribute this
  * software and its documentation for any purpose and without
@@ -20,7 +20,6 @@
 
 #if defined(WIN32) && !defined(WATT32)
 #include <iphlpapi.h>
-#include <malloc.h>
 #endif
 
 #ifdef HAVE_SYS_PARAM_H
index 67dc007717da04faf2826911c505cb71ddf50d02..aca5e940866a69c8944995ab8c7ef8704f78e243 100644 (file)
@@ -430,6 +430,7 @@ dnl Checks for header files.
 AC_HEADER_STDC
 
 CURL_CHECK_HEADER_MALLOC
+CURL_CHECK_HEADER_MEMORY
 
 dnl check for a few basic system headers we need
 AC_CHECK_HEADERS(
index 4f88d9994bb3be6c1998fcf2f3fb2f0dee9c36f2..bd5eba393b95cd4e8a8b8028c0fb6b33afc52827 100644 (file)
 #include <sys/types.h>
 #endif
 
+#ifdef NEED_MALLOC_H
+#include <malloc.h>
+#endif
+
+#ifdef NEED_MEMORY_H
+#include <memory.h>
+#endif
+
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
index d9ff3de8c2f30e699cc2956ab1056a15bf052bfd..14562efb7958accd2306eac96703d1dfd71259e2 100644 (file)
@@ -1869,6 +1869,7 @@ dnl Checks for header files.
 AC_HEADER_STDC
 
 CURL_CHECK_HEADER_MALLOC
+CURL_CHECK_HEADER_MEMORY
 
 dnl Now check for the very most basic headers. Then we can use these
 dnl ones as default-headers when checking for the rest!
index d5a6bc712c76c1de08f6d1746eae18b7f4e7002f..f88ea2a93e43ed7175a96a2c10880afa02b84f71 100644 (file)
@@ -25,9 +25,6 @@
 
 #include <curl/curl.h>
 
-#ifdef NEED_MALLOC_H
-#  include <malloc.h>
-#endif
 #ifdef HAVE_SYS_SOCKET_H
 #  include <sys/socket.h>
 #endif
index 1198ac7d9cccd173c19bc23af24933b01f9305bd..1998357a3ce12e8a79d34cb8cfe8ddb38f00587e 100644 (file)
@@ -28,9 +28,6 @@
 #ifdef HAVE_LIMITS_H
 #include <limits.h>
 #endif
-#ifdef NEED_MALLOC_H
-#include <malloc.h>
-#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index 802698af054c78a73ac479ba10659e07434a90fe..211ff7234ae700c848320ee2ba9e341b7a416511 100644 (file)
@@ -25,9 +25,6 @@
 
 #include <string.h>
 
-#ifdef NEED_MALLOC_H
-#include <malloc.h>
-#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index b4eb3583a1d7ff2befc2971b2ab6f373c8dba7cb..47d90aba9caf368bcf4f56d2d991a902abf2bc0b 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -25,9 +25,6 @@
 
 #include <string.h>
 
-#ifdef NEED_MALLOC_H
-#include <malloc.h>
-#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index f7100417e51cb5bac678d573695675a4b7d021e4..168405c19f0494dee3f323f699eca8f1bac6d407 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -26,9 +26,6 @@
 #include <string.h>
 #include <errno.h>
 
-#ifdef NEED_MALLOC_H
-#include <malloc.h>
-#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index 833e50b931a36a0e14a55f50636904ed07b8e839..e63e80670b598dd43b6d8e24760f0366b0fdaa35 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -25,9 +25,6 @@
 
 #include <string.h>
 
-#ifdef NEED_MALLOC_H
-#include <malloc.h>
-#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index 0c09f7094ad61ec2e4e60a4c8a021df78309e95d..d0d1ce4aa7f82f729efc85dc117ceb5401210ee6 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -25,9 +25,6 @@
 
 #include <string.h>
 
-#ifdef NEED_MALLOC_H
-#include <malloc.h>
-#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index 3aa1ccbcea0816dd2020adb45d1e32b3cd3942ed..e3958626b79d76ea0dd8ba3e362abec53c51ec1f 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -26,9 +26,6 @@
 #include <string.h>
 #include <errno.h>
 
-#ifdef NEED_MALLOC_H
-#include <malloc.h>
-#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index 908ffc580002f3ba92bc4ccd0d9b533262d154a3..d396d71039520e3d66d128705fd70eb8bef400f8 100644 (file)
@@ -30,9 +30,6 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <ctype.h>
-#ifdef NEED_MALLOC_H
-#include <malloc.h>
-#endif
 #include <errno.h>
 
 #ifdef CURL_LDAP_HYBRID         /* If W$ definitions are needed. */
index 3ed9116358b0938f650dbacde5cf2fd0f324e845..4c84247b1b386fec234af28f1eae99106f77cc0c 100644 (file)
@@ -8,7 +8,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -41,9 +41,6 @@
 #include <sys/socket.h>
 #endif
 #include <stdio.h>
-#ifdef HAVE_MEMORY_H
-#include <memory.h>
-#endif
 
 #define logfile curl_debuglogfile
 
index 90c5de14ffcff91261d403203463e9d47836b945..c1c8996310b0131aed11f33e12a93bca898b1b83 100644 (file)
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
 #include <sys/types.h>
 #endif
 
+#ifdef NEED_MALLOC_H
+#include <malloc.h>
+#endif
+
+#ifdef NEED_MEMORY_H
+#include <memory.h>
+#endif
+
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
index edf9c55533acb3b6bd97d8ac9785d9e00e8ad5b5..826e1383a4971b349bb54089cabff9b68189b8ca 100644 (file)
@@ -26,9 +26,6 @@
 #if !defined(CURL_DISABLE_PROXY) || defined(USE_WINDOWS_SSPI)
 #include <string.h>
 
-#ifdef NEED_MALLOC_H
-#include <malloc.h>
-#endif
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
index d948168d436bd9ba13d24fac3ee173cac6c9d6f9..8b5ccf714000ff7c0e91e568760aef48a36d0c19 100644 (file)
@@ -34,9 +34,6 @@
 #endif
 #include <string.h>
 
-#ifdef NEED_MALLOC_H
-#include <malloc.h>
-#endif
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
index 9798e8944aed187d9c7566a8e030a5789778d5fa..6feb422b91107fbc008101b1e755f55280f65fc2 100644 (file)
@@ -28,9 +28,6 @@
 
 #include <string.h>
 
-#ifdef NEED_MALLOC_H
-#include <malloc.h>
-#endif
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
index ad92543c149b97f19b29cdf387e4d0adc4e6ef3f..646ee9921f5b2113e3ab8b6391d94aabeb19b7fa 100644 (file)
 /* Define if you have the <memory.h> header file. */
 #define HAVE_MEMORY_H   1
 
+/* Define to 1 if you need the memory.h header file even with stdlib.h */
+#define NEED_MEMORY_H 1
+
 /* Define if you have the `sigsetjmp' function. */
 #define HAVE_SIGSETJMP 1