diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-10-16 20:26:12 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-10-16 20:26:12 +0000 |
commit | f619c4603ea7c4dcd66fe67ce6ff76502af11865 (patch) | |
tree | b87c1fc37be02631be2b586bf52c0d6c9ba03778 /configure.in | |
parent | 56a592dbe36701bbfdc262866d35ed34a265925e (diff) | |
download | tor-f619c4603ea7c4dcd66fe67ce6ff76502af11865.tar.gz tor-f619c4603ea7c4dcd66fe67ce6ff76502af11865.zip |
Add an autoconf test to make sure that memset(&ptr, 0, sizeof(ptr)) and ptr=NULL are equivalent
svn:r2536
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/configure.in b/configure.in index 9e4051c828..0cf8a7d538 100644 --- a/configure.in +++ b/configure.in @@ -195,6 +195,21 @@ if test $tor_cv_unaligned_ok = yes; then [Define to 1 iff unaligned int access is allowed]) fi +# Now make sure that NULL can be represented as zero bytes. +AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero, +[AC_RUN_IFELSE([AC_LANG_SOURCE( +[[#include <stdlib.h> +int main () { char *p1,*p2; p1=NULL; memset(&p2,0,sizeof(p2)); +return memcmp(&p1,&p2,sizeof(char*)); }]])], + [tor_cv_null_is_zero=yes], + [tor_cv_null_is_zero=no], + [tor_cv_null_is_zero=cross])]) + +if test $tor_cv_null_is_zero = yes; then + AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1, + [Define to 1 iff memset(0) sets pointers to NULL]) +fi + # $prefix stores the value of the --prefix command line option, or # NONE if the option wasn't set. In the case that it wasn't set, make # it be the default, so that we can use it to expand directories now. |