diff --git a/main/channel.c b/main/channel.c index 53fe35fa09b20bb2161c4b5a6571c4505f27a270..2ba4d3d108200a049586b5d06bae32270f53c4c5 100644 --- a/main/channel.c +++ b/main/channel.c @@ -395,21 +395,20 @@ int ast_channel_cmpwhentohangup(struct ast_channel *chan, time_t offset) { time_t whentohangup; - if (chan->whentohangup == 0) { + if (!chan->whentohangup) return (offset == 0) ? 0 : -1; - } else { - if (offset == 0) /* XXX why is this special ? */ - return (1); - else { - whentohangup = offset + time (NULL); - if (chan->whentohangup < whentohangup) - return (1); - else if (chan->whentohangup == whentohangup) - return (0); - else - return (-1); - } - } + + if (!offset) /* XXX why is this special? */ + return 1; + + whentohangup = offset + time(NULL); + + if (chan->whentohangup < whentohangup) + return 1; + else if (chan->whentohangup == whentohangup) + return 0; + else + return -1; } /*! \brief Register a new telephony channel in Asterisk */