summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@0x90.dk>2014-06-29 14:27:12 +0200
committerAlexander Færøy <ahf@0x90.dk>2014-06-29 14:27:12 +0200
commitaaa0cb6e031b067f4d94abda2ccfc2e0ed1ecf7c (patch)
treed912c830d8deebbca6d62ba10b0dc5423d6144c0 /src
parentcce0ff80a2080d551c706eab71ef0e3e5bf6e31f (diff)
parentc5d81c598d7872308725f4f20523a1c593d5ca9e (diff)
downloadirssi-aaa0cb6e031b067f4d94abda2ccfc2e0ed1ecf7c.zip
Merge pull request #52 from dgl/stack-cleanup
Correct use of perl stack macros
Diffstat (limited to 'src')
-rw-r--r--src/perl/common/Expando.xs6
-rw-r--r--src/perl/perl-common.c4
-rw-r--r--src/perl/perl-core.c3
-rw-r--r--src/perl/perl-signals.c1
-rw-r--r--src/perl/perl-sources.c5
-rw-r--r--src/perl/textui/Statusbar.xs1
6 files changed, 8 insertions, 12 deletions
diff --git a/src/perl/common/Expando.xs b/src/perl/common/Expando.xs
index 375a4c2f..e8e8f751 100644
--- a/src/perl/common/Expando.xs
+++ b/src/perl/common/Expando.xs
@@ -74,6 +74,10 @@ static char *perl_expando_event(PerlExpando *rec, SERVER_REC *server,
ret = NULL;
if (SvTRUE(ERRSV)) {
+ (void) POPs;
+ /* call putback before emitting script error signal as that
+ * could manipulate the perl stack. */
+ PUTBACK;
/* make sure we don't get back here */
if (rec->script != NULL)
script_unregister_expandos(rec->script);
@@ -82,9 +86,9 @@ static char *perl_expando_event(PerlExpando *rec, SERVER_REC *server,
} else if (retcount > 0) {
ret = g_strdup(POPp);
*free_ret = TRUE;
+ PUTBACK;
}
- PUTBACK;
FREETMPS;
LEAVE;
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c
index c5037ba6..1fbd000b 100644
--- a/src/perl/perl-common.c
+++ b/src/perl/perl-common.c
@@ -249,9 +249,9 @@ void irssi_callXS(void (*subaddr)(pTHX_ CV* cv), CV *cv, SV **mark)
dSP;
PUSHMARK(mark);
- (*subaddr)(aTHX_ cv);
-
PUTBACK;
+
+ (*subaddr)(aTHX_ cv);
}
void perl_chatnet_fill_hash(HV *hv, CHATNET_REC *chatnet)
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c
index d0606f38..eb1bddee 100644
--- a/src/perl/perl-core.c
+++ b/src/perl/perl-core.c
@@ -59,9 +59,6 @@ static void perl_script_destroy_package(PERL_SCRIPT_REC *script)
perl_call_pv("Irssi::Core::destroy", G_VOID|G_EVAL|G_DISCARD);
- SPAGAIN;
-
- PUTBACK;
FREETMPS;
LEAVE;
}
diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c
index d0670ba2..be4a9a5d 100644
--- a/src/perl/perl-signals.c
+++ b/src/perl/perl-signals.c
@@ -345,7 +345,6 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
}
}
- PUTBACK;
FREETMPS;
LEAVE;
}
diff --git a/src/perl/perl-sources.c b/src/perl/perl-sources.c
index 33fe6dd1..0b49a608 100644
--- a/src/perl/perl-sources.c
+++ b/src/perl/perl-sources.c
@@ -69,7 +69,6 @@ static void perl_source_destroy(PERL_SOURCE_REC *rec)
static int perl_source_event(PERL_SOURCE_REC *rec)
{
dSP;
- int retcount;
ENTER;
SAVETMPS;
@@ -79,8 +78,7 @@ static int perl_source_event(PERL_SOURCE_REC *rec)
PUTBACK;
perl_source_ref(rec);
- retcount = perl_call_sv(rec->func, G_EVAL|G_SCALAR);
- SPAGAIN;
+ perl_call_sv(rec->func, G_EVAL|G_DISCARD);
if (SvTRUE(ERRSV)) {
char *error = g_strdup(SvPV_nolen(ERRSV));
@@ -91,7 +89,6 @@ static int perl_source_event(PERL_SOURCE_REC *rec)
if (perl_source_unref(rec) && rec->once)
perl_source_destroy(rec);
- PUTBACK;
FREETMPS;
LEAVE;
diff --git a/src/perl/textui/Statusbar.xs b/src/perl/textui/Statusbar.xs
index d1241ae1..d904ae9f 100644
--- a/src/perl/textui/Statusbar.xs
+++ b/src/perl/textui/Statusbar.xs
@@ -90,7 +90,6 @@ static void perl_statusbar_event(char *function, SBAR_ITEM_REC *item,
}
}
- PUTBACK;
FREETMPS;
LEAVE;
}