perlapi: Mark internal and document some save_FOO fcns

These implement uppercase-named macros.
This commit is contained in:
Karl Williamson 2022-05-07 10:16:14 -06:00
parent f58e1f6ccb
commit e446bf9324
3 changed files with 95 additions and 17 deletions

View File

@ -1699,12 +1699,12 @@ CpMb |void |save_freesv |NULLOK SV* sv
: Used in SAVEFREOP(), used in op.c, pp_ctl.c
CpMb |void |save_freeop |NULLOK OP* o
CpMb |void |save_freepv |NULLOK char* pv
Ap |void |save_generic_svref|NN SV** sptr
Ap |void |save_generic_pvref|NN char** str
Ap |void |save_shared_pvref|NN char** str
Cpd |void |save_generic_svref|NN SV** sptr
Cpd |void |save_generic_pvref|NN char** str
Cpd |void |save_shared_pvref|NN char** str
Adp |void |save_gp |NN GV* gv|I32 empty
Apdh |HV* |save_hash |NN GV* gv
Ap |void |save_hints
Cpd |void |save_hints
Am |void |save_helem |NN HV *hv|NN SV *key|NN SV **sptr
Ap |void |save_helem_flags|NN HV *hv|NN SV *key|NN SV **sptr|const U32 flags
Apdh |void |save_hptr |NN HV** hptr
@ -1719,12 +1719,12 @@ CbpD |void |save_long |NN long* longp
CpMb |void |save_mortalizesv|NN SV* sv
AbpD |void |save_nogv |NN GV* gv
: Used in SAVEFREOP(), used in gv.c, op.c, perl.c, pp_ctl.c, pp_sort.c
ApMb |void |save_op
CpMbd |void |save_op
Apdh |SV* |save_scalar |NN GV* gv
Cp |void |save_pptr |NN char** pptr
Ap |void |save_vptr |NN void *ptr
Cpd |void |save_vptr |NN void *ptr
Cp |void |save_re_context
Ap |void |save_padsv_and_mortalize|PADOFFSET off
Cpd |void |save_padsv_and_mortalize|PADOFFSET off
Cp |void |save_sptr |NN SV** sptr
Xp |void |save_strlen |NN STRLEN* ptr
Apdh |SV* |save_svref |NN SV** sptr
@ -3514,7 +3514,7 @@ p |void |free_tied_hv_pool
: Used in mg.c
pR |int |get_debug_opts |NN const char **s|bool givehelp
#endif
Ap |void |save_set_svflags|NN SV *sv|U32 mask|U32 val
Cpd |void |save_set_svflags|NN SV *sv|U32 mask|U32 val
#ifdef DEBUGGING
Apod |void |hv_assert |NN HV *hv
#endif

86
scope.c
View File

@ -106,6 +106,7 @@ Perl_cxinc(pTHX)
}
/*
=for apidoc_section $callback
=for apidoc push_scope
Implements L<perlapi/C<ENTER>>
@ -132,6 +133,7 @@ Perl_push_scope(pTHX)
}
/*
=for apidoc_section $callback
=for apidoc pop_scope
Implements L<perlapi/C<LEAVE>>
@ -282,8 +284,17 @@ Perl_save_scalar(pTHX_ GV *gv)
return save_scalar_at(sptr, SAVEf_SETMAGIC); /* XXX - FIXME - see #60360 */
}
/* Like save_sptr(), but also SvREFCNT_dec()s the new value. Can be used to
* restore a global SV to its prior contents, freeing new value. */
/*
=for apidoc save_generic_svref
Implements C<SAVEGENERICSV>.
Like save_sptr(), but also SvREFCNT_dec()s the new value. Can be used to
restore a global SV to its prior contents, freeing new value.
=cut
*/
void
Perl_save_generic_svref(pTHX_ SV **sptr)
{
@ -292,9 +303,19 @@ Perl_save_generic_svref(pTHX_ SV **sptr)
save_pushptrptr(sptr, SvREFCNT_inc(*sptr), SAVEt_GENERIC_SVREF);
}
/* Like save_pptr(), but also Safefree()s the new value if it is different
* from the old one. Can be used to restore a global char* to its prior
* contents, freeing new value. */
/*
=for apidoc_section $callback
=for apidoc save_generic_pvref
Implements C<SAVEGENERICPV>.
Like save_pptr(), but also Safefree()s the new value if it is different
from the old one. Can be used to restore a global char* to its prior
contents, freeing new value.
=cut
*/
void
Perl_save_generic_pvref(pTHX_ char **str)
{
@ -303,9 +324,19 @@ Perl_save_generic_pvref(pTHX_ char **str)
save_pushptrptr(*str, str, SAVEt_GENERIC_PVREF);
}
/* Like save_generic_pvref(), but uses PerlMemShared_free() rather than Safefree().
* Can be used to restore a shared global char* to its prior
* contents, freeing new value. */
/*
=for apidoc_section $callback
=for apidoc save_shared_pvref
Implements C<SAVESHAREDPV>.
Like save_generic_pvref(), but uses PerlMemShared_free() rather than Safefree().
Can be used to restore a shared global char* to its prior
contents, freeing new value.
=cut
*/
void
Perl_save_shared_pvref(pTHX_ char **str)
{
@ -314,7 +345,17 @@ Perl_save_shared_pvref(pTHX_ char **str)
save_pushptrptr(str, *str, SAVEt_SHARED_PVREF);
}
/* set the SvFLAGS specified by mask to the values in val */
/*
=for apidoc_section $callback
=for apidoc save_set_svflags
Implements C<SAVESETSVFLAGS>.
Set the SvFLAGS specified by mask to the values in val
=cut
*/
void
Perl_save_set_svflags(pTHX_ SV* sv, U32 mask, U32 val)
@ -568,6 +609,15 @@ Perl_save_pptr(pTHX_ char **pptr)
save_pushptrptr(*pptr, pptr, SAVEt_PPTR);
}
/*
=for apidoc_section $callback
=for apidoc save_vptr
Implements C<SAVEVPTR>.
=cut
*/
void
Perl_save_vptr(pTHX_ void *ptr)
{
@ -584,6 +634,15 @@ Perl_save_sptr(pTHX_ SV **sptr)
save_pushptrptr(*sptr, sptr, SAVEt_SPTR);
}
/*
=for apidoc_section $callback
=for apidoc save_padsv_and_mortalize
Implements C<SAVEPADSVANDMORTALIZE>.
=cut
*/
void
Perl_save_padsv_and_mortalize(pTHX_ PADOFFSET off)
{
@ -704,6 +763,15 @@ Perl_save_destructor_x(pTHX_ DESTRUCTORFUNC_t f, void* p)
SS_ADD_END(3);
}
/*
=for apidoc_section $callback
=for apidoc save_hints
Implements C<SAVEHINTS>.
=cut
*/
void
Perl_save_hints(pTHX)
{

10
scope.h
View File

@ -336,6 +336,16 @@ STMT_START { \
save_pushptr((void *)(_o), SAVEt_FREEOP); \
} STMT_END
#define save_freepv(pv) save_pushptr((void *)(pv), SAVEt_FREEPV)
/*
=for apidoc_section $callback
=for apidoc save_op
Implements C<SAVEOP>.
=cut
*/
#define save_op() save_pushptr((void *)(PL_op), SAVEt_OP)
/*