}
}
else {
+#ifdef PERL_MALLOC_WRAP
+ static const char oom_array_extend[] =
+ "Out of memory during array extend"; /* Duplicated in pp_hot.c */
+#endif
+
if (AvALLOC(av)) {
#if !defined(STRANGE_MALLOC) && !defined(MYMALLOC)
MEM_SIZE bytes;
#endif
newmax = key + AvMAX(av) / 5;
resize:
- MEM_WRAP_CHECK_1(newmax+1, SV*, "panic: array extend");
+ MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
#if defined(STRANGE_MALLOC) || defined(MYMALLOC)
Renew(AvALLOC(av),newmax+1, SV*);
#else
}
else {
newmax = key < 3 ? 3 : key;
- MEM_WRAP_CHECK_1(newmax+1, SV*, "panic: array extend");
+ MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
New(2,AvALLOC(av), newmax+1, SV*);
ary = AvALLOC(av) + 1;
tmp = newmax;
return 0;
if (SvRMAGICAL(av)) {
- MAGIC *tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
+ const MAGIC * const tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
if (tied_magic || mg_find((SV*)av, PERL_MAGIC_regdata)) {
U32 adjust_index = 1;
val = &PL_sv_undef;
if (SvRMAGICAL(av)) {
- MAGIC *tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
+ const MAGIC * const tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
if (tied_magic) {
/* Handle negative array indices 20020222 MJD */
if (key < 0) {
*/
I32
-Perl_av_len(pTHX_ register AV *av)
+Perl_av_len(pTHX_ const register AV *av)
{
return AvFILL(av);
}
Perl_croak(aTHX_ PL_no_modify);
if (SvRMAGICAL(av)) {
- MAGIC *tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
- SV **svp;
+ const MAGIC * const tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
if ((tied_magic || mg_find((SV*)av, PERL_MAGIC_regdata))) {
/* Handle negative array indices 20020222 MJD */
+ SV **svp;
if (key < 0) {
unsigned adjust_index = 1;
if (tied_magic) {
SvREFCNT_dec(sv);
sv = Nullsv;
}
+ else if (AvREAL(av))
+ sv = sv_2mortal(sv);
return sv;
}
if (SvRMAGICAL(av)) {
- MAGIC *tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
+ const MAGIC * const tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
if (tied_magic || mg_find((SV*)av, PERL_MAGIC_regdata)) {
SV *sv = sv_newmortal();
MAGIC *mg;