void weechat_ruby_unload (struct t_plugin_script *script) { int *rc; void *interpreter; if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet) { weechat_printf (NULL, weechat_gettext ("%s: unloading script \"%s\""), RUBY_PLUGIN_NAME, script->name); } if (script->shutdown_func && script->shutdown_func[0]) { rc = (int *)weechat_ruby_exec (script, WEECHAT_SCRIPT_EXEC_INT, script->shutdown_func, 0, NULL); if (rc) free (rc); } interpreter = script->interpreter; if (ruby_current_script == script) ruby_current_script = (ruby_current_script->prev_script) ? ruby_current_script->prev_script : ruby_current_script->next_script; script_remove (weechat_ruby_plugin, &ruby_scripts, &last_ruby_script, script); if (interpreter) rb_gc_unregister_address (interpreter); }
void weechat_ruby_unload (struct t_plugin_script *script) { int *rc; void *interpreter; char *filename; if ((weechat_ruby_plugin->debug >= 2) || !ruby_quiet) { weechat_printf (NULL, weechat_gettext ("%s: unloading script \"%s\""), RUBY_PLUGIN_NAME, script->name); } if (script->shutdown_func && script->shutdown_func[0]) { rc = (int *)weechat_ruby_exec (script, WEECHAT_SCRIPT_EXEC_INT, script->shutdown_func, 0, NULL); if (rc) free (rc); } filename = strdup (script->filename); interpreter = script->interpreter; if (ruby_current_script == script) ruby_current_script = (ruby_current_script->prev_script) ? ruby_current_script->prev_script : ruby_current_script->next_script; plugin_script_remove (weechat_ruby_plugin, &ruby_scripts, &last_ruby_script, script); if (interpreter) rb_gc_unregister_address (interpreter); (void) weechat_hook_signal_send ("ruby_script_unloaded", WEECHAT_HOOK_SIGNAL_STRING, filename); if (filename) free (filename); }