summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-12-29 12:28:14 +0000
committerNicholas Clark <nick@ccl4.org>2007-12-29 12:28:14 +0000
commit453d94a93e573c5979e959533fb269b76eb66968 (patch)
treef4ed259c9ac7d70b14de54d73ae0d0d241912aa1 /av.c
parenta1cf41cd41cfa3d3c737acde06e0d3bbd02dd08d (diff)
downloadperl-453d94a93e573c5979e959533fb269b76eb66968.tar.gz
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
Diffstat (limited to 'av.c')
-rw-r--r--av.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/av.c b/av.c
index d528ffca02..afca8bf21c 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
}
/*