summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embed.fnc8
-rw-r--r--scope.c44
2 files changed, 48 insertions, 4 deletions
diff --git a/embed.fnc b/embed.fnc
index 2f9bef767a..e08b8bce51 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1687,8 +1687,8 @@ Apda |char* |savesharedsvpv |NN SV *sv
Apda |char* |savesvpv |NN SV* sv
Cp |void |savestack_grow
Cp |void |savestack_grow_cnt |I32 need
-Am |void |save_aelem |NN AV* av|SSize_t idx|NN SV **sptr
-Ap |void |save_aelem_flags|NN AV* av|SSize_t idx|NN SV **sptr \
+Amd |void |save_aelem |NN AV* av|SSize_t idx|NN SV **sptr
+Apd |void |save_aelem_flags|NN AV* av|SSize_t idx|NN SV **sptr \
|const U32 flags
Cpd |I32 |save_alloc |I32 size|I32 pad
Apdh |void |save_aptr |NN AV** aptr
@@ -1710,8 +1710,8 @@ Cpd |void |save_shared_pvref|NN char** str
Adp |void |save_gp |NN GV* gv|I32 empty
Apdh |HV* |save_hash |NN GV* gv
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
+Amd |void |save_helem |NN HV *hv|NN SV *key|NN SV **sptr
+Apd |void |save_helem_flags|NN HV *hv|NN SV *key|NN SV **sptr|const U32 flags
Apdh |void |save_hptr |NN HV** hptr
Cp |void |save_I16 |NN I16* intp
Cp |void |save_I32 |NN I32* intp
diff --git a/scope.c b/scope.c
index 74033d182e..70026df5e3 100644
--- a/scope.c
+++ b/scope.c
@@ -845,6 +845,28 @@ S_save_pushptri32ptr(pTHX_ void *const ptr1, const I32 i, void *const ptr2,
SS_ADD_END(4);
}
+/*
+=for apidoc_section $callback
+=for apidoc save_aelem
+=for apidoc_item save_aelem_flags
+
+These each arrange for the value of the array element C<av[idx]> to be restored
+at the end of the enclosing I<pseudo-block>.
+
+In C<save_aelem>, the SV at C**sptr> will be replaced by a new C<undef>
+scalar. That scalar will inherit any magic from the original C<**sptr>,
+and any 'set' magic will be processed.
+
+In C<save_aelem_flags>, C<SAVEf_KEEPOLDELEM> being set in C<flags> causes
+the function to forgo all that: the scalar at C<**sptr> is untouched.
+If C<SAVEf_KEEPOLDELEM> is not set, the SV at C**sptr> will be replaced by a
+new C<undef> scalar. That scalar will inherit any magic from the original
+C<**sptr>. Any 'set' magic will be processed if and only if C<SAVEf_SETMAGIC>
+is set in in C<flags>.
+
+=cut
+*/
+
void
Perl_save_aelem_flags(pTHX_ AV *av, SSize_t idx, SV **sptr,
const U32 flags)
@@ -876,6 +898,28 @@ Perl_save_aelem_flags(pTHX_ AV *av, SSize_t idx, SV **sptr,
sv_2mortal(sv);
}
+/*
+=for apidoc_section $callback
+=for apidoc save_helem
+=for apidoc_item save_helem_flags
+
+These each arrange for the value of the hash element (in Perlish terms)
+C<$hv{key}]> to be restored at the end of the enclosing I<pseudo-block>.
+
+In C<save_helem>, the SV at C**sptr> will be replaced by a new C<undef>
+scalar. That scalar will inherit any magic from the original C<**sptr>,
+and any 'set' magic will be processed.
+
+In C<save_helem_flags>, C<SAVEf_KEEPOLDELEM> being set in C<flags> causes
+the function to forgo all that: the scalar at C<**sptr> is untouched.
+If C<SAVEf_KEEPOLDELEM> is not set, the SV at C**sptr> will be replaced by a
+new C<undef> scalar. That scalar will inherit any magic from the original
+C<**sptr>. Any 'set' magic will be processed if and only if C<SAVEf_SETMAGIC>
+is set in in C<flags>.
+
+=cut
+*/
+
void
Perl_save_helem_flags(pTHX_ HV *hv, SV *key, SV **sptr, const U32 flags)
{