bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new modules 'malloc-posix', 'realloc-posix', 'calloc-posix'


From: Eric Blake
Subject: Re: new modules 'malloc-posix', 'realloc-posix', 'calloc-posix'
Date: Mon, 10 Sep 2007 06:27:30 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 9/9/2007 7:14 AM:
> I take this as an OK to the proposal, so I'm committing the change, likewise
> for malloc and realloc, without the renaming of modules (for now).
> 
> # Test whether malloc, realloc, calloc are POSIX compliant,
> # Set gl_cv_func_malloc_posix to yes or no accordingly.
> AC_DEFUN([gl_CHECK_MALLOC_POSIX],
> [
>   AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant],
>     [gl_cv_func_malloc_posix],
>     [
>       dnl It is too dangerous to try to allocate a large amount of memory:
>       dnl some systems go to their knees when you do that. So assume that
>       dnl all Unix implementations of the function are POSIX compliant.
>       AC_TRY_COMPILE([],
>         [#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
>          choke me
>          #endif
>         ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no])

It looks like you got this backwards.  It is setting
gl_cv_func_malloc_posix=yes on mingw, no on cygwin, whereas it is only
mingw that is not posix-compliant.

> --- lib/malloc.c      9 Sep 2007 13:01:44 -0000       1.11
> --- 16,54 ----
>      along with this program; if not, write to the Free Software Foundation,
>      Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
>   
> ! /* written by Jim Meyering and Bruno Haible */
>   
>   #include <config.h>
> ! /* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h.  */
> ! #ifdef malloc
> ! # define NEED_MALLOC_GNU
> ! # undef malloc
> ! #endif

With the result that on cygwin, rpl_malloc ended up being instantiated,
and calling itself in infinite recursion, making it impossible to malloc
anything.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG5Tgy84KuGfSFAYARAosUAJsEJ6XztfDHj51uSir31xOHL0NZigCfZRym
t/9BgTLXYsFGoWhcwv+qfLk=
=Mw4j
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]