Skip to content

Commit 5717741

Browse files
committed
sv_setsv_cow: add some documentation
1 parent b2a4d54 commit 5717741

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
@@ -3979,7 +3979,7 @@ RTp |MEM_SIZE|malloc_good_size \
39793979
#endif
39803980
#if defined(PERL_ANY_COW)
39813981
: Used in regexec.c
3982-
EXpx |bool |sv_setsv_cow |NN SV **pdsv \
3982+
EXdpx |bool |sv_setsv_cow |NN SV **pdsv \
39833983
|NN SV *ssv
39843984
#endif
39853985
#if defined(PERL_CORE)

sv.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4887,6 +4887,29 @@ Perl_sv_setsv_mg(pTHX_ SV *const dsv, SV *const ssv)
48874887
SvSETMAGIC(dsv);
48884888
}
48894889

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

0 commit comments

Comments
 (0)