From f059a69312fbd5590ce8779fbb8a1db41d396d26 Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Sat, 1 Nov 2014 20:43:37 +0100 Subject: [PATCH] Remove unnecessary mortalization newRV(sv_newmortal()) is equivalent to newRV_noinc(newSV(0)): the former creates a new SV with refcount 1, schedules a decrement "soon" (the mortalization) and increments the refcount, the net result is a refcount of 1, which is what the latter does. --- plugins/psgi/psgi_loader.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/psgi/psgi_loader.c b/plugins/psgi/psgi_loader.c index c798408e..82a42033 100644 --- a/plugins/psgi/psgi_loader.c +++ b/plugins/psgi/psgi_loader.c @@ -25,10 +25,10 @@ XS(XS_error) { psgi_check_args(0); if (uwsgi.threads > 1) { - ST(0) = sv_bless(newRV(sv_newmortal()), ((HV **)wi->error)[wsgi_req->async_id]); + ST(0) = sv_bless(newRV_noinc(newSV(0)), ((HV **)wi->error)[wsgi_req->async_id]); } else { - ST(0) = sv_bless(newRV(sv_newmortal()), ((HV **)wi->error)[0]); + ST(0) = sv_bless(newRV_noinc(newSV(0)), ((HV **)wi->error)[0]); } XSRETURN(1); } @@ -41,10 +41,10 @@ XS(XS_input) { psgi_check_args(0); if (uwsgi.threads > 1) { - ST(0) = sv_bless(newRV(sv_newmortal()), ((HV **)wi->input)[wsgi_req->async_id]); + ST(0) = sv_bless(newRV_noinc(newSV(0)), ((HV **)wi->input)[wsgi_req->async_id]); } else { - ST(0) = sv_bless(newRV(sv_newmortal()), ((HV **)wi->input)[0]); + ST(0) = sv_bless(newRV_noinc(newSV(0)), ((HV **)wi->input)[0]); } XSRETURN(1); } @@ -80,10 +80,10 @@ XS(XS_stream) SvREFCNT_dec(response); if (uwsgi.threads > 1) { - ST(0) = sv_bless(newRV(sv_newmortal()), ((HV **)wi->stream)[wsgi_req->async_id]); + ST(0) = sv_bless(newRV_noinc(newSV(0)), ((HV **)wi->stream)[wsgi_req->async_id]); } else { - ST(0) = sv_bless(newRV(sv_newmortal()), ((HV **)wi->stream)[0]); + ST(0) = sv_bless(newRV_noinc(newSV(0)), ((HV **)wi->stream)[0]); } XSRETURN(1); }