Commit b69f5f3e authored by Nick Mathewson's avatar Nick Mathewson 🌉
Browse files

Add an autoconf test for whether unaligned int access is permitted.

It works on macos, and works correctly when I twiddle the test code to
generate a spurious segfault.  Will it work anywhere else?

parent f608b85d
......@@ -163,6 +163,19 @@ AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
# Now, let's see about alignment requirements
AC_CACHE_CHECK([whether unaligned int access is allowed], tor_cv_unaligned_ok,
[[int main () { char s[] = "A\x00\x00\x00\x00\x00\x00\x00";
return *(int*)(&s[1]); }]])],
if test tor_cv_unaligned_ok = yes; then
[Define to 1 iff unaligned int access is allowed])
# $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.
......@@ -86,7 +86,7 @@ void tor_strlower(char *s)
uint16_t get_uint16(char *cp)
uint16_t v;
......@@ -43,7 +43,7 @@ char *tor_strndup(const char *s, size_t n);
#define tor_free(p) do {if(p) {free(p); (p)=NULL;}} while(0)
void tor_strlower(char *s);
/* XXX Not actually used yet, but would probably be faster on non-sun
* hardare.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment