Skip to content

Commit d185828

Browse files
committed
sv_setsv_cow: add some documentation
1 parent cf4c4c8 commit d185828

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
@@ -4144,7 +4144,7 @@ RTp |MEM_SIZE|malloc_good_size \
41444144
#endif
41454145
#if defined(PERL_ANY_COW)
41464146
: Used in regexec.c
4147-
EXpx |bool |sv_setsv_cow |NN SV **pdsv \
4147+
EXdpx |bool |sv_setsv_cow |NN SV **pdsv \
41484148
|NN SV *ssv
41494149
#endif
41504150
#if defined(PERL_CORE)

sv.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4902,6 +4902,29 @@ Perl_sv_setsv_mg(pTHX_ SV *const dsv, SV *const ssv)
49024902
SvSETMAGIC(dsv);
49034903
}
49044904

4905+
/*
4906+
=for apidoc sv_setsv_cow
4907+
4908+
Attempt to make a COW copy of C<ssv> in C<*pdsv>.
4909+
4910+
C<*pdsv> must be NULL or a valid SV, if NULL it will be filled in with
4911+
a valid SV on success.
4912+
4913+
C<ssv> must be a POK, pPOK SV.
4914+
4915+
Returns true if the copy succeeds, false if a CoW copy cannot be made
4916+
for some reason.
4917+
4918+
sv_setsv_cow() is used by the regular expression engine to attempt to
4919+
make a COW copy of the matched against string for use in reporting
4920+
C<$1> etc.
4921+
4922+
If this fails the regular expression engine instead makes a non-SV
4923+
copy of a subset of the matched against string.
4924+
4925+
=cut
4926+
*/
4927+
49054928
#ifdef PERL_ANY_COW
49064929
# define SVt_COW SVt_PV
49074930
bool

0 commit comments

Comments
 (0)