summaryrefslogtreecommitdiff
path: root/src/or/control.h
diff options
context:
space:
mode:
authorteor <teor2345@gmail.com>2015-03-22 14:25:42 +1100
committerteor <teor2345@gmail.com>2015-03-22 14:25:42 +1100
commitb41a5039f1ee16ddbcb5cbef63d5ba9abf802834 (patch)
tree4e81637a08373263fcf3f7380e98122bb48c19ca /src/or/control.h
parent99c10a95e408f8800e373735fd9a1eca0acc4df8 (diff)
downloadtor-b41a5039f1ee16ddbcb5cbef63d5ba9abf802834.tar.gz
tor-b41a5039f1ee16ddbcb5cbef63d5ba9abf802834.zip
Compile-time check that control_event_t.event_mask is big enough
Add a compile-time check that the number of events doesn't exceed the capacity of control_event_t.event_mask.
Diffstat (limited to 'src/or/control.h')
-rw-r--r--src/or/control.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/or/control.h b/src/or/control.h
index 9b0362a9a5..dbb80b1f20 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -166,6 +166,10 @@ void control_free_all(void);
/* If EVENT_MAX_ ever hits 0x0040, we need to make the mask into a
* different structure, as it can only handle a maximum left shift of 1<<63. */
+#if EVENT_MAX_ >= EVENT_CAPACITY_
+#error control_connection_t.event_mask has an event greater than its capacity
+#endif
+
#define EVENT_MASK_(e) (((uint64_t)1)<<(e))
#define EVENT_MASK_NONE_ ((uint64_t)0x0)