Skip to content

Commit bb003d7

Browse files
committed
sv_setsv_cow: add some documentation
1 parent ed9bf68 commit bb003d7

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

embed.fnc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4105,7 +4105,7 @@ RTp |MEM_SIZE|malloc_good_size \
41054105
#endif
41064106
#if defined(PERL_ANY_COW)
41074107
: Used in regexec.c
4108-
EXpx |bool |sv_setsv_cow |NN SV **pdsv \
4108+
EXdpx |bool |sv_setsv_cow |NN SV **pdsv \
41094109
|NN SV *ssv
41104110
#endif
41114111
#if defined(PERL_CORE)

sv.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4879,6 +4879,29 @@ Perl_sv_setsv_mg(pTHX_ SV *const dsv, SV *const ssv)
48794879
SvSETMAGIC(dsv);
48804880
}
48814881

4882+
/*
4883+
=for apidoc sv_setsv_cow
4884+
4885+
Attempt to make a COW copy of C<ssv> in C<*dsv>.
4886+
4887+
C<*pdsv> must be NULL or a valid SV, if NULL it will be filled in with
4888+
a valid SV on success.
4889+
4890+
C<ssv> must be a POK, pPOK SV.
4891+
4892+
Returns true if the copy succeeds, false if a CoW copy cannot be made
4893+
for some reason.
4894+
4895+
sv_setsv_cow() is used by the regular expression engine to attempt to
4896+
make a COW copy of the matched against string for use in reporting
4897+
C<$1> etc.
4898+
4899+
If this fails the regular expression engine instead makes a non-SV
4900+
copy of a subset of the matched against string.
4901+
4902+
=cut
4903+
*/
4904+
48824905
#ifdef PERL_ANY_COW
48834906
# define SVt_COW SVt_PV
48844907
bool

0 commit comments

Comments
 (0)