summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-17 14:21:37 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-21 16:51:16 -0700
commit35e035ccb58e33947405288b1177fb0b9c1da197 (patch)
treefec171998002fc9523f006c88610f31e252d5d5f /ext
parentdb4cf31d1d6c1d09bce93986aa993818ea7b17cf (diff)
downloadperl-35e035ccb58e33947405288b1177fb0b9c1da197.tar.gz
More PAD APIs
If we are making padlists their own type, and no longer AVs, it makes sense to add APIs for pads, too, so that CPAN code that needs to change now will only have to change once if we ever stop pads them- selves from being AVs. There is no reason pad names have to be SVs, so I am adding sep- arate APIs for pad names, too. The AV containing pad names is now officially a PADNAMELIST, which is accessed, not via *PADLIST_ARRAY(padlist), but via PADLIST_NAMES(padlist). Future optimisations may even merge the padlist with its name list so I have also added macros to access the parts of the name list directly from the padlist.
Diffstat (limited to 'ext')
-rw-r--r--ext/XS-APItest/APItest.xs12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 05199208e6..fb42935ba9 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -3287,16 +3287,16 @@ fetch_pad_names( cv )
CV* cv
PREINIT:
I32 i;
- AV *pad_namelist;
+ PADNAMELIST *pad_namelist;
AV *retav = newAV();
CODE:
- pad_namelist = *PADLIST_ARRAY(CvPADLIST(cv));
+ pad_namelist = PADLIST_NAMES(CvPADLIST(cv));
- for ( i = av_len(pad_namelist); i >= 0; i-- ) {
- SV** name_ptr = av_fetch(pad_namelist, i, 0);
+ for ( i = PADNAMELIST_MAX(pad_namelist); i >= 0; i-- ) {
+ PADNAME* name = PADNAMELIST_ARRAY(pad_namelist)[i];
- if (name_ptr && SvPOKp(*name_ptr)) {
- av_push(retav, newSVsv(*name_ptr));
+ if (SvPOKp(name)) {
+ av_push(retav, newSVpadname(name));
}
}
RETVAL = newRV_noinc((SV*)retav);