diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-25 19:01:56 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-26 08:53:22 +0200 |
commit | 0b2d9bcb9b04b7e7ac3c2f626422392383575d2b (patch) | |
tree | 177e487efc30717415402ba969b246de3f88b28d /src/plugins | |
parent | 1ad0b4b6699df50e0cc6a3c5d62ce3ac1f77440c (diff) | |
download | weechat-0b2d9bcb9b04b7e7ac3c2f626422392383575d2b.zip |
plugins: remove check of NULL pointers before calling weechat_hashtable_free() (issue #865)
Diffstat (limited to 'src/plugins')
40 files changed, 186 insertions, 373 deletions
diff --git a/src/plugins/exec/exec-buffer.c b/src/plugins/exec/exec-buffer.c index 76eeec11c..3e4cd3e66 100644 --- a/src/plugins/exec/exec-buffer.c +++ b/src/plugins/exec/exec-buffer.c @@ -189,8 +189,7 @@ exec_buffer_new (const char *name, int free_content, int clear_buffer, &exec_buffer_input_cb, NULL, NULL, &exec_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); /* failed to create buffer ? then return */ if (!new_buffer) diff --git a/src/plugins/exec/exec-command.c b/src/plugins/exec/exec-command.c index 66757da06..e2173f7de 100644 --- a/src/plugins/exec/exec-command.c +++ b/src/plugins/exec/exec-command.c @@ -644,8 +644,7 @@ error: free (shell); if (new_exec_cmd) exec_free (new_exec_cmd); - if (process_options) - weechat_hashtable_free (process_options); + weechat_hashtable_free (process_options); return WEECHAT_RC_ERROR; } diff --git a/src/plugins/fifo/fifo.c b/src/plugins/fifo/fifo.c index bdf06885b..a4fddedda 100644 --- a/src/plugins/fifo/fifo.c +++ b/src/plugins/fifo/fifo.c @@ -83,8 +83,7 @@ fifo_create () fifo_filename = weechat_string_eval_path_home ( weechat_config_string (fifo_config_file_path), NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); } if (!fifo_filename) diff --git a/src/plugins/fset/fset-buffer.c b/src/plugins/fset/fset-buffer.c index d4966f30e..2a6abfc32 100644 --- a/src/plugins/fset/fset-buffer.c +++ b/src/plugins/fset/fset-buffer.c @@ -1597,8 +1597,7 @@ fset_buffer_open () &fset_buffer_input_cb, NULL, NULL, &fset_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); if (!fset_buffer) return; diff --git a/src/plugins/fset/fset-command.c b/src/plugins/fset/fset-command.c index 7e60995ac..a24b9da7e 100644 --- a/src/plugins/fset/fset-command.c +++ b/src/plugins/fset/fset-command.c @@ -559,10 +559,8 @@ fset_command_run_set_cb (const void *pointer, void *data, condition_ok = (result && (strcmp (result, "1") == 0)); free (result); } - if (eval_extra_vars) - weechat_hashtable_free (eval_extra_vars); - if (eval_options) - weechat_hashtable_free (eval_options); + weechat_hashtable_free (eval_extra_vars); + weechat_hashtable_free (eval_options); /* check condition to trigger the fset buffer */ if (condition_ok) diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c index 4525ff6ef..0a2c825b5 100644 --- a/src/plugins/fset/fset-option.c +++ b/src/plugins/fset/fset-option.c @@ -1405,10 +1405,8 @@ fset_option_export (const char *filename, int with_help) fclose (file); - if (hashtable_pointers) - weechat_hashtable_free (hashtable_pointers); - if (hashtable_extra_vars) - weechat_hashtable_free (hashtable_extra_vars); + weechat_hashtable_free (hashtable_pointers); + weechat_hashtable_free (hashtable_extra_vars); free (filename2); return 1; diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index a07342ea1..015ab42c5 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -534,12 +534,9 @@ weechat_guile_api_string_eval_expression (SCM expr, SCM pointers, c_pointers, c_extra_vars, c_options); - if (c_pointers) - weechat_hashtable_free (c_pointers); - if (c_extra_vars) - weechat_hashtable_free (c_extra_vars); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_pointers); + weechat_hashtable_free (c_extra_vars); + weechat_hashtable_free (c_options); API_RETURN_STRING_FREE(result); } @@ -577,12 +574,9 @@ weechat_guile_api_string_eval_path_home (SCM path, SCM pointers, c_pointers, c_extra_vars, c_options); - if (c_pointers) - weechat_hashtable_free (c_pointers); - if (c_extra_vars) - weechat_hashtable_free (c_extra_vars); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_pointers); + weechat_hashtable_free (c_extra_vars); + weechat_hashtable_free (c_options); API_RETURN_STRING_FREE(result); } @@ -2024,8 +2018,7 @@ weechat_guile_api_key_bind (SCM context, SCM keys) num_keys = weechat_key_bind (API_SCM_TO_STRING(context), c_keys); - if (c_keys) - weechat_hashtable_free (c_keys); + weechat_hashtable_free (c_keys); API_RETURN_INT(num_keys); } @@ -2679,8 +2672,7 @@ weechat_guile_api_hook_process_hashtable (SCM command, SCM options, SCM timeout, API_SCM_TO_STRING(function), API_SCM_TO_STRING(data))); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_options); API_RETURN_STRING(result); } @@ -2754,8 +2746,7 @@ weechat_guile_api_hook_url (SCM url, SCM options, SCM timeout, API_SCM_TO_STRING(function), API_SCM_TO_STRING(data))); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_options); API_RETURN_STRING(result); } @@ -3170,8 +3161,7 @@ weechat_guile_api_hook_hsignal_send (SCM signal, SCM hashtable) rc = weechat_hook_hsignal_send (API_SCM_TO_STRING(signal), c_hashtable); - if (c_hashtable) - weechat_hashtable_free (c_hashtable); + weechat_hashtable_free (c_hashtable); API_RETURN_INT(rc); } @@ -3695,8 +3685,7 @@ weechat_guile_api_buffer_new_props (SCM name, SCM properties, API_SCM_TO_STRING(function_close), API_SCM_TO_STRING(data_close))); - if (c_properties) - weechat_hashtable_free (c_properties); + weechat_hashtable_free (c_properties); API_RETURN_STRING(result); } @@ -4504,8 +4493,7 @@ weechat_guile_api_command_options (SCM buffer, SCM command, SCM options) API_SCM_TO_STRING(command), c_options); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_options); API_RETURN_INT(rc); } @@ -4626,10 +4614,8 @@ weechat_guile_api_info_get_hashtable (SCM info_name, SCM hash) c_hashtable); result_alist = weechat_guile_hashtable_to_alist (result_hashtable); - if (c_hashtable) - weechat_hashtable_free (c_hashtable); - if (result_hashtable) - weechat_hashtable_free (result_hashtable); + weechat_hashtable_free (c_hashtable); + weechat_hashtable_free (result_hashtable); API_RETURN_OTHER(result_alist); } @@ -5083,12 +5069,9 @@ weechat_guile_api_hdata_search (SCM hdata, SCM pointer, SCM search, c_options, scm_to_int (move))); - if (c_pointers) - weechat_hashtable_free (c_pointers); - if (c_extra_vars) - weechat_hashtable_free (c_extra_vars); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_pointers); + weechat_hashtable_free (c_extra_vars); + weechat_hashtable_free (c_options); API_RETURN_STRING(result); } @@ -5271,8 +5254,7 @@ weechat_guile_api_hdata_update (SCM hdata, SCM pointer, SCM hashtable) API_STR2PTR(API_SCM_TO_STRING(pointer)), c_hashtable); - if (c_hashtable) - weechat_hashtable_free (c_hashtable); + weechat_hashtable_free (c_hashtable); API_RETURN_INT(value); } diff --git a/src/plugins/irc/irc-batch.c b/src/plugins/irc/irc-batch.c index d0ede5db1..a2346f8d7 100644 --- a/src/plugins/irc/irc-batch.c +++ b/src/plugins/irc/irc-batch.c @@ -185,8 +185,7 @@ irc_batch_free (struct t_irc_server *server, struct t_irc_batch *batch) free (batch->parent_ref); free (batch->type); free (batch->parameters); - if (batch->tags) - weechat_hashtable_free (batch->tags); + weechat_hashtable_free (batch->tags); if (batch->messages) weechat_string_dyn_free (batch->messages, 1); @@ -456,8 +455,7 @@ irc_batch_process_multiline (struct t_irc_server *server, } end: - if (hash_tags) - weechat_hashtable_free (hash_tags); + weechat_hashtable_free (hash_tags); if (list_messages) weechat_string_free_split (list_messages); diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 683325fe9..ddf3f81e3 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -402,8 +402,7 @@ irc_channel_create_buffer (struct t_irc_server *server, } end: - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); free (buffer_name); return ptr_buffer; } @@ -1541,8 +1540,7 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel) free (channel->topic); free (channel->modes); free (channel->key); - if (channel->join_msg_received) - weechat_hashtable_free (channel->join_msg_received); + weechat_hashtable_free (channel->join_msg_received); free (channel->away_message); free (channel->pv_remote_nick_color); weechat_unhook (channel->hook_autorejoin); @@ -1551,8 +1549,7 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel) if (channel->nicks_speaking[1]) weechat_list_free (channel->nicks_speaking[1]); irc_channel_nick_speaking_time_free_all (channel); - if (channel->join_smart_filtered) - weechat_hashtable_free (channel->join_smart_filtered); + weechat_hashtable_free (channel->join_smart_filtered); free (channel->buffer_as_string); free (channel); diff --git a/src/plugins/irc/irc-list.c b/src/plugins/irc/irc-list.c index 9806bffb3..abef27d57 100644 --- a/src/plugins/irc/irc-list.c +++ b/src/plugins/irc/irc-list.c @@ -956,8 +956,7 @@ irc_list_create_buffer (struct t_irc_server *server) &irc_input_data_cb, NULL, NULL, &irc_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); irc_list_buffer_set_localvar_filter (buffer, server); diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c index 7aac2d54f..0ab77202f 100644 --- a/src/plugins/irc/irc-raw.c +++ b/src/plugins/irc/irc-raw.c @@ -123,8 +123,7 @@ irc_raw_message_match_filter (struct t_irc_raw_message *raw_message, hashtable, irc_raw_filter_hashtable_options); match = (result && (strcmp (result, "1") == 0)) ? 1 : 0; - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); free (result); return match; } @@ -407,8 +406,7 @@ irc_raw_open (int switch_to_buffer) buffer_props, &irc_input_data_cb, NULL, NULL, &irc_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); /* failed to create buffer ? then return */ if (!irc_raw_buffer) diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c index 69b04e2c3..456c03581 100644 --- a/src/plugins/irc/irc-redirect.c +++ b/src/plugins/irc/irc-redirect.c @@ -770,8 +770,7 @@ irc_redirect_stop (struct t_irc_redirect *redirect, const char *error) redirect->signal, redirect->pattern); (void) weechat_hook_hsignal_send (signal_name, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); irc_redirect_free (redirect); } @@ -977,14 +976,10 @@ irc_redirect_free (struct t_irc_redirect *redirect) free (redirect->signal); free (redirect->string); free (redirect->command); - if (redirect->cmd_start) - weechat_hashtable_free (redirect->cmd_start); - if (redirect->cmd_stop) - weechat_hashtable_free (redirect->cmd_stop); - if (redirect->cmd_extra) - weechat_hashtable_free (redirect->cmd_extra); - if (redirect->cmd_filter) - weechat_hashtable_free (redirect->cmd_filter); + weechat_hashtable_free (redirect->cmd_start); + weechat_hashtable_free (redirect->cmd_stop); + weechat_hashtable_free (redirect->cmd_extra); + weechat_hashtable_free (redirect->cmd_filter); free (redirect->output); free (redirect); diff --git a/src/plugins/irc/irc-sasl.c b/src/plugins/irc/irc-sasl.c index 6c5343fe2..75f7e252c 100644 --- a/src/plugins/irc/irc-sasl.c +++ b/src/plugins/irc/irc-sasl.c @@ -473,8 +473,7 @@ irc_sasl_get_key_content (const char *sasl_key, char **sasl_error) if (options) weechat_hashtable_set (options, "directory", "config"); key_path = weechat_string_eval_path_home (sasl_key, NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); if (key_path) content = weechat_file_get_content (key_path); diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index d6051b2c7..066f11ab3 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -378,10 +378,8 @@ irc_server_eval_expression (struct t_irc_server *server, const char *string) value = weechat_string_eval_expression (string, pointers, extra_vars, NULL); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); return value; } @@ -1582,8 +1580,7 @@ irc_server_get_default_msg (const char *default_msg, msg = weechat_string_eval_expression (default_msg, NULL, extra_vars, NULL); - if (extra_vars) - weechat_hashtable_free (extra_vars); + weechat_hashtable_free (extra_vars); return msg; } @@ -2310,10 +2307,8 @@ irc_server_free_data (struct t_irc_server *server) free (server->nick); free (server->nick_modes); free (server->host); - if (server->cap_ls) - weechat_hashtable_free (server->cap_ls); - if (server->cap_list) - weechat_hashtable_free (server->cap_list); + weechat_hashtable_free (server->cap_ls); + weechat_hashtable_free (server->cap_list); free (server->isupport); free (server->prefix_modes); free (server->prefix_chars); @@ -4763,8 +4758,7 @@ irc_server_create_buffer (struct t_irc_server *server) buffer_props, &irc_input_data_cb, NULL, NULL, &irc_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); if (!server->buffer) return NULL; @@ -5248,8 +5242,7 @@ irc_server_gnutls_callback (const void *pointer, void *data, weechat_hashtable_set (options, "directory", "config"); cert_path = weechat_string_eval_path_home (ptr_cert_path, NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); if (cert_path) { cert_str = weechat_file_get_content (cert_path); diff --git a/src/plugins/irc/irc-tag.c b/src/plugins/irc/irc-tag.c index 4ec61dea0..45851d330 100644 --- a/src/plugins/irc/irc-tag.c +++ b/src/plugins/irc/irc-tag.c @@ -429,8 +429,7 @@ irc_tag_add_tags_to_message (const char *message, struct t_hashtable *tags) end: free (msg_str_tags); - if (msg_hash_tags) - weechat_hashtable_free (msg_hash_tags); + weechat_hashtable_free (msg_hash_tags); free (new_tags); return (result) ? weechat_string_dyn_free (result, 0) : NULL; diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index abecb6aa9..f96ff34f2 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -97,10 +97,8 @@ logger_check_conditions (struct t_gui_buffer *buffer, const char *conditions) condition_ok = (result && (strcmp (result, "1") == 0)); free (result); - if (pointers) - weechat_hashtable_free (pointers); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (options); return condition_ok; } @@ -137,8 +135,7 @@ logger_get_file_path () weechat_hashtable_set (options, "directory", "data"); path = weechat_string_eval_path_home ( weechat_config_string (logger_config_file_path), NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); if (!path) goto end; diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index 5f10bf34e..356d769fa 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -526,12 +526,9 @@ API_FUNC(string_eval_expression) result = weechat_string_eval_expression (expr, pointers, extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -563,12 +560,9 @@ API_FUNC(string_eval_path_home) result = weechat_string_eval_path_home (path, pointers, extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -2116,8 +2110,7 @@ API_FUNC(key_bind) num_keys = weechat_key_bind (context, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(num_keys); } @@ -2832,8 +2825,7 @@ API_FUNC(hook_process_hashtable) function, data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -2908,8 +2900,7 @@ API_FUNC(hook_url) function, data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -3335,8 +3326,7 @@ API_FUNC(hook_hsignal_send) rc = weechat_hook_hsignal_send (signal, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(rc); } @@ -3880,8 +3870,7 @@ API_FUNC(buffer_new_props) function_close, data_close)); - if (properties) - weechat_hashtable_free (properties); + weechat_hashtable_free (properties); API_RETURN_STRING(result); } @@ -4767,8 +4756,7 @@ API_FUNC(command_options) command, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_INT(rc); } @@ -4899,10 +4887,8 @@ API_FUNC(info_get_hashtable) weechat_lua_pushhashtable (L, result_hashtable); - if (table) - weechat_hashtable_free (table); - if (result_hashtable) - weechat_hashtable_free (result_hashtable); + weechat_hashtable_free (table); + weechat_hashtable_free (result_hashtable); return 1; } @@ -5400,12 +5386,9 @@ API_FUNC(hdata_search) options, move)); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -5614,8 +5597,7 @@ API_FUNC(hdata_update) API_STR2PTR(pointer), hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(value); } diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index 0531ec0de..0c547c28a 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -483,12 +483,9 @@ API_FUNC(string_eval_expression) result = weechat_string_eval_expression (expr, pointers, extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -520,12 +517,9 @@ API_FUNC(string_eval_path_home) result = weechat_string_eval_path_home (path, pointers, extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -2023,8 +2017,7 @@ API_FUNC(key_bind) num_keys = weechat_key_bind (context, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(num_keys); } @@ -2712,8 +2705,7 @@ API_FUNC(hook_process_hashtable) function, data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -2787,8 +2779,7 @@ API_FUNC(hook_url) function, data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -3215,8 +3206,7 @@ API_FUNC(hook_hsignal_send) rc = weechat_hook_hsignal_send (signal, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(rc); } @@ -3769,8 +3759,7 @@ API_FUNC(buffer_new_props) function_close, data_close)); - if (properties) - weechat_hashtable_free (properties); + weechat_hashtable_free (properties); API_RETURN_STRING(result); } @@ -4665,8 +4654,7 @@ API_FUNC(command_options) API_STR2PTR(buffer), command, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_INT(rc); } @@ -4799,10 +4787,8 @@ API_FUNC(info_get_hashtable) result_hashtable = weechat_info_get_hashtable (info_name, hashtable); result_hash = weechat_perl_hashtable_to_hash (result_hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); - if (result_hashtable) - weechat_hashtable_free (result_hashtable); + weechat_hashtable_free (hashtable); + weechat_hashtable_free (result_hashtable); API_RETURN_OBJ(result_hash); } @@ -5314,12 +5300,9 @@ API_FUNC(hdata_search) options, move)); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -5538,8 +5521,7 @@ API_FUNC(hdata_update) API_STR2PTR(pointer), hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(value); } diff --git a/src/plugins/php/weechat-php-api.c b/src/plugins/php/weechat-php-api.c index 72dcfe948..709704191 100644 --- a/src/plugins/php/weechat-php-api.c +++ b/src/plugins/php/weechat-php-api.c @@ -627,12 +627,9 @@ API_FUNC(string_eval_expression) extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -672,12 +669,9 @@ API_FUNC(string_eval_path_home) extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -2199,8 +2193,7 @@ API_FUNC(key_bind) result = weechat_key_bind ((const char *)context, keys); - if (keys) - weechat_hashtable_free (keys); + weechat_hashtable_free (keys); API_RETURN_INT(result); } @@ -2870,8 +2863,7 @@ API_FUNC(hook_process_hashtable) (const char *)callback_name, (const char *)data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -2932,8 +2924,7 @@ API_FUNC(hook_url) (const char *)callback_name, (const char *)data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -3261,8 +3252,7 @@ API_FUNC(hook_hsignal_send) result = weechat_hook_hsignal_send ((const char *)signal, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(result); } @@ -3741,8 +3731,7 @@ API_FUNC(buffer_new_props) (const char *)close_callback_name, (const char *)data_close)); - if (properties) - weechat_hashtable_free (properties); + weechat_hashtable_free (properties); API_RETURN_STRING(result); } @@ -4737,8 +4726,7 @@ API_FUNC(command_options) (const char *)command, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_INT(result); } @@ -4886,8 +4874,7 @@ API_FUNC(info_get_hashtable) result = weechat_info_get_hashtable ((const char *)info_name, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); weechat_php_hashtable_to_array (result, return_value); } @@ -5467,12 +5454,9 @@ API_FUNC(hdata_search) options, move)); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -5704,8 +5688,7 @@ API_FUNC(hdata_update) result = weechat_hdata_update (hdata, pointer, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(result); } diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index 6677a9717..e23c7356f 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -544,8 +544,7 @@ plugin_api_modifier_eval_path_home_cb (const void *pointer, void *data, result = string_eval_path_home (string, NULL, NULL, options); - if (options) - hashtable_free (options); + hashtable_free (options); return result; } diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 01edcf744..0f77ac3c6 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -1087,8 +1087,7 @@ plugin_auto_load (char *force_plugin_autoload, hashtable_set (options, "directory", "data"); plugin_path = string_eval_path_home (CONFIG_STRING(config_plugin_path), NULL, NULL, options); - if (options) - hashtable_free (options); + hashtable_free (options); if (plugin_path) { dir_exec_on_files (plugin_path, 1, 0, diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index ca9757234..7ce78ee90 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -477,12 +477,9 @@ API_FUNC(string_eval_expression) WEECHAT_HASHTABLE_STRING); result = weechat_string_eval_expression (expr, pointers, extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -515,12 +512,9 @@ API_FUNC(string_eval_path_home) WEECHAT_HASHTABLE_STRING); result = weechat_string_eval_path_home (path, pointers, extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -2025,8 +2019,7 @@ API_FUNC(key_bind) num_keys = weechat_key_bind (context, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(num_keys); } @@ -2736,8 +2729,7 @@ API_FUNC(hook_process_hashtable) &weechat_python_api_hook_process_cb, function, data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -2814,8 +2806,7 @@ API_FUNC(hook_url) &weechat_python_api_hook_url_cb, function, data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -3243,8 +3234,7 @@ API_FUNC(hook_hsignal_send) rc = weechat_hook_hsignal_send (signal, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(rc); } @@ -3792,8 +3782,7 @@ API_FUNC(buffer_new_props) function_close, data_close)); - if (properties) - weechat_hashtable_free (properties); + weechat_hashtable_free (properties); API_RETURN_STRING(result); } @@ -4654,8 +4643,7 @@ API_FUNC(command_options) API_STR2PTR(buffer), command, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_INT(rc); } @@ -4785,10 +4773,8 @@ API_FUNC(info_get_hashtable) result_hashtable = weechat_info_get_hashtable (info_name, hashtable); result_dict = weechat_python_hashtable_to_dict (result_hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); - if (result_hashtable) - weechat_hashtable_free (result_hashtable); + weechat_hashtable_free (hashtable); + weechat_hashtable_free (result_hashtable); return result_dict; } @@ -5275,12 +5261,9 @@ API_FUNC(hdata_search) options, move)); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -5484,8 +5467,7 @@ API_FUNC(hdata_update) API_STR2PTR(pointer), hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(value); } diff --git a/src/plugins/relay/api/remote/relay-remote-network.c b/src/plugins/relay/api/remote/relay-remote-network.c index eb6f4fb3c..3e9fbd583 100644 --- a/src/plugins/relay/api/remote/relay-remote-network.c +++ b/src/plugins/relay/api/remote/relay-remote-network.c @@ -1445,7 +1445,6 @@ error: remote->name); free (url); free (body); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); return 0; } diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c index c9fd0234f..ddb8516a4 100644 --- a/src/plugins/relay/irc/relay-irc.c +++ b/src/plugins/relay/irc/relay-irc.c @@ -187,9 +187,7 @@ relay_irc_message_parse (const char *message) } end: - if (hash_msg) - weechat_hashtable_free (hash_msg); - + weechat_hashtable_free (hash_msg); return hash_parsed; } @@ -290,10 +288,8 @@ relay_irc_sendf (struct t_relay_client *client, const char *format, ...) end: free (new_msg1); - if (hashtable_in) - weechat_hashtable_free (hashtable_in); - if (hashtable_out) - weechat_hashtable_free (hashtable_out); + weechat_hashtable_free (hashtable_in); + weechat_hashtable_free (hashtable_out); free (vbuffer); } @@ -2161,8 +2157,7 @@ relay_irc_recv (struct t_relay_client *client, const char *data) end: free (new_data); - if (hash_parsed) - weechat_hashtable_free (hash_parsed); + weechat_hashtable_free (hash_parsed); free (params); } diff --git a/src/plugins/relay/relay-buffer.c b/src/plugins/relay/relay-buffer.c index e2759dbf6..88466a08b 100644 --- a/src/plugins/relay/relay-buffer.c +++ b/src/plugins/relay/relay-buffer.c @@ -284,6 +284,5 @@ relay_buffer_open () &relay_buffer_input_cb, NULL, NULL, &relay_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); } diff --git a/src/plugins/relay/relay-http.c b/src/plugins/relay/relay-http.c index 37af1846f..0d90ff4bc 100644 --- a/src/plugins/relay/relay-http.c +++ b/src/plugins/relay/relay-http.c @@ -1337,13 +1337,10 @@ relay_http_request_free (struct t_relay_http_request *request) free (request->path); if (request->path_items) weechat_string_free_split (request->path_items); - if (request->params) - weechat_hashtable_free (request->params); + weechat_hashtable_free (request->params); free (request->http_version); - if (request->headers) - weechat_hashtable_free (request->headers); - if (request->accept_encoding) - weechat_hashtable_free (request->accept_encoding); + weechat_hashtable_free (request->headers); + weechat_hashtable_free (request->accept_encoding); if (request->ws_deflate) relay_websocket_deflate_free (request->ws_deflate); free (request->body); @@ -1588,8 +1585,7 @@ relay_http_response_free (struct t_relay_http_response *response) { free (response->http_version); free (response->message); - if (response->headers) - weechat_hashtable_free (response->headers); + weechat_hashtable_free (response->headers); free (response->body); free (response); diff --git a/src/plugins/relay/relay-network.c b/src/plugins/relay/relay-network.c index b0dd1c6dd..f00b073b4 100644 --- a/src/plugins/relay/relay-network.c +++ b/src/plugins/relay/relay-network.c @@ -81,8 +81,7 @@ relay_network_set_tls_cert_key (int verbose) weechat_hashtable_set (options, "directory", "config"); certkey_path = weechat_string_eval_path_home (ptr_path, NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); if (certkey_path && certkey_path[0]) { diff --git a/src/plugins/relay/relay-raw.c b/src/plugins/relay/relay-raw.c index 6453d1344..ebb6c5797 100644 --- a/src/plugins/relay/relay-raw.c +++ b/src/plugins/relay/relay-raw.c @@ -101,8 +101,7 @@ relay_raw_open (int switch_to_buffer) buffer_props, &relay_buffer_input_cb, NULL, NULL, &relay_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); /* failed to create buffer ? then return */ if (!relay_raw_buffer) diff --git a/src/plugins/relay/relay-server.c b/src/plugins/relay/relay-server.c index 0cfe1c394..7e80bdb7a 100644 --- a/src/plugins/relay/relay-server.c +++ b/src/plugins/relay/relay-server.c @@ -851,8 +851,7 @@ relay_server_new (const char *protocol_string, enum t_relay_protocol protocol, weechat_hashtable_set (options, "directory", "runtime"); new_server->path = weechat_string_eval_path_home (path, NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); new_server->ipv4 = ipv4; new_server->ipv6 = ipv6; new_server->tls = tls; @@ -900,8 +899,7 @@ relay_server_update_path (struct t_relay_server *server, const char *path) if (options) weechat_hashtable_set (options, "directory", "runtime"); new_path = weechat_string_eval_path_home (path, NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); if (!new_path) return; diff --git a/src/plugins/relay/weechat/relay-weechat.c b/src/plugins/relay/weechat/relay-weechat.c index 4a2b022a6..d9ded8e66 100644 --- a/src/plugins/relay/weechat/relay-weechat.c +++ b/src/plugins/relay/weechat/relay-weechat.c @@ -317,13 +317,11 @@ relay_weechat_free (struct t_relay_client *client) if (client->protocol_data) { - if (RELAY_WEECHAT_DATA(client, buffers_sync)) - weechat_hashtable_free (RELAY_WEECHAT_DATA(client, buffers_sync)); + weechat_hashtable_free (RELAY_WEECHAT_DATA(client, buffers_sync)); weechat_unhook (RELAY_WEECHAT_DATA(client, hook_signal_buffer)); weechat_unhook (RELAY_WEECHAT_DATA(client, hook_hsignal_nicklist)); weechat_unhook (RELAY_WEECHAT_DATA(client, hook_signal_upgrade)); - if (RELAY_WEECHAT_DATA(client, buffers_nicklist)) - weechat_hashtable_free (RELAY_WEECHAT_DATA(client, buffers_nicklist)); + weechat_hashtable_free (RELAY_WEECHAT_DATA(client, buffers_nicklist)); weechat_unhook (RELAY_WEECHAT_DATA(client, hook_timer_nicklist)); free (client->protocol_data); diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index 9d0bde678..01729432b 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -584,12 +584,9 @@ weechat_ruby_api_string_eval_expression (VALUE class, VALUE expr, result = weechat_string_eval_expression (c_expr, c_pointers, c_extra_vars, c_options); - if (c_pointers) - weechat_hashtable_free (c_pointers); - if (c_extra_vars) - weechat_hashtable_free (c_extra_vars); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_pointers); + weechat_hashtable_free (c_extra_vars); + weechat_hashtable_free (c_options); API_RETURN_STRING_FREE(result); } @@ -633,12 +630,9 @@ weechat_ruby_api_string_eval_path_home (VALUE class, VALUE path, result = weechat_string_eval_path_home (c_path, c_pointers, c_extra_vars, c_options); - if (c_pointers) - weechat_hashtable_free (c_pointers); - if (c_extra_vars) - weechat_hashtable_free (c_extra_vars); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_pointers); + weechat_hashtable_free (c_extra_vars); + weechat_hashtable_free (c_options); API_RETURN_STRING_FREE(result); } @@ -2504,8 +2498,7 @@ weechat_ruby_api_key_bind (VALUE class, VALUE context, VALUE keys) num_keys = weechat_key_bind (c_context, c_keys); - if (c_keys) - weechat_hashtable_free (c_keys); + weechat_hashtable_free (c_keys); API_RETURN_INT(num_keys); } @@ -3360,8 +3353,7 @@ weechat_ruby_api_hook_process_hashtable (VALUE class, VALUE command, c_function, c_data)); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_options); API_RETURN_STRING(result); } @@ -3446,8 +3438,7 @@ weechat_ruby_api_hook_url (VALUE class, VALUE url, c_function, c_data)); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_options); API_RETURN_STRING(result); } @@ -3930,8 +3921,7 @@ weechat_ruby_api_hook_hsignal_send (VALUE class, VALUE signal, VALUE hashtable) rc = weechat_hook_hsignal_send (c_signal, c_hashtable); - if (c_hashtable) - weechat_hashtable_free (c_hashtable); + weechat_hashtable_free (c_hashtable); API_RETURN_INT(rc); } @@ -4570,8 +4560,7 @@ weechat_ruby_api_buffer_new_props (VALUE class, VALUE name, VALUE properties, c_function_close, c_data_close)); - if (c_properties) - weechat_hashtable_free (c_properties); + weechat_hashtable_free (c_properties); API_RETURN_STRING(result); } @@ -5698,8 +5687,7 @@ weechat_ruby_api_command_options (VALUE class, VALUE buffer, VALUE command, c_command, c_options); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_options); API_RETURN_INT(rc); } @@ -5868,10 +5856,8 @@ weechat_ruby_api_info_get_hashtable (VALUE class, VALUE info_name, result_hashtable = weechat_info_get_hashtable (c_info_name, c_hashtable); result_hash = weechat_ruby_hashtable_to_hash (result_hashtable); - if (c_hashtable) - weechat_hashtable_free (c_hashtable); - if (result_hashtable) - weechat_hashtable_free (result_hashtable); + weechat_hashtable_free (c_hashtable); + weechat_hashtable_free (result_hashtable); return result_hash; } @@ -6498,12 +6484,9 @@ weechat_ruby_api_hdata_search (VALUE class, VALUE hdata, VALUE pointer, c_options, c_move)); - if (c_pointers) - weechat_hashtable_free (c_pointers); - if (c_extra_vars) - weechat_hashtable_free (c_extra_vars); - if (c_options) - weechat_hashtable_free (c_options); + weechat_hashtable_free (c_pointers); + weechat_hashtable_free (c_extra_vars); + weechat_hashtable_free (c_options); API_RETURN_STRING(result); } @@ -6778,8 +6761,7 @@ weechat_ruby_api_hdata_update (VALUE class, VALUE hdata, VALUE pointer, API_STR2PTR(c_pointer), c_hashtable); - if (c_hashtable) - weechat_hashtable_free (c_hashtable); + weechat_hashtable_free (c_hashtable); API_RETURN_INT(value); } diff --git a/src/plugins/script/script-buffer.c b/src/plugins/script/script-buffer.c index 8854d6e70..bd24af0b6 100644 --- a/src/plugins/script/script-buffer.c +++ b/src/plugins/script/script-buffer.c @@ -1179,8 +1179,7 @@ script_buffer_open () &script_buffer_input_cb, NULL, NULL, &script_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); if (!script_buffer) return; diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c index 80fa7fbe2..4ed83b507 100644 --- a/src/plugins/script/script-config.c +++ b/src/plugins/script/script-config.c @@ -174,8 +174,7 @@ script_config_get_xml_filename () weechat_hashtable_set (options, "directory", "cache"); path = weechat_string_eval_path_home ( weechat_config_string (script_config_scripts_path), NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); length = strlen (path) + 64; filename = malloc (length); if (filename) @@ -208,8 +207,7 @@ script_config_get_script_download_filename (struct t_script_repo *script, weechat_hashtable_set (options, "directory", "cache"); path = weechat_string_eval_path_home ( weechat_config_string (script_config_scripts_path), NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); length = strlen (path) + 1 + strlen (script->name_with_extension) + ((suffix) ? strlen (suffix) : 0) + 1; filename = malloc (length); diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c index 657ebbced..e1405e47f 100644 --- a/src/plugins/script/script-repo.c +++ b/src/plugins/script/script-repo.c @@ -1391,8 +1391,7 @@ script_repo_file_read (int quiet) script_repo_free (script); free (locale); free (locale_language); - if (descriptions) - weechat_hashtable_free (descriptions); + weechat_hashtable_free (descriptions); return 1; } diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index d1c0ab14d..487ad5d97 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -527,12 +527,9 @@ API_FUNC(string_eval_expression) result = weechat_string_eval_expression (expr, pointers, extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -566,12 +563,9 @@ API_FUNC(string_eval_path_home) result = weechat_string_eval_path_home (path, pointers, extra_vars, options); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING_FREE(result); } @@ -2052,8 +2046,7 @@ API_FUNC(key_bind) num_keys = weechat_key_bind (context, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(num_keys); } @@ -2786,8 +2779,7 @@ API_FUNC(hook_process_hashtable) function, data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -2864,8 +2856,7 @@ API_FUNC(hook_url) function, data)); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -3298,8 +3289,7 @@ API_FUNC(hook_hsignal_send) rc = weechat_hook_hsignal_send (signal, hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(rc); } @@ -3840,8 +3830,7 @@ API_FUNC(buffer_new_props) function_close, data_close)); - if (properties) - weechat_hashtable_free (properties); + weechat_hashtable_free (properties); API_RETURN_STRING(result); } @@ -4706,8 +4695,7 @@ API_FUNC(command_options) command, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); API_RETURN_INT(rc); } @@ -4824,10 +4812,8 @@ API_FUNC(info_get_hashtable) hashtable); result_dict = weechat_tcl_hashtable_to_dict (interp, result_hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); - if (result_hashtable) - weechat_hashtable_free (result_hashtable); + weechat_hashtable_free (hashtable); + weechat_hashtable_free (result_hashtable); API_RETURN_OBJ(result_dict); } @@ -5298,12 +5284,9 @@ API_FUNC(hdata_search) options, move)); - if (pointers) - weechat_hashtable_free (pointers); - if (extra_vars) - weechat_hashtable_free (extra_vars); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (pointers); + weechat_hashtable_free (extra_vars); + weechat_hashtable_free (options); API_RETURN_STRING(result); } @@ -5517,8 +5500,7 @@ API_FUNC(hdata_update) API_STR2PTR(pointer), hashtable); - if (hashtable) - weechat_hashtable_free (hashtable); + weechat_hashtable_free (hashtable); API_RETURN_INT(value); } diff --git a/src/plugins/trigger/trigger-buffer.c b/src/plugins/trigger/trigger-buffer.c index 70c404cfe..3d7daa8d4 100644 --- a/src/plugins/trigger/trigger-buffer.c +++ b/src/plugins/trigger/trigger-buffer.c @@ -227,8 +227,7 @@ trigger_buffer_open (const char *filter, int switch_to_buffer) buffer_props, &trigger_buffer_input_cb, NULL, NULL, &trigger_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); } /* failed to create buffer ? then return */ diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c index 196f7a221..2c72a0c0c 100644 --- a/src/plugins/trigger/trigger.c +++ b/src/plugins/trigger/trigger.c @@ -463,8 +463,7 @@ trigger_hook (struct t_trigger *trigger) free (eval_args); free (eval_desc_args); free (eval_completion); - if (extra_vars) - weechat_hashtable_free (extra_vars); + weechat_hashtable_free (extra_vars); } } break; diff --git a/src/plugins/xfer/xfer-buffer.c b/src/plugins/xfer/xfer-buffer.c index d01199486..1cf032ba9 100644 --- a/src/plugins/xfer/xfer-buffer.c +++ b/src/plugins/xfer/xfer-buffer.c @@ -367,6 +367,5 @@ xfer_buffer_open () &xfer_buffer_input_cb, NULL, NULL, &xfer_buffer_close_cb, NULL, NULL); - if (buffer_props) - weechat_hashtable_free (buffer_props); + weechat_hashtable_free (buffer_props); } diff --git a/src/plugins/xfer/xfer-file.c b/src/plugins/xfer/xfer-file.c index 6c39c69ae..8b42931a5 100644 --- a/src/plugins/xfer/xfer-file.c +++ b/src/plugins/xfer/xfer-file.c @@ -276,8 +276,7 @@ xfer_file_find_filename (struct t_xfer *xfer) path = weechat_string_eval_path_home ( weechat_config_string (xfer_config_file_download_path), NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); if (!path) return; diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index b0c437239..7f6fb9995 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -186,8 +186,7 @@ xfer_create_directories () free (path); } - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); } /* @@ -1110,8 +1109,7 @@ xfer_add_cb (const void *pointer, void *data, path = weechat_string_eval_path_home ( weechat_config_string (xfer_config_file_upload_path), NULL, NULL, options); - if (options) - weechat_hashtable_free (options); + weechat_hashtable_free (options); if (!path) { weechat_printf (NULL, |