diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2022-08-17 14:10:39 +0100 |
---|---|---|
committer | Paul Evans <leonerd@leonerd.org.uk> | 2022-08-17 15:59:15 +0100 |
commit | 79277e97f5c8cedf24a2686ea15b74abbc4b643a (patch) | |
tree | f9c7b194b404087d0118fe82ff95db50b32d749b /pad.h | |
parent | 22887b5bfa220f1de2e85d93f5387a8870cc1ae7 (diff) | |
download | perl-79277e97f5c8cedf24a2686ea15b74abbc4b643a.tar.gz |
Add a PadnameREFCNT_inc() macro
Implemented as a static inline function call, so that it can return the
padname pointer itself. This would allow use in expressions such as
ptr->field = PadnameREFCNT_inc(pn);
That makes it similar to the familiar SvREFCNT_inc() macro.
Diffstat (limited to 'pad.h')
-rw-r--r-- | pad.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -249,6 +249,9 @@ for C<my Foo $bar>. =for apidoc Amx|SSize_t|PadnameREFCNT|PADNAME * pn The reference count of the pad name. +=for apidoc Amx|PADNAME *|PadnameREFCNT_inc|PADNAME * pn +Increases the reference count of the pad name. Returns the pad name itself. + =for apidoc Amx|void|PadnameREFCNT_dec|PADNAME * pn Lowers the reference count of the pad name. @@ -321,6 +324,7 @@ Restore the old pad saved into the local variable C<opad> by C<PAD_SAVE_LOCAL()> #define PadnameHasTYPE(pn) cBOOL(PadnameTYPE(pn)) #define PadnamePROTOCV(pn) (pn)->xpadn_type_u.xpadn_protocv #define PadnameREFCNT(pn) (pn)->xpadn_refcnt +#define PadnameREFCNT_inc(pn) Perl_padname_refcnt_inc(pn) #define PadnameREFCNT_dec(pn) Perl_padname_free(aTHX_ pn) #define PadnameOURSTASH_set(pn,s) (PadnameOURSTASH(pn) = (s)) #define PadnameTYPE_set(pn,s) (PadnameTYPE(pn) = (s)) |