mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 15:43:32 +01:00
Add an autoconf test to make sure that memset(&ptr, 0, sizeof(ptr)) and ptr=NULL are equivalent
svn:r2536
This commit is contained in:
parent
56a592dbe3
commit
f619c4603e
15
configure.in
15
configure.in
@ -195,6 +195,21 @@ if test $tor_cv_unaligned_ok = yes; then
|
|||||||
[Define to 1 iff unaligned int access is allowed])
|
[Define to 1 iff unaligned int access is allowed])
|
||||||
fi
|
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
|
# $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
|
# 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.
|
# it be the default, so that we can use it to expand directories now.
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef NULL_REP_IS_ZERO_BYTES
|
||||||
|
#error "It seems your platform does not represent NULL as zero. We can't cope."
|
||||||
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER > 1300
|
#if _MSC_VER > 1300
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
@ -124,11 +124,13 @@
|
|||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
#undef HAVE_UNISTD_H
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Define to 1 iff unaligned int access is allowed */
|
||||||
|
#define NULL_REP_IS_ZERO_BYTES 1
|
||||||
|
|
||||||
/* Name of package */
|
/* Name of package */
|
||||||
#define PACKAGE "tor"
|
#define PACKAGE "tor"
|
||||||
|
|
||||||
/* Def
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
ine to the address where bug reports for this package should be sent. */
|
|
||||||
#undef PACKAGE_BUGREPORT
|
#undef PACKAGE_BUGREPORT
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
/* Define to the full name of this package. */
|
||||||
|
Loading…
Reference in New Issue
Block a user