diff options
author | Richard Leach <richardleach@users.noreply.github.com> | 2022-02-15 01:35:32 +0000 |
---|---|---|
committer | xenu <me@xenu.pl> | 2022-03-07 01:08:53 +0100 |
commit | 7ea8b04b5a0e6952b7ffd5a8fd96468b72da6bea (patch) | |
tree | e86b130304536d6351f130102602d02f52b4d834 /gv.c | |
parent | 8fcb24256a3027cbca7c100825eb3805586fe1e5 (diff) | |
download | perl-7ea8b04b5a0e6952b7ffd5a8fd96468b72da6bea.tar.gz |
Perl_newSV_type_mortal - new inline function introduced and used
There's no efficient way to create a mortal SV of any type other than
SVt_NULL (via sv_newmortal). The options are either to do:
* SV* sv = sv_newmortal; sv_upgrade(sv, SVt_SOMETYPE);
but sv_upgrade is needlessly inefficient on new SVs.
* SV* sv = sv_2mortal(newSV_type(SVt_SOMETYPE)
but this will perform runtime checks to see if (sv) and if (SvIMMORTAL(sv),
and for a new SV we know that those answers will always be yes and no.
This commit adds a new inline function which is basically a mortalizing
wrapper around the now-inlined newSV_type.
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -3854,7 +3854,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) break; case G_LIST: if (flags & AMGf_want_list) { - res = sv_2mortal((SV *)newAV()); + res = newSV_type_mortal(SVt_PVAV); av_extend((AV *)res, nret); while (nret--) av_store((AV *)res, nret, POPs); |