Skip to content

Commit 78df06f

Browse files
committed
perlapi: Combine sv_setref_pv[ns] entries
These entries differ only in details. They are better explained in one unit, comparing and contrasting.
1 parent 9800625 commit 78df06f

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

handy.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@ a string/length pair.
363363
Like C<newSVpvn_share>, but takes a literal string instead of
364364
a string/length pair and omits the hash parameter.
365365
366-
=for apidoc Am|SV *|sv_setref_pvs|SV *const rv|const char *const classname|"literal string"
367-
Like C<sv_setref_pvn>, but takes a literal string instead of
368-
a string/length pair.
369-
370366
=cut
371367
*/
372368

@@ -418,6 +414,12 @@ Perl_xxx(aTHX_ ...) form for any API calls where it's used.
418414
#define sv_setpvs(dsv, str) Perl_sv_setpvn(aTHX_ dsv, STR_WITH_LEN(str))
419415
#define sv_setpvs_mg(dsv, str) Perl_sv_setpvn_mg(aTHX_ dsv, STR_WITH_LEN(str))
420416

417+
/*
418+
=for apidoc_defn Am|SV *|sv_setref_pvs|SV *const rv|const char *const classname|"literal string"
419+
a string/length pair.
420+
421+
=cut
422+
*/
421423
#define sv_setref_pvs(rv, classname, str) \
422424
Perl_sv_setref_pvn(aTHX_ rv, classname, STR_WITH_LEN(str))
423425

sv.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10901,16 +10901,24 @@ Perl_sv_setref_nv(pTHX_ SV *const rv, const char *const classname, const NV nv)
1090110901
}
1090210902

1090310903
/*
10904-
=for apidoc sv_setref_pvn
10904+
=for apidoc sv_setref_pvn
10905+
=for apidoc_item sv_setref_pvs
1090510906

10906-
Copies a string into a new SV, optionally blessing the SV. The length of the
10907-
string must be specified with C<n>. The C<rv> argument will be upgraded to
10908-
an RV. That RV will be modified to point to the new SV. The C<classname>
10909-
argument indicates the package for the blessing. Set C<classname> to
10910-
C<NULL> to avoid the blessing. The new SV will have a reference count
10911-
of 1, and the RV will be returned.
10907+
These each copy a string into a new SV, optionally blessing the SV.
10908+
The C<rv> argument will be upgraded to an RV. That RV will be modified to
10909+
point to the new SV.
10910+
The C<classname> argument indicates the package for the blessing.
10911+
Set C<classname> to C<NULL> to avoid the blessing.
10912+
The new SV will have a reference count of 1, and the RV will be returned.
1091210913

10913-
Note that C<sv_setref_pv> copies the pointer while this copies the string.
10914+
The forms differ only in how the source string is specified.
10915+
10916+
C<sv_setref_pvs> takes a C string literal enclosed in double quotes.
10917+
10918+
In C<sv_setref_pvn>, C<n> is the length of the string parameter C<pv> in
10919+
bytes. Hence the latter may contain embedded NUL characters.
10920+
10921+
Note that C<L</sv_setref_pv>> copies the pointer while these copy the string.
1091410922

1091510923
=cut
1091610924
*/

0 commit comments

Comments
 (0)