aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-08-05 17:52:51 +0000
committerNick Mathewson <nickm@torproject.org>2006-08-05 17:52:51 +0000
commit714d1b66aa077e75707715f8bacd4067afd95a7e (patch)
tree5e53c5d5b01c28ec901f87cb14ec61ce71f8a4b4
parent1ec5d1c05ca7322f18782ed0cbd8b4af78b0821a (diff)
downloadtor-714d1b66aa077e75707715f8bacd4067afd95a7e.tar
tor-714d1b66aa077e75707715f8bacd4067afd95a7e.tar.gz
r7027@Kushana: nickm | 2006-08-04 13:06:48 -0700
Oops. Fix downcast macro. svn:r6985
-rw-r--r--src/or/or.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/or/or.h b/src/or/or.h
index b1a213a8d..dfdd8fe2e 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -776,8 +776,8 @@ typedef struct control_connection_t {
/** Cast a connection_t subtype pointer to a connection_t **/
#define TO_CONN(c) &(((c)->_base))
/** Helper macro: Given a pointer to to._base, of type from*, return &to. */
-#define DOWNCAST(from, to, ptr) \
- (to*) (((from*)(ptr)) - STRUCT_OFFSET(to, _base))
+#define DOWNCAST(to, ptr) \
+ (to*) (((char*)(ptr)) - STRUCT_OFFSET(to, _base))
/** Convert a connection_t* to an or_connection_t*; assert if the cast is
* invalid. */
@@ -795,22 +795,22 @@ control_connection_t *TO_CONTROL_CONN(connection_t *);
extern INLINE or_connection_t *TO_OR_CONN(connection_t *c)
{
tor_assert(c->magic == OR_CONNECTION_MAGIC);
- return DOWNCAST(connection_t, or_connection_t, c);
+ return DOWNCAST(or_connection_t, c);
}
extern INLINE dir_connection_t *TO_DIR_CONN(connection_t *c)
{
tor_assert(c->magic == DIR_CONNECTION_MAGIC);
- return DOWNCAST(connection_t, dir_connection_t, c);
+ return DOWNCAST(dir_connection_t, c);
}
extern INLINE edge_connection_t *TO_EDGE_CONN(connection_t *c)
{
tor_assert(c->magic == EDGE_CONNECTION_MAGIC);
- return DOWNCAST(connection_t, edge_connection_t, c);
+ return DOWNCAST(edge_connection_t, c);
}
extern INLINE control_connection_t *TO_CONTROL_CONN(connection_t *c)
{
tor_assert(c->magic == CONTROL_CONNECTION_MAGIC);
- return DOWNCAST(connection_t, control_connection_t, c);
+ return DOWNCAST(control_connection_t, c);
}
typedef enum {
@@ -1305,14 +1305,14 @@ extern INLINE or_circuit_t *TO_OR_CIRCUIT(circuit_t *x)
{
tor_assert(x->magic == OR_CIRCUIT_MAGIC);
//return (or_circuit_t*) (((char*)x) - STRUCT_OFFSET(or_circuit_t, _base));
- return DOWNCAST(circuit_t, or_circuit_t, x);
+ return DOWNCAST(or_circuit_t, x);
}
extern INLINE origin_circuit_t *TO_ORIGIN_CIRCUIT(circuit_t *x)
{
tor_assert(x->magic == ORIGIN_CIRCUIT_MAGIC);
//return (origin_circuit_t*)
// (((char*)x) - STRUCT_OFFSET(origin_circuit_t, _base));
- return DOWNCAST(circuit_t, origin_circuit_t, x);
+ return DOWNCAST(origin_circuit_t, x);
}
#define ALLOW_INVALID_ENTRY 1