aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-27 15:00:11 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-27 15:28:44 -0400
commit4d81f5211b3c714edae6370bccc6873033c0092d (patch)
tree351446df167a5e80530a66dcb7b13c697fa19180 /src/common/compat.c
parent000de2f2ac4f740be8351673691371d78a5da7e9 (diff)
downloadtor-4d81f5211b3c714edae6370bccc6873033c0092d.tar.gz
tor-4d81f5211b3c714edae6370bccc6873033c0092d.zip
Move set/get_uint*() to inline functions in arch/bytes.h
Also move our ntohll/htonll functions.
Diffstat (limited to 'src/common/compat.c')
-rw-r--r--src/common/compat.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index e26591776e..033ffa6aee 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -227,71 +227,6 @@ tor_strtok_r_impl(char *str, const char *sep, char **lasts)
return start;
}
-/**
- * Read a 16-bit value beginning at <b>cp</b>. Equivalent to
- * *(uint16_t*)(cp), but will not cause segfaults on platforms that forbid
- * unaligned memory access.
- */
-uint16_t
-get_uint16(const void *cp)
-{
- uint16_t v;
- memcpy(&v,cp,2);
- return v;
-}
-/**
- * Read a 32-bit value beginning at <b>cp</b>. Equivalent to
- * *(uint32_t*)(cp), but will not cause segfaults on platforms that forbid
- * unaligned memory access.
- */
-uint32_t
-get_uint32(const void *cp)
-{
- uint32_t v;
- memcpy(&v,cp,4);
- return v;
-}
-/**
- * Read a 64-bit value beginning at <b>cp</b>. Equivalent to
- * *(uint64_t*)(cp), but will not cause segfaults on platforms that forbid
- * unaligned memory access.
- */
-uint64_t
-get_uint64(const void *cp)
-{
- uint64_t v;
- memcpy(&v,cp,8);
- return v;
-}
-
-/**
- * Set a 16-bit value beginning at <b>cp</b> to <b>v</b>. Equivalent to
- * *(uint16_t*)(cp) = v, but will not cause segfaults on platforms that forbid
- * unaligned memory access. */
-void
-set_uint16(void *cp, uint16_t v)
-{
- memcpy(cp,&v,2);
-}
-/**
- * Set a 32-bit value beginning at <b>cp</b> to <b>v</b>. Equivalent to
- * *(uint32_t*)(cp) = v, but will not cause segfaults on platforms that forbid
- * unaligned memory access. */
-void
-set_uint32(void *cp, uint32_t v)
-{
- memcpy(cp,&v,4);
-}
-/**
- * Set a 64-bit value beginning at <b>cp</b> to <b>v</b>. Equivalent to
- * *(uint64_t*)(cp) = v, but will not cause segfaults on platforms that forbid
- * unaligned memory access. */
-void
-set_uint64(void *cp, uint64_t v)
-{
- memcpy(cp,&v,8);
-}
-
/** Represents a lockfile on which we hold the lock. */
struct tor_lockfile_t {
/** Name of the file */