diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-08-05 00:48:00 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-08-05 13:18:58 -0700 |
commit | bb02a38febc60a289c616282d720015be97842a4 (patch) | |
tree | c4815a82ac0e870532c5d44f70f4a6fb04c9c0bd /cv.h | |
parent | dea823b3f7c22fea989211dbe1bed7a34d49e39a (diff) | |
download | perl-bb02a38febc60a289c616282d720015be97842a4.tar.gz |
Add a depth field to formats
Instead of lengthening the struct, we can reuse SvCUR, which is cur-
rently unused.
Diffstat (limited to 'cv.h')
-rw-r--r-- | cv.h | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -61,13 +61,21 @@ See L<perlguts/Autoloading with XSUBs>. (CvFILE(sv) = CopFILE(cop), CvDYNFILE_off(sv)) #endif #define CvFILEGV(sv) (gv_fetchfile(CvFILE(sv))) +PERL_STATIC_INLINE I32 * +S_CvDEPTHp(const CV * const sv) +{ + return SvTYPE(sv) == SVt_PVCV + ? &((XPVCV*)SvANY(sv))->xcv_depth + : &((XPVCV*)SvANY(sv))->xpv_cur_u.xpvcuru_fmdepth; +} #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) # define CvDEPTH(sv) (*({const CV *const _cvdepth = (const CV *)sv; \ - assert(SvTYPE(_cvdepth) == SVt_PVCV); \ - &((XPVCV*)SvANY(_cvdepth))->xcv_depth; \ + assert(SvTYPE(_cvdepth) == SVt_PVCV \ + || SvTYPE(_cvdepth) == SVt_PVFM); \ + S_CvDEPTHp(_cvdepth); \ })) #else -# define CvDEPTH(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_depth +# define CvDEPTH(sv) *S_CvDEPTHp((const CV *)sv) #endif #define CvPADLIST(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist #define CvOUTSIDE(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_outside |