aboutsummaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2018-01-08 21:43:18 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2018-01-08 22:16:57 +0100
commit4627ee82dd825690218317ab9e6a991c5afcfb42 (patch)
tree62023c5b4275882c63f2f1484ecc968f3823d694 /degesch.c
parent682f90e98979f25d1825d9311f596341e9a541e7 (diff)
downloadxK-4627ee82dd825690218317ab9e6a991c5afcfb42.tar.gz
xK-4627ee82dd825690218317ab9e6a991c5afcfb42.tar.xz
xK-4627ee82dd825690218317ab9e6a991c5afcfb42.zip
degesch: simplify a popular assertion
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/degesch.c b/degesch.c
index 74ce5e1..612722b 100644
--- a/degesch.c
+++ b/degesch.c
@@ -5975,8 +5975,7 @@ irc_get_buffer_for_message (struct server *s,
if (irc_is_channel (s, target))
{
struct channel *channel = str_map_find (&s->irc_channels, target);
- hard_assert ((channel && buffer) ||
- (channel && !buffer) || (!channel && !buffer));
+ hard_assert (channel || !buffer);
// This is weird
if (!channel)
@@ -6489,8 +6488,7 @@ irc_handle_join (struct server *s, const struct irc_message *msg)
struct channel *channel = str_map_find (&s->irc_channels, channel_name);
struct buffer *buffer = str_map_find (&s->irc_buffer_map, channel_name);
- hard_assert ((channel && buffer) ||
- (channel && !buffer) || (!channel && !buffer));
+ hard_assert (channel || !buffer);
// We've joined a new channel
if (!channel && irc_is_this_us (s, msg->prefix))
@@ -6554,8 +6552,7 @@ irc_handle_kick (struct server *s, const struct irc_message *msg)
struct user *user = str_map_find (&s->irc_users, target);
struct channel *channel = str_map_find (&s->irc_channels, channel_name);
struct buffer *buffer = str_map_find (&s->irc_buffer_map, channel_name);
- hard_assert ((channel && buffer) ||
- (channel && !buffer) || (!channel && !buffer));
+ hard_assert (channel || !buffer);
// It would be weird for this to be false
if (user && channel)
@@ -6609,8 +6606,7 @@ irc_handle_mode (struct server *s, const struct irc_message *msg)
{
struct channel *channel = str_map_find (&s->irc_channels, context);
struct buffer *buffer = str_map_find (&s->irc_buffer_map, context);
- hard_assert ((channel && buffer) ||
- (channel && !buffer) || (!channel && !buffer));
+ hard_assert (channel || !buffer);
int flags = 0;
if (channel
@@ -6821,8 +6817,7 @@ irc_handle_part (struct server *s, const struct irc_message *msg)
struct channel *channel = str_map_find (&s->irc_channels, channel_name);
struct buffer *buffer = str_map_find (&s->irc_buffer_map, channel_name);
- hard_assert ((channel && buffer) ||
- (channel && !buffer) || (!channel && !buffer));
+ hard_assert (channel || !buffer);
// It would be weird for this to be false
if (user && channel)
@@ -7055,8 +7050,7 @@ irc_handle_topic (struct server *s, const struct irc_message *msg)
struct channel *channel = str_map_find (&s->irc_channels, channel_name);
struct buffer *buffer = str_map_find (&s->irc_buffer_map, channel_name);
- hard_assert ((channel && buffer) ||
- (channel && !buffer) || (!channel && !buffer));
+ hard_assert (channel || !buffer);
// It would be is weird for this to be false
if (channel)
@@ -7388,8 +7382,7 @@ irc_handle_rpl_topic (struct server *s, const struct irc_message *msg)
struct channel *channel = str_map_find (&s->irc_channels, channel_name);
struct buffer *buffer = str_map_find (&s->irc_buffer_map, channel_name);
- hard_assert ((channel && buffer) ||
- (channel && !buffer) || (!channel && !buffer));
+ hard_assert (channel || !buffer);
if (channel)
{
@@ -7411,8 +7404,7 @@ irc_handle_rpl_channelmodeis (struct server *s, const struct irc_message *msg)
struct channel *channel = str_map_find (&s->irc_channels, channel_name);
struct buffer *buffer = str_map_find (&s->irc_buffer_map, channel_name);
- hard_assert ((channel && buffer) ||
- (channel && !buffer) || (!channel && !buffer));
+ hard_assert (channel || !buffer);
if (channel)
{
@@ -7449,8 +7441,7 @@ irc_handle_rpl_creationtime (struct server *s, const struct irc_message *msg)
struct channel *channel = str_map_find (&s->irc_channels, channel_name);
struct buffer *buffer = str_map_find (&s->irc_buffer_map, channel_name);
- hard_assert ((channel && buffer) ||
- (channel && !buffer) || (!channel && !buffer));
+ hard_assert (channel || !buffer);
if (buffer)
{
@@ -7475,8 +7466,7 @@ irc_handle_rpl_topicwhotime (struct server *s, const struct irc_message *msg)
struct channel *channel = str_map_find (&s->irc_channels, channel_name);
struct buffer *buffer = str_map_find (&s->irc_buffer_map, channel_name);
- hard_assert ((channel && buffer) ||
- (channel && !buffer) || (!channel && !buffer));
+ hard_assert (channel || !buffer);
if (buffer)
{