diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-01-30 19:25:31 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-01-30 19:25:31 +0000 |
commit | b4ebe55d12d46c79ac46c801b1096ae1afda75f7 (patch) | |
tree | b94101a6730f5183881a16ae90079891298ef61c /src | |
parent | 0b0654662010a14579ce9c8dac9a1719d8c47160 (diff) | |
download | tor-b4ebe55d12d46c79ac46c801b1096ae1afda75f7.tar.gz tor-b4ebe55d12d46c79ac46c801b1096ae1afda75f7.zip |
r13971@tombo: nickm | 2008-01-30 14:25:25 -0500
Write a new autoconf macro to test whether a function is declared. It is suboptimal and possibly buggy in some way, but it seems to work for me. use it to test for a declaration of malloc_good_size, so we can workaround operating systems (like older OSX) that have the function in their libc but do not deign to declare it in their headers. Should resolve bug 587.
svn:r13339
Diffstat (limited to 'src')
-rw-r--r-- | src/common/util.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c index 8f08c9b6af..0623093e64 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -224,6 +224,14 @@ _tor_free(void *mem) tor_free(mem); } +#if defined(HAVE_MALLOC_GOOD_SIZE) && !defined(HAVE_MALLOC_GOOD_SIZE_PROTOTYPE) +/* Some version of Mac OSX have malloc_good_size in their libc, but not + * actually defined in malloc/malloc.h. We detect this and work around it by + * prototyping. + */ +extern size_t malloc_good_size(size_t size); +#endif + /** Allocate and return a chunk of memory of size at least *<b>size</p>, using * the same resources we would use to malloc *<b>sizep</b>. Set *<b>sizep</b> * to the number of usable bytes in the chunk of memory. */ |