From: Nicholas Clark Date: Sat, 29 Dec 2007 12:28:14 +0000 (+0000) Subject: Change Perl_av_iter_p() to return IV* rather than I32* (which means X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=453d94a93e573c5979e959533fb269b76eb66968;p=p5sagit%2Fp5-mst-13.2.git Change Perl_av_iter_p() to return IV* rather than I32* (which means having to allocate memory where sizeof(IV) > sizeof(I32)). p4raw-id: //depot/perl@32760 --- diff --git a/av.c b/av.c index d528ffc..afca8bf 100644 --- a/av.c +++ b/av.c @@ -970,11 +970,18 @@ Perl_av_arylen_p(pTHX_ AV *av) { return &(mg->mg_obj); } -/* This will change to returning IV ** at some point soon */ -I32 * +IV * Perl_av_iter_p(pTHX_ AV *av) { MAGIC *const mg = get_aux_mg(av); +#if IVSIZE == I32SIZE return &(mg->mg_len); +#else + if (!mg->mg_ptr) { + mg->mg_len = IVSIZE; + Newxz(mg->mg_ptr, 1, IV); + } + return (IV *)mg->mg_ptr; +#endif } /* diff --git a/embed.fnc b/embed.fnc index fe09c9c..5819ad9 100644 --- a/embed.fnc +++ b/embed.fnc @@ -115,7 +115,7 @@ Apd |void |av_undef |NN AV* ar ApdoxM |SV** |av_create_and_unshift_one|NN AV **const avp|NN SV *const val Apd |void |av_unshift |NN AV* ar|I32 num Apo |SV** |av_arylen_p |NN AV* av -AMpo |I32* |av_iter_p |NN AV* av +Apo |IV* |av_iter_p |NN AV* av #if defined(PERL_IN_AV_C) || defined(PERL_DECL_PROT) s |MAGIC* |get_aux_mg |NN AV *av #endif diff --git a/pp.c b/pp.c index ed3ae32..937b7ce 100644 --- a/pp.c +++ b/pp.c @@ -3929,7 +3929,7 @@ PP(pp_aeach) dSP; AV *array = (AV*)POPs; const I32 gimme = GIMME_V; - I32 *iterp = Perl_av_iter_p(aTHX_ array); + IV *iterp = Perl_av_iter_p(aTHX_ array); const IV current = (*iterp)++; if (current > av_len(array)) { diff --git a/proto.h b/proto.h index aa4d42a..a845a9a 100644 --- a/proto.h +++ b/proto.h @@ -189,7 +189,7 @@ PERL_CALLCONV void Perl_av_unshift(pTHX_ AV* ar, I32 num) PERL_CALLCONV SV** Perl_av_arylen_p(pTHX_ AV* av) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV I32* Perl_av_iter_p(pTHX_ AV* av) +PERL_CALLCONV IV* Perl_av_iter_p(pTHX_ AV* av) __attribute__nonnull__(pTHX_1); #if defined(PERL_IN_AV_C) || defined(PERL_DECL_PROT)