summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2021-07-20 14:11:13 +0000
committerNicholas Clark <nick@ccl4.org>2021-07-26 07:06:00 +0000
commitbffed14d6aeedc70a2f799ef7c8fe1f5d608eb52 (patch)
treeef4f6c8e2a284bf3ea34d9c674462f9af55c8fae /op.c
parent0cdaae3e56c7eb2fab73f258cf564fe0d6d1b083 (diff)
downloadperl-bffed14d6aeedc70a2f799ef7c8fe1f5d608eb52.tar.gz
Where the key is an SV, replace some hv_* calls with hv_*_ent equivalents.
This avoids the SvUTF8(tmpstr) ? -(I32)SvCUR(tmpstr) : (I32)SvCUR(tmpstr) code dance.
Diffstat (limited to 'op.c')
-rw-r--r--op.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/op.c b/op.c
index f2d2619398..716055b980 100644
--- a/op.c
+++ b/op.c
@@ -11142,10 +11142,9 @@ Perl_newMYSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
sv_catpvn_flags(tmpstr, PadnamePV(name)+1, PadnameLEN(name)-1,
PadnameUTF8(name) ? SV_CATUTF8 : SV_CATBYTES);
- (void)hv_store(GvHV(PL_DBsub), SvPVX_const(tmpstr),
- SvUTF8(tmpstr) ? -(I32)SvCUR(tmpstr) : (I32)SvCUR(tmpstr), sv, 0);
+ (void)hv_store_ent(GvHV(PL_DBsub), tmpstr, sv, 0);
hv = GvHVn(db_postponed);
- if (HvTOTALKEYS(hv) > 0 && hv_exists(hv, SvPVX_const(tmpstr), SvUTF8(tmpstr) ? -(I32)SvCUR(tmpstr) : (I32)SvCUR(tmpstr))) {
+ if (HvTOTALKEYS(hv) > 0 && hv_exists_ent(hv, tmpstr, 0)) {
CV * const pcv = GvCV(db_postponed);
if (pcv) {
dSP;
@@ -11722,10 +11721,9 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs,
CopFILE(PL_curcop),
(long)PL_subline,
(long)CopLINE(PL_curcop));
- (void)hv_store(GvHV(PL_DBsub), SvPVX_const(tmpstr),
- SvUTF8(tmpstr) ? -(I32)SvCUR(tmpstr) : (I32)SvCUR(tmpstr), sv, 0);
+ (void)hv_store_ent(GvHV(PL_DBsub), tmpstr, sv, 0);
hv = GvHVn(db_postponed);
- if (HvTOTALKEYS(hv) > 0 && hv_exists(hv, SvPVX_const(tmpstr), SvUTF8(tmpstr) ? -(I32)SvCUR(tmpstr) : (I32)SvCUR(tmpstr))) {
+ if (HvTOTALKEYS(hv) > 0 && hv_exists_ent(hv, tmpstr, 0)) {
CV * const pcv = GvCV(db_postponed);
if (pcv) {
dSP;