void Perl_av_reify(pTHX_ AV *av) { SSize_t key; PERL_ARGS_ASSERT_AV_REIFY; assert(SvTYPE(av) == SVt_PVAV); if (AvREAL(av)) return; #ifdef DEBUGGING if (SvTIED_mg((const SV *)av, PERL_MAGIC_tied)) Perl_ck_warner_d(aTHX_ packWARN(WARN_DEBUGGING), "av_reify called on tied array"); #endif key = AvMAX(av) + 1; while (key > AvFILLp(av) + 1) AvARRAY(av)[--key] = NULL; while (key) { SV * const sv = AvARRAY(av)[--key]; if (sv != &PL_sv_undef) SvREFCNT_inc_simple_void(sv); } key = AvARRAY(av) - AvALLOC(av); while (key) AvALLOC(av)[--key] = NULL; AvREIFY_off(av); AvREAL_on(av); }
void Perl_av_reify(pTHX_ AV *av) { I32 key; SV* sv; if (AvREAL(av)) return; #ifdef DEBUGGING if (SvTIED_mg((SV*)av, PERL_MAGIC_tied) && ckWARN_d(WARN_DEBUGGING)) Perl_warner(aTHX_ packWARN(WARN_DEBUGGING), "av_reify called on tied array"); #endif key = AvMAX(av) + 1; while (key > AvFILLp(av) + 1) AvARRAY(av)[--key] = &PL_sv_undef; while (key) { sv = AvARRAY(av)[--key]; assert(sv); if (sv != &PL_sv_undef) (void)SvREFCNT_inc(sv); } key = AvARRAY(av) - AvALLOC(av); while (key) AvALLOC(av)[--key] = &PL_sv_undef; AvREIFY_off(av); AvREAL_on(av); }