diff options
author | Yang Tse <yangsita@gmail.com> | 2009-04-21 10:26:58 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2009-04-21 10:26:58 +0000 |
commit | 9770899a4bfb27ea73d0b0ee4be857ea1e47c4fd (patch) | |
tree | 7966686f758d2545de81b434aa530d7f4bfe9094 | |
parent | fe8eeb5641b488f6a730dd8afd34e589edb9b2c3 (diff) | |
download | curl-9770899a4bfb27ea73d0b0ee4be857ea1e47c4fd.tar.gz |
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.
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | acinclude.m4 | 52 | ||||
-rw-r--r-- | ares/CHANGES | 5 | ||||
-rw-r--r-- | ares/acinclude.m4 | 52 | ||||
-rw-r--r-- | ares/ares_init.c | 3 | ||||
-rw-r--r-- | ares/configure.ac | 1 | ||||
-rw-r--r-- | ares/setup_once.h | 8 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | lib/curl_addrinfo.c | 3 | ||||
-rw-r--r-- | lib/hostares.c | 3 | ||||
-rw-r--r-- | lib/hostasyn.c | 3 | ||||
-rw-r--r-- | lib/hostip.c | 5 | ||||
-rw-r--r-- | lib/hostip4.c | 5 | ||||
-rw-r--r-- | lib/hostip6.c | 5 | ||||
-rw-r--r-- | lib/hostsyn.c | 5 | ||||
-rw-r--r-- | lib/hostthre.c | 5 | ||||
-rw-r--r-- | lib/ldap.c | 3 | ||||
-rw-r--r-- | lib/memdebug.h | 5 | ||||
-rw-r--r-- | lib/setup_once.h | 10 | ||||
-rw-r--r-- | lib/socks.c | 3 | ||||
-rw-r--r-- | lib/socks_gssapi.c | 3 | ||||
-rw-r--r-- | lib/socks_sspi.c | 3 | ||||
-rw-r--r-- | packages/vms/config-vms.h | 3 |
23 files changed, 143 insertions, 48 deletions
@@ -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 diff --git a/acinclude.m4 b/acinclude.m4 index c4b7a1395..4ed4f01be 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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 diff --git a/ares/CHANGES b/ares/CHANGES index 90ee71113..3fe0cf836 100644 --- a/ares/CHANGES +++ b/ares/CHANGES @@ -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. diff --git a/ares/acinclude.m4 b/ares/acinclude.m4 index 879643dc4..790d1c74b 100644 --- a/ares/acinclude.m4 +++ b/ares/acinclude.m4 @@ -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 diff --git a/ares/ares_init.c b/ares/ares_init.c index e8d9ab1d0..635efceed 100644 --- a/ares/ares_init.c +++ b/ares/ares_init.c @@ -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 diff --git a/ares/configure.ac b/ares/configure.ac index 67dc00771..aca5e9408 100644 --- a/ares/configure.ac +++ b/ares/configure.ac @@ -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( diff --git a/ares/setup_once.h b/ares/setup_once.h index 4f88d9994..bd5eba393 100644 --- a/ares/setup_once.h +++ b/ares/setup_once.h @@ -42,6 +42,14 @@ #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 diff --git a/configure.ac b/configure.ac index d9ff3de8c..14562efb7 100644 --- a/configure.ac +++ b/configure.ac @@ -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! diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index d5a6bc712..f88ea2a93 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -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 diff --git a/lib/hostares.c b/lib/hostares.c index 1198ac7d9..1998357a3 100644 --- a/lib/hostares.c +++ b/lib/hostares.c @@ -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 diff --git a/lib/hostasyn.c b/lib/hostasyn.c index 802698af0..211ff7234 100644 --- a/lib/hostasyn.c +++ b/lib/hostasyn.c @@ -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 diff --git a/lib/hostip.c b/lib/hostip.c index b4eb3583a..47d90aba9 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -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 diff --git a/lib/hostip4.c b/lib/hostip4.c index f7100417e..168405c19 100644 --- a/lib/hostip4.c +++ b/lib/hostip4.c @@ -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 diff --git a/lib/hostip6.c b/lib/hostip6.c index 833e50b93..e63e80670 100644 --- a/lib/hostip6.c +++ b/lib/hostip6.c @@ -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 diff --git a/lib/hostsyn.c b/lib/hostsyn.c index 0c09f7094..d0d1ce4aa 100644 --- a/lib/hostsyn.c +++ b/lib/hostsyn.c @@ -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 diff --git a/lib/hostthre.c b/lib/hostthre.c index 3aa1ccbce..e3958626b 100644 --- a/lib/hostthre.c +++ b/lib/hostthre.c @@ -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 diff --git a/lib/ldap.c b/lib/ldap.c index 908ffc580..d396d7103 100644 --- a/lib/ldap.c +++ b/lib/ldap.c @@ -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. */ diff --git a/lib/memdebug.h b/lib/memdebug.h index 3ed911635..4c84247b1 100644 --- a/lib/memdebug.h +++ b/lib/memdebug.h @@ -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 diff --git a/lib/setup_once.h b/lib/setup_once.h index 90c5de14f..c1c899631 100644 --- a/lib/setup_once.h +++ b/lib/setup_once.h @@ -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 @@ -49,6 +49,14 @@ #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 diff --git a/lib/socks.c b/lib/socks.c index edf9c5553..826e1383a 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -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 diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c index d948168d4..8b5ccf714 100644 --- a/lib/socks_gssapi.c +++ b/lib/socks_gssapi.c @@ -34,9 +34,6 @@ #endif #include <string.h> -#ifdef NEED_MALLOC_H -#include <malloc.h> -#endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif diff --git a/lib/socks_sspi.c b/lib/socks_sspi.c index 9798e8944..6feb422b9 100644 --- a/lib/socks_sspi.c +++ b/lib/socks_sspi.c @@ -28,9 +28,6 @@ #include <string.h> -#ifdef NEED_MALLOC_H -#include <malloc.h> -#endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif diff --git a/packages/vms/config-vms.h b/packages/vms/config-vms.h index ad92543c1..646ee9921 100644 --- a/packages/vms/config-vms.h +++ b/packages/vms/config-vms.h @@ -256,6 +256,9 @@ /* 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 |