mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Updated perl API version. Fixed irssi to behave better if the API doesn't
match (doesn't crash). git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1985 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
571f3acaf8
commit
ea03650b3f
@ -1,5 +1,7 @@
|
||||
#include "module.h"
|
||||
|
||||
static int initialized = FALSE;
|
||||
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
PROTOTYPES: ENABLE
|
||||
@ -7,12 +9,16 @@ PROTOTYPES: ENABLE
|
||||
void
|
||||
init()
|
||||
CODE:
|
||||
if (initialized) return;
|
||||
perl_api_version_check("Irssi");
|
||||
initialized = TRUE;
|
||||
|
||||
perl_settings_init();
|
||||
|
||||
void
|
||||
deinit()
|
||||
CODE:
|
||||
if (!initialized) return;
|
||||
perl_settings_deinit();
|
||||
|
||||
BOOT:
|
||||
|
@ -21,5 +21,5 @@ extern PerlInterpreter *my_perl; /* must be called my_perl or some perl implemen
|
||||
#define MODULE_NAME "perl/core"
|
||||
|
||||
/* Change this every time when some API changes between irssi's perl module
|
||||
and irssi's perl libraries. */
|
||||
#define IRSSI_PERL_API_VERSION 20011021
|
||||
(or irssi itself) and irssi's perl libraries. */
|
||||
#define IRSSI_PERL_API_VERSION 20011111
|
||||
|
@ -141,6 +141,9 @@ void perl_scripts_init(void)
|
||||
/* Destroy all perl scripts and deinitialize perl interpreter */
|
||||
void perl_scripts_deinit(void)
|
||||
{
|
||||
if (my_perl == NULL)
|
||||
return;
|
||||
|
||||
/* destroy all scripts */
|
||||
while (perl_scripts != NULL)
|
||||
perl_script_destroy(perl_scripts->data);
|
||||
@ -417,7 +420,7 @@ static void sig_script_error(PERL_SCRIPT_REC *script, const char *error)
|
||||
}
|
||||
}
|
||||
|
||||
static void sig_autorun()
|
||||
static void sig_autorun(void)
|
||||
{
|
||||
signal_remove("irssi init finished", (SIGNAL_FUNC) sig_autorun);
|
||||
|
||||
|
@ -41,14 +41,9 @@ int perl_get_api_version(void);
|
||||
/* Checks that the API version is correct. */
|
||||
#define perl_api_version_check(library) \
|
||||
if (perl_get_api_version() != IRSSI_PERL_API_VERSION) { \
|
||||
char *str; \
|
||||
str = g_strdup_printf("Version of perl module (%d) " \
|
||||
"doesn't match the version of " \
|
||||
library" library (%d)", \
|
||||
perl_get_api_version(), \
|
||||
IRSSI_PERL_API_VERSION); \
|
||||
signal_emit("gui dialog", 2, "error", str); \
|
||||
g_free(str); \
|
||||
die("Version of perl module (%d) doesn't match the " \
|
||||
"version of "library" library (%d)", \
|
||||
perl_get_api_version(), IRSSI_PERL_API_VERSION); \
|
||||
return; \
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "module.h"
|
||||
|
||||
static int initialized = FALSE;
|
||||
|
||||
static void perl_main_window_fill_hash(HV *hv, MAIN_WINDOW_REC *window)
|
||||
{
|
||||
hv_store(hv, "active", 6, plain_bless(window->active, "Irssi::UI::Window"), 0);
|
||||
@ -87,8 +89,6 @@ PROTOTYPES: ENABLE
|
||||
|
||||
void
|
||||
init()
|
||||
PREINIT:
|
||||
static int initialized = FALSE;
|
||||
CODE:
|
||||
if (initialized) return;
|
||||
perl_api_version_check("Irssi::TextUI");
|
||||
@ -100,6 +100,7 @@ CODE:
|
||||
void
|
||||
deinit()
|
||||
CODE:
|
||||
if (!initialized) return;
|
||||
perl_statusbar_deinit();
|
||||
|
||||
MODULE = Irssi::TextUI PACKAGE = Irssi
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "module.h"
|
||||
|
||||
static int initialized = FALSE;
|
||||
|
||||
static void perl_process_fill_hash(HV *hv, PROCESS_REC *process)
|
||||
{
|
||||
hv_store(hv, "id", 2, newSViv(process->id), 0);
|
||||
@ -70,8 +72,6 @@ PROTOTYPES: ENABLE
|
||||
|
||||
void
|
||||
init()
|
||||
PREINIT:
|
||||
static int initialized = FALSE;
|
||||
CODE:
|
||||
if (initialized) return;
|
||||
perl_api_version_check("Irssi::UI");
|
||||
@ -83,6 +83,7 @@ CODE:
|
||||
void
|
||||
deinit()
|
||||
CODE:
|
||||
if (!initialized) return;
|
||||
perl_themes_deinit();
|
||||
|
||||
BOOT:
|
||||
|
Loading…
Reference in New Issue
Block a user