aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-05-23 08:23:03 +0000
committerNick Mathewson <nickm@torproject.org>2006-05-23 08:23:03 +0000
commit89a8411acec388612c71a0268752cbc0d5f958d4 (patch)
tree7ba1d7f7abdf839299a203eefd00a1a312cd7866 /src/common
parent13c4590dd19351f55e8eb6830e44d64897b72c73 (diff)
downloadtor-89a8411acec388612c71a0268752cbc0d5f958d4.tar
tor-89a8411acec388612c71a0268752cbc0d5f958d4.tar.gz
Throw out this UNALIGNED_INT_ACCESS_OK nonsense. Even where it works, it is often way way slower than doing the right thing. Backport candidate.
svn:r6473
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat.c2
-rw-r--r--src/common/compat.h11
2 files changed, 0 insertions, 13 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 3a05c32d4..3d70045eb 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -206,7 +206,6 @@ tor_fix_source_file(const char *fname)
}
#endif
-#ifndef UNALIGNED_INT_ACCESS_OK
/**
* Read a 16-bit value beginning at <b>cp</b>. Equivalent to
* *(uint16_t*)(cp), but will not cause segfaults on platforms that forbid
@@ -249,7 +248,6 @@ set_uint32(char *cp, uint32_t v)
{
memcpy(cp,&v,4);
}
-#endif
/**
* Rename the file <b>from</b> to the file <b>to</b>. On unix, this is
diff --git a/src/common/compat.h b/src/common/compat.h
index 8e570cb26..25876ef18 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -223,21 +223,10 @@ const char *tor_socket_strerror(int e);
/* ===== OS compatibility */
const char *get_uname(void);
-/* Some platforms segfault when you try to access a multi-byte type
- * that isn't aligned to a word boundary. The macros and/or functions
- * below can be used to access unaligned data on any platform.
- */
-#ifdef UNALIGNED_INT_ACCESS_OK
-#define get_uint16(cp) (*(uint16_t*)(cp))
-#define get_uint32(cp) (*(uint32_t*)(cp))
-#define set_uint16(cp,v) do { *(uint16_t*)(cp) = (v); } while (0)
-#define set_uint32(cp,v) do { *(uint32_t*)(cp) = (v); } while (0)
-#else
uint16_t get_uint16(const char *cp);
uint32_t get_uint32(const char *cp);
void set_uint16(char *cp, uint16_t v);
void set_uint32(char *cp, uint32_t v);
-#endif
int set_max_file_descriptors(unsigned long limit, unsigned long cap);
int switch_id(char *user, char *group);