summaryrefslogtreecommitdiff
path: root/src/perl
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2009-01-23 17:57:49 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2009-01-23 17:57:49 +0000
commitb12bd857a5d5e7561463a7eca76d07925c70a11b (patch)
tree4220b6c89e2c7b2d799edbbfb4bdde6531dc5706 /src/perl
parent1f7311272ab88485cc8c51a05baaea10ca776072 (diff)
downloadirssi-b12bd857a5d5e7561463a7eca76d07925c70a11b.zip
Call PERL_SYS_INIT3() and PERL_SYS_TERM() as documented in perlembed(1).
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4998 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/perl')
-rw-r--r--src/perl/perl-core.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c
index 4b837016..bb658714 100644
--- a/src/perl/perl-core.c
+++ b/src/perl/perl-core.c
@@ -38,6 +38,7 @@ GSList *perl_scripts;
PerlInterpreter *my_perl;
static int print_script_errors;
+static char *perl_args[] = {"", "-e", "0"};
#define IS_PERL_SCRIPT(file) \
(strlen(file) > 3 && strcmp(file+strlen(file)-3, ".pl") == 0)
@@ -111,7 +112,6 @@ static void xs_init(pTHX)
/* Initialize perl interpreter */
void perl_scripts_init(void)
{
- char *args[] = {"", "-e", "0"};
char *code, *use_code;
perl_scripts = NULL;
@@ -121,7 +121,7 @@ void perl_scripts_init(void)
my_perl = perl_alloc();
perl_construct(my_perl);
- perl_parse(my_perl, xs_init, 3, args, NULL);
+ perl_parse(my_perl, xs_init, G_N_ELEMENTS(perl_args), perl_args, NULL);
#if PERL_STATIC_LIBS == 1
perl_eval_pv("Irssi::Core::boot_Irssi_Core();", TRUE);
#endif
@@ -440,6 +440,10 @@ static void sig_autorun(void)
void perl_core_init(void)
{
+ int argc = G_N_ELEMENTS(perl_args);
+ char **argv = perl_args;
+
+ PERL_SYS_INIT3(&argc, &argv, &environ);
print_script_errors = 1;
settings_add_str("perl", "perl_use_lib", PERL_USE_LIB);
@@ -465,4 +469,5 @@ void perl_core_deinit(void)
perl_signals_deinit();
signal_remove("script error", (SIGNAL_FUNC) sig_script_error);
+ PERL_SYS_TERM();
}