Skip to content

Commit 20f4518

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 93fbcb7 commit 20f4518

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
@@ -11306,16 +11306,24 @@ Perl_sv_setref_nv(pTHX_ SV *const rv, const char *const classname, const NV nv)
1130611306
}
1130711307

1130811308
/*
11309-
=for apidoc sv_setref_pvn
11309+
=for apidoc sv_setref_pvn
11310+
=for apidoc_item sv_setref_pvs
1131011311

11311-
Copies a string into a new SV, optionally blessing the SV. The length of the
11312-
string must be specified with C<n>. The C<rv> argument will be upgraded to
11313-
an RV. That RV will be modified to point to the new SV. The C<classname>
11314-
argument indicates the package for the blessing. Set C<classname> to
11315-
C<NULL> to avoid the blessing. The new SV will have a reference count
11316-
of 1, and the RV will be returned.
11312+
These each copy a string into a new SV, optionally blessing the SV.
11313+
The C<rv> argument will be upgraded to an RV. That RV will be modified to
11314+
point to the new SV.
11315+
The C<classname> argument indicates the package for the blessing.
11316+
Set C<classname> to C<NULL> to avoid the blessing.
11317+
The new SV will have a reference count of 1, and the RV will be returned.
1131711318

11318-
Note that C<sv_setref_pv> copies the pointer while this copies the string.
11319+
The forms differ only in how the source string is specified.
11320+
11321+
C<sv_setref_pvs> takes a C string literal enclosed in double quotes.
11322+
11323+
In C<sv_setref_pvn>, C<n> is the length of the string parameter C<pv> in
11324+
bytes. Hence the latter may contain embedded NUL characters.
11325+
11326+
Note that C<L</sv_setref_pv>> copies the pointer while these copy the string.
1131911327

1132011328
=cut
1132111329
*/

0 commit comments

Comments
 (0)