1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

Merge pull request #52 from dgl/stack-cleanup

Correct use of perl stack macros
This commit is contained in:
Alexander Færøy 2014-06-29 14:27:12 +02:00
commit aaa0cb6e03
6 changed files with 8 additions and 12 deletions

View File

@ -74,6 +74,10 @@ static char *perl_expando_event(PerlExpando *rec, SERVER_REC *server,
ret = NULL; ret = NULL;
if (SvTRUE(ERRSV)) { 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 */ /* make sure we don't get back here */
if (rec->script != NULL) if (rec->script != NULL)
script_unregister_expandos(rec->script); script_unregister_expandos(rec->script);
@ -82,9 +86,9 @@ static char *perl_expando_event(PerlExpando *rec, SERVER_REC *server,
} else if (retcount > 0) { } else if (retcount > 0) {
ret = g_strdup(POPp); ret = g_strdup(POPp);
*free_ret = TRUE; *free_ret = TRUE;
PUTBACK;
} }
PUTBACK;
FREETMPS; FREETMPS;
LEAVE; LEAVE;

View File

@ -249,9 +249,9 @@ void irssi_callXS(void (*subaddr)(pTHX_ CV* cv), CV *cv, SV **mark)
dSP; dSP;
PUSHMARK(mark); PUSHMARK(mark);
(*subaddr)(aTHX_ cv);
PUTBACK; PUTBACK;
(*subaddr)(aTHX_ cv);
} }
void perl_chatnet_fill_hash(HV *hv, CHATNET_REC *chatnet) void perl_chatnet_fill_hash(HV *hv, CHATNET_REC *chatnet)

View File

@ -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); perl_call_pv("Irssi::Core::destroy", G_VOID|G_EVAL|G_DISCARD);
SPAGAIN;
PUTBACK;
FREETMPS; FREETMPS;
LEAVE; LEAVE;
} }

View File

@ -345,7 +345,6 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
} }
} }
PUTBACK;
FREETMPS; FREETMPS;
LEAVE; LEAVE;
} }

View File

@ -69,7 +69,6 @@ static void perl_source_destroy(PERL_SOURCE_REC *rec)
static int perl_source_event(PERL_SOURCE_REC *rec) static int perl_source_event(PERL_SOURCE_REC *rec)
{ {
dSP; dSP;
int retcount;
ENTER; ENTER;
SAVETMPS; SAVETMPS;
@ -79,8 +78,7 @@ static int perl_source_event(PERL_SOURCE_REC *rec)
PUTBACK; PUTBACK;
perl_source_ref(rec); perl_source_ref(rec);
retcount = perl_call_sv(rec->func, G_EVAL|G_SCALAR); perl_call_sv(rec->func, G_EVAL|G_DISCARD);
SPAGAIN;
if (SvTRUE(ERRSV)) { if (SvTRUE(ERRSV)) {
char *error = g_strdup(SvPV_nolen(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) if (perl_source_unref(rec) && rec->once)
perl_source_destroy(rec); perl_source_destroy(rec);
PUTBACK;
FREETMPS; FREETMPS;
LEAVE; LEAVE;

View File

@ -90,7 +90,6 @@ static void perl_statusbar_event(char *function, SBAR_ITEM_REC *item,
} }
} }
PUTBACK;
FREETMPS; FREETMPS;
LEAVE; LEAVE;
} }