diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-25 00:21:54 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-26 08:41:44 +0200 |
commit | 529a22e342e9195bd0173877e707d74397f55d96 (patch) | |
tree | 56c6fb9d00bf630b8f78f978ab36af1240da3853 /src/plugins/irc | |
parent | 828ca37225bcff10d349cd1c65c50417a5e07f0f (diff) | |
download | weechat-529a22e342e9195bd0173877e707d74397f55d96.zip |
plugins: remove check of NULL pointers before calling weechat_unhook() (issue #865)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-channel.c | 3 | ||||
-rw-r--r-- | src/plugins/irc/irc-notify.c | 8 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 3 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 18 |
4 files changed, 10 insertions, 22 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index c052de77c..683325fe9 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -1545,8 +1545,7 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel) weechat_hashtable_free (channel->join_msg_received); free (channel->away_message); free (channel->pv_remote_nick_color); - if (channel->hook_autorejoin) - weechat_unhook (channel->hook_autorejoin); + weechat_unhook (channel->hook_autorejoin); if (channel->nicks_speaking[0]) weechat_list_free (channel->nicks_speaking[0]); if (channel->nicks_speaking[1]) diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c index d1178556f..8c1c57ac5 100644 --- a/src/plugins/irc/irc-notify.c +++ b/src/plugins/irc/irc-notify.c @@ -1252,9 +1252,7 @@ irc_notify_print_log (struct t_irc_server *server) void irc_notify_hook_timer_ison () { - if (irc_notify_timer_ison) - weechat_unhook (irc_notify_timer_ison); - + weechat_unhook (irc_notify_timer_ison); irc_notify_timer_ison = weechat_hook_timer ( 60 * 1000 * weechat_config_integer (irc_config_network_notify_check_ison), 0, 0, &irc_notify_timer_ison_cb, NULL, NULL); @@ -1267,9 +1265,7 @@ irc_notify_hook_timer_ison () void irc_notify_hook_timer_whois () { - if (irc_notify_timer_whois) - weechat_unhook (irc_notify_timer_whois); - + weechat_unhook (irc_notify_timer_whois); irc_notify_timer_whois = weechat_hook_timer ( 60 * 1000 * weechat_config_integer (irc_config_network_notify_check_whois), 0, 0, &irc_notify_timer_whois_cb, NULL, NULL); diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 20b6e9c31..57dcc9e03 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -1246,8 +1246,7 @@ IRC_PROTOCOL_CALLBACK(cap) irc_server_sendf (ctxt->server, 0, NULL, str_msg_auth_upper); free (str_msg_auth_upper); } - if (ctxt->server->hook_timer_sasl) - weechat_unhook (ctxt->server->hook_timer_sasl); + weechat_unhook (ctxt->server->hook_timer_sasl); timeout = IRC_SERVER_OPTION_INTEGER( ctxt->server, IRC_SERVER_OPTION_SASL_TIMEOUT); ctxt->server->hook_timer_sasl = weechat_hook_timer ( diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index c127f1013..d6051b2c7 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -2298,16 +2298,11 @@ irc_server_free_data (struct t_irc_server *server) free (server->retry_array); free (server->current_address); free (server->current_ip); - if (server->hook_connect) - weechat_unhook (server->hook_connect); - if (server->hook_fd) - weechat_unhook (server->hook_fd); - if (server->hook_timer_connection) - weechat_unhook (server->hook_timer_connection); - if (server->hook_timer_sasl) - weechat_unhook (server->hook_timer_sasl); - if (server->hook_timer_anti_flood) - weechat_unhook (server->hook_timer_anti_flood); + weechat_unhook (server->hook_connect); + weechat_unhook (server->hook_fd); + weechat_unhook (server->hook_timer_connection); + weechat_unhook (server->hook_timer_sasl); + weechat_unhook (server->hook_timer_anti_flood); irc_server_free_sasl_data (server); free (server->unterminated_message); if (server->nicks_array) @@ -4396,8 +4391,7 @@ irc_server_login (struct t_irc_server *server) (realname && realname[0]) ? realname : ((username2) ? username2 : "weechat")); free (username2); - if (server->hook_timer_connection) - weechat_unhook (server->hook_timer_connection); + weechat_unhook (server->hook_timer_connection); server->hook_timer_connection = weechat_hook_timer ( IRC_SERVER_OPTION_INTEGER (server, IRC_SERVER_OPTION_CONNECTION_TIMEOUT) * 1000, 0, 1, |