From 74279cb654174c8653f8e15198a6aa843636148e Mon Sep 17 00:00:00 2001 From: Richard Leach Date: Tue, 7 Jun 2022 22:17:04 +0000 Subject: Make use of av_push_simple in a few places. Specifically, only where a new AV has just been created and it's therefore obvious that av_push_simple is safe to use. In many cases, nearby code does av_push to an existing array. It might well be the case that these are simple arrays and av_push_simple could be used instead. The necessary analysis has been left for the future. --- mro_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mro_core.c') diff --git a/mro_core.c b/mro_core.c index 42a11af035..235dacaec7 100644 --- a/mro_core.c +++ b/mro_core.c @@ -268,7 +268,7 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, U32 level) /* We use this later in this function, but don't need a reference to it beyond the end of this function, so reference count is fine. */ our_name = newSVhek(stashhek); - av_push(retval, our_name); /* add ourselves at the top */ + av_push_simple(retval, our_name); /* add ourselves at the top */ /* fetch our @ISA */ gvp = (GV**)hv_fetchs(stash, "ISA", FALSE); @@ -326,7 +326,7 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, U32 level) HeVAL(he) = &PL_sv_undef; sv_sethek(val, key); - av_push(retval, val); + av_push_simple(retval, val); } } } else { @@ -358,7 +358,7 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, U32 level) as if we'd copied it from what theirs should be. */ stored = MUTABLE_HV(newSV_type_mortal(SVt_PVHV)); (void) hv_stores(stored, "UNIVERSAL", &PL_sv_undef); - av_push(retval, + av_push_simple(retval, newSVhek(HeKEY_hek(hv_store_ent(stored, sv, &PL_sv_undef, 0)))); } @@ -846,7 +846,7 @@ Perl_mro_package_moved(pTHX_ HV * const stash, HV * const oldstash, GvNAMEUTF8(gv) ? SV_CATUTF8 : SV_CATBYTES ); } - av_push((AV *)namesv, aname); + av_push_simple((AV *)namesv, aname); } } @@ -1186,7 +1186,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes, ? SV_CATUTF8 : SV_CATBYTES ); } - av_push((AV *)subname, aname); + av_push_simple((AV *)subname, aname); } } else { @@ -1269,7 +1269,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes, ? SV_CATUTF8 : SV_CATBYTES ); } - av_push((AV *)subname, aname); + av_push_simple((AV *)subname, aname); } } else { -- cgit v1.2.1