@@ -11583,20 +11583,60 @@ Perl_sv_setpvf_mg_nocontext(SV *const sv, const char *const pat, ...)
1158311583=for apidoc_item sv_setpvf_mg
1158411584=for apidoc_item sv_setpvf_mg_nocontext
1158511585=for apidoc_item sv_setpvf_nocontext
11586+ =for apidoc_item sv_vsetpvf
11587+ =for apidoc_item sv_vsetpvf_mg
11588+ =for apidoc_item sv_vsetpvfn
11589+
11590+ These each set C<sv> to the result of formatting their arguments using
11591+ C<pat> as the C<sprintf>-like pattern. They assume that C<pat> has the same
11592+ UTF8ness as C<sv>. It's the caller's responsibility to ensure that this is
11593+ so.
11594+
11595+ The forms differ in how their arguments are specified and in the handling of
11596+ magic.
11597+
11598+ C<sv_vsetpvfn> is the most general, and all the other forms are implemented by
11599+ eventually calling it. It does not handle magic; the forms whose name contains
11600+ C<_mg> additionally handle 'set' magic after calling it.
11601+
11602+ It has two sets of argument lists, only one of which is used in any given call.
11603+ The first set, C<args>, is an encapsulated argument list of pointers to C
11604+ strings. If it is NULL, the other list, C<svargs>, is used; it is an array
11605+ of pointers to SV's. C<sv_count> gives how many there are in the list.
11606+
11607+ See L<C<sprintf(3)>> for details on how the formatting is done. Some
11608+ platforms support extensions to the standard C99 definition of this function.
11609+ None of those are supported by Perl. For example, neither C<'> (to get digit
11610+ grouping), nor C<I> (to get alternate digits) are supported.
1158611611
11587- These work like C<L</sv_catpvf>> but copy the text into the SV instead of
11588- appending it.
11612+ Also, argument reordering (using format specifiers like C<%2$d> or C<%*2$d>) is
11613+ supported only when using the C<svargs> array of SVs; an exception is raised if
11614+ C<arg> is not NULL and C<pat> contains the C<$> reordering specifier.
1158911615
11590- The differences between these are:
11616+ S<C<* maybe_tainted>> is supposed to be set when running with taint checks
11617+ enabled if the results are untrustworthy (often due to the use of locales).
11618+ However, this is not currently implemented. This argument is not used.
11619+
11620+ C<patlen> gives the length in bytes of C<pat>. Currently, the pattern must be
11621+ NUL-terminated anyway.
11622+
11623+ When using the C<svargs> array, if any of the SVs in it have their UTF-8 flag
11624+ set, C<sv> will be converted to be so too, as necessary.
1159111625
11592- C<sv_setpvf_mg> and C<sv_setpvf_mg_nocontext> perform 'set' magic; C<sv_setpvf>
11593- and C<sv_setpvf_nocontext> skip all magic.
11626+ None of the remaining forms use the C<svargs> array, meaning argument
11627+ reordering is not possible with them. The arguments are generally considered
11628+ to be the same UTF8ness as the destination C<sv>, though certain Perl
11629+ extensions to the standard set of %formats can override this (see
11630+ L<perlguts/Formatted Printing of Strings> and adjacent sections).
1159411631
11595- C<sv_setpvf_nocontext> and C<sv_setpvf_mg_nocontext > do not take a thread
11632+ The forms whose name contains C<_no_context > do not take a thread
1159611633context (C<aTHX>) parameter, so are used in situations where the caller
1159711634doesn't already have the thread context.
1159811635
11599- B<The UTF-8 flag is not changed by these functions.>
11636+ The forms whose name contains C<vset> use an encapsulated argument list, the
11637+ other forms use C<sprintf>-style arguments.
11638+
11639+ There are no other differences between the forms.
1160011640
1160111641=cut
1160211642*/
@@ -11613,24 +11653,6 @@ Perl_sv_setpvf(pTHX_ SV *const sv, const char *const pat, ...)
1161311653 va_end(args);
1161411654}
1161511655
11616- /*
11617- =for apidoc sv_vsetpvf
11618- =for apidoc_item sv_vsetpvf_mg
11619-
11620- These work like C<L</sv_vcatpvf>> but copy the text into the SV instead of
11621- appending it.
11622-
11623- They differ only in that C<sv_vsetpvf_mg> performs 'set' magic;
11624- C<sv_vsetpvf> skips all magic.
11625-
11626- They are usually used via their frontends, C<L</sv_setpvf>> and
11627- C<L</sv_setpvf_mg>>.
11628-
11629- B<The UTF-8 flag is not changed by these functions.>
11630-
11631- =cut
11632- */
11633-
1163411656void
1163511657Perl_sv_vsetpvf(pTHX_ SV *const sv, const char *const pat, va_list *const args)
1163611658{
@@ -11820,20 +11842,6 @@ Perl_sv_vcatpvf_mg(pTHX_ SV *const sv, const char *const pat, va_list *const arg
1182011842 SvSETMAGIC(sv);
1182111843}
1182211844
11823- /*
11824- =for apidoc sv_vsetpvfn
11825-
11826- Works like C<sv_vcatpvfn> but copies the text into the SV instead of
11827- appending it.
11828-
11829- B<The UTF-8 flag is not changed by this function.>
11830-
11831- Usually used via one of its frontends L</C<sv_vsetpvf>> and
11832- L</C<sv_vsetpvf_mg>>.
11833-
11834- =cut
11835- */
11836-
1183711845void
1183811846Perl_sv_vsetpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen,
1183911847 va_list *const args, SV **const svargs, const Size_t sv_count, bool *const maybe_tainted)
0 commit comments