diff options
author | Yves Orton <demerphq@gmail.com> | 2023-03-04 14:19:25 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2023-03-06 14:43:25 +0800 |
commit | 624f6f53b1081642aea65e1f3f172bcaad6c12c7 (patch) | |
tree | 4731cfddc244093185954ae3d891466d46319d99 /scope.h | |
parent | ad2d7a7b8430731f134374105121d039762c6f6c (diff) | |
download | perl-624f6f53b1081642aea65e1f3f172bcaad6c12c7.tar.gz |
scope.c - improved RCPV support, SAVERCPV SAVEFREERCPV
I misnamed some of the RCPV stuff when it was introduced. The macro
which I called SAVERCPVFREE should have been called SAVERCPV,
and there should also have been a SAVEFREERCPV macro.
Note the naming system for these functions is a bit confusing.
SAVEFREERCPV /just/ frees. SAVERCPV saves and restores (eg, its like
local). SAVEFREESV is an exception. :-( and it behaves like SAVERCPV.
See for instance SAVEPV or similar macros.
There also should have been RCPV_REFCNT_dec() and RCPV_REFCNT_inc()
macros.
There was also missing documentation. This patch should fix all of these
issues. Since this functionality has never been released in a production
perl it should be fine to do these renames, nothing out there should use
these macros yet.
I noticed these oversights while fixing Scope::Upper, see also:
https://github.com/Perl/perl5/issues/20861
https://rt.cpan.org/Ticket/Display.html?id=146897
Diffstat (limited to 'scope.h')
-rw-r--r-- | scope.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -177,7 +177,8 @@ scope has the given name. C<name> must be a literal string. #define SAVECLEARSV(sv) save_clearsv((SV**)&(sv)) #define SAVEGENERICSV(s) save_generic_svref((SV**)&(s)) #define SAVEGENERICPV(s) save_generic_pvref((char**)&(s)) -#define SAVERCPVFREE(s) save_rcpv_free((char**)&(s)) +#define SAVERCPV(s) save_rcpv((char**)&(s)) +#define SAVEFREERCPV(s) save_freercpv(s) #define SAVESHAREDPV(s) save_shared_pvref((char**)&(s)) #define SAVESETSVFLAGS(sv,mask,val) save_set_svflags(sv,mask,val) #define SAVEFREECOPHH(h) save_pushptr((void *)(h), SAVEt_FREECOPHH) @@ -231,7 +232,7 @@ scope has the given name. C<name> must be a literal string. SAVECOPFILE_x(c); \ CopFILE_debug((c),"SAVECOPFILE",0); \ } STMT_END -# define SAVECOPFILE_FREE_x(c) SAVERCPVFREE((c)->cop_file) +# define SAVECOPFILE_FREE_x(c) SAVERCPV((c)->cop_file) # define SAVECOPFILE_FREE(c) \ STMT_START { \ SAVECOPFILE_FREE_x(c); \ |