diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/guile/weechat-guile-api.c | 17 | ||||
-rw-r--r-- | src/plugins/guile/weechat-guile.c | 45 |
2 files changed, 19 insertions, 43 deletions
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index 535b0707f..a07342ea1 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -83,8 +83,7 @@ return return_value #define API_RETURN_STRING_FREE(__string) \ return_value = scm_from_locale_string ((__string) ? __string : ""); \ - if (__string) \ - free (__string); \ + free (__string); \ API_FREE_STRINGS; \ return return_value #define API_RETURN_INT(__int) \ @@ -145,8 +144,7 @@ weechat_guile_api_free_strings (char *guile_strings[], int *guile_num_strings) for (i = 0; i < *guile_num_strings; i++) { - if (guile_strings[i]) - free (guile_strings[i]); + free (guile_strings[i]); } *guile_num_strings = 0; @@ -1306,9 +1304,7 @@ weechat_guile_api_config_option_change_cb (const void *pointer, void *data, WEECHAT_SCRIPT_EXEC_IGNORE, ptr_function, "ss", func_argv); - - if (rc) - free (rc); + free (rc); } } @@ -1333,9 +1329,7 @@ weechat_guile_api_config_option_delete_cb (const void *pointer, void *data, WEECHAT_SCRIPT_EXEC_IGNORE, ptr_function, "ss", func_argv); - - if (rc) - free (rc); + free (rc); } } @@ -2944,8 +2938,7 @@ weechat_guile_api_hook_print_cb (const void *pointer, void *data, ret = *rc; free (rc); } - if (func_argv[3]) - free (func_argv[3]); + free (func_argv[3]); return ret; } diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c index c909070d9..ca219a75b 100644 --- a/src/plugins/guile/weechat-guile.c +++ b/src/plugins/guile/weechat-guile.c @@ -311,10 +311,8 @@ weechat_guile_alist_to_hashtable (SCM alist, int size, const char *type_keys, str = scm_to_locale_string (scm_list_ref (pair, scm_from_int (0))); str2 = scm_to_locale_string (scm_list_ref (pair, scm_from_int (1))); weechat_hashtable_set (hashtable, str, str2); - if (str) - free (str); - if (str2) - free (str2); + free (str); + free (str2); } else if (strcmp (type_values, WEECHAT_HASHTABLE_POINTER) == 0) { @@ -323,10 +321,8 @@ weechat_guile_alist_to_hashtable (SCM alist, int size, const char *type_keys, weechat_hashtable_set (hashtable, str, plugin_script_str2ptr (weechat_guile_plugin, NULL, NULL, str2)); - if (str) - free (str); - if (str2) - free (str2); + free (str); + free (str2); } } @@ -633,8 +629,7 @@ weechat_guile_unload (struct t_plugin_script *script) { rc = (int *)weechat_guile_exec (script, WEECHAT_SCRIPT_EXEC_INT, script->shutdown_func, NULL, NULL); - if (rc) - free (rc); + free (rc); } filename = strdup (script->filename); @@ -655,8 +650,7 @@ weechat_guile_unload (struct t_plugin_script *script) (void) weechat_hook_signal_send ("guile_script_unloaded", WEECHAT_HOOK_SIGNAL_STRING, filename); - if (filename) - free (filename); + free (filename); } /* @@ -772,8 +766,7 @@ weechat_guile_eval (struct t_gui_buffer *buffer, int send_to_buffer_as_input, "script_guile_eval", "s", func_argv); /* result is ignored */ - if (result) - free (result); + free (result); weechat_guile_output_flush (); @@ -879,8 +872,7 @@ weechat_guile_command_cb (const void *pointer, void *data, ptr_name, 1); weechat_guile_load ((path_script) ? path_script : ptr_name, NULL); - if (path_script) - free (path_script); + free (path_script); } else if (weechat_strcmp (argv[1], "reload") == 0) { @@ -1358,21 +1350,12 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) weechat_guile_catch (scm_gc_unprotect_object, (void *)guile_module_weechat); /* free some data */ - if (guile_action_install_list) - { - free (guile_action_install_list); - guile_action_install_list = NULL; - } - if (guile_action_remove_list) - { - free (guile_action_remove_list); - guile_action_remove_list = NULL; - } - if (guile_action_autoload_list) - { - free (guile_action_autoload_list); - guile_action_autoload_list = NULL; - } + free (guile_action_install_list); + guile_action_install_list = NULL; + free (guile_action_remove_list); + guile_action_remove_list = NULL; + free (guile_action_autoload_list); + guile_action_autoload_list = NULL; weechat_string_dyn_free (guile_buffer_output, 1); guile_buffer_output = NULL; |