Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef19dc6

Browse files
committed
Set up PLPerl trigger data using C code instead of Perl code.
This is an efficiency change, and means we now no longer have to run"out $_TD; local $_TD = shift;", which was especially pointless in the case ofnon-trigger functions where the passed value was always undef anyway.A tiny open issue is whether we should get rid of the $prolog argument ofmkfunc, and the corresponding pushed value, which is now just a constant "false".Tim Bunce, reviewed by Alex Hunsaker.
1 parent5273f21 commitef19dc6

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

‎src/pl/plperl/plperl.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,7 @@ plperl_create_sub(plperl_proc_desc *prodesc, char *s, Oid fn_oid)
14221422
EXTEND(SP,4);
14231423
PUSHs(sv_2mortal(newSVstring(subname)));
14241424
PUSHs(sv_2mortal(newRV_noinc((SV*)pragma_hv)));
1425-
PUSHs(sv_2mortal(newSVstring("our $_TD; local $_TD=shift;")));
1425+
PUSHs(&PL_sv_no);/* XXX is $prolog in mkfunc needed any more? */
14261426
PUSHs(sv_2mortal(newSVstring(s)));
14271427
PUTBACK;
14281428

@@ -1494,9 +1494,7 @@ plperl_call_perl_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo)
14941494
SAVETMPS;
14951495

14961496
PUSHMARK(SP);
1497-
EXTEND(sp,1+desc->nargs);
1498-
1499-
PUSHs(&PL_sv_undef);/* no trigger data */
1497+
EXTEND(sp,desc->nargs);
15001498

15011499
for (i=0;i<desc->nargs;i++)
15021500
{
@@ -1576,21 +1574,22 @@ plperl_call_perl_trigger_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo,
15761574
SV*td)
15771575
{
15781576
dSP;
1579-
SV*retval;
1580-
Trigger*tg_trigger;
1581-
inti;
1582-
intcount;
1577+
SV*retval,*TDsv;
1578+
inti,count;
1579+
Trigger*tg_trigger= ((TriggerData*)fcinfo->context)->tg_trigger;
15831580

15841581
ENTER;
15851582
SAVETMPS;
15861583

1587-
PUSHMARK(sp);
1584+
TDsv=get_sv("_TD",GV_ADD);
1585+
SAVESPTR(TDsv);/* local $_TD */
1586+
sv_setsv(TDsv,td);
15881587

1589-
XPUSHs(td);
1588+
PUSHMARK(sp);
1589+
EXTEND(sp,tg_trigger->tgnargs);
15901590

1591-
tg_trigger= ((TriggerData*)fcinfo->context)->tg_trigger;
15921591
for (i=0;i<tg_trigger->tgnargs;i++)
1593-
XPUSHs(sv_2mortal(newSVstring(tg_trigger->tgargs[i])));
1592+
PUSHs(sv_2mortal(newSVstring(tg_trigger->tgargs[i])));
15941593
PUTBACK;
15951594

15961595
/* Do NOT use G_KEEPERR here */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp