diff --git a/sv.c b/sv.c index d06527dab6b9..724f677103f0 100644 --- a/sv.c +++ b/sv.c @@ -11583,20 +11583,60 @@ Perl_sv_setpvf_mg_nocontext(SV *const sv, const char *const pat, ...) =for apidoc_item sv_setpvf_mg =for apidoc_item sv_setpvf_mg_nocontext =for apidoc_item sv_setpvf_nocontext +=for apidoc_item sv_vsetpvf +=for apidoc_item sv_vsetpvf_mg +=for apidoc_item sv_vsetpvfn + +These each set C to the result of formatting their arguments using +C as the C-like pattern. They assume that C has the same +UTF8ness as C. It's the caller's responsibility to ensure that this is +so. + +The forms differ in how their arguments are specified and in the handling of +magic. + +C is the most general, and all the other forms are implemented by +eventually calling it. It does not handle magic; the forms whose name contains +C<_mg> additionally handle 'set' magic after calling it. + +It has two sets of argument lists, only one of which is used in any given call. +The first set, C, is an encapsulated argument list of pointers to C +strings. If it is NULL, the other list, C, is used; it is an array +of pointers to SV's. C gives how many there are in the list. + +See L> for details on how the formatting is done. Some +platforms support extensions to the standard C99 definition of this function. +None of those are supported by Perl. For example, neither C<'> (to get digit +grouping), nor C (to get alternate digits) are supported. -These work like C> but copy the text into the SV instead of -appending it. +Also, argument reordering (using format specifiers like C<%2$d> or C<%*2$d>) is +supported only when using the C array of SVs; an exception is raised if +C is not NULL and C contains the C<$> reordering specifier. -The differences between these are: +S> is supposed to be set when running with taint checks +enabled if the results are untrustworthy (often due to the use of locales). +However, this is not currently implemented. This argument is not used. + +C gives the length in bytes of C. Currently, the pattern must be +NUL-terminated anyway. + +When using the C array, if any of the SVs in it have their UTF-8 flag +set, C will be converted to be so too, as necessary. -C and C perform 'set' magic; C -and C skip all magic. +None of the remaining forms use the C array, meaning argument +reordering is not possible with them. The arguments are generally considered +to be the same UTF8ness as the destination C, though certain Perl +extensions to the standard set of %formats can override this (see +L and adjacent sections). -C and C do not take a thread +The forms whose name contains C<_no_context> do not take a thread context (C) parameter, so are used in situations where the caller doesn't already have the thread context. -B +The forms whose name contains C use an encapsulated argument list, the +other forms use C-style arguments. + +There are no other differences between the forms. =cut */ @@ -11613,24 +11653,6 @@ Perl_sv_setpvf(pTHX_ SV *const sv, const char *const pat, ...) va_end(args); } -/* -=for apidoc sv_vsetpvf -=for apidoc_item sv_vsetpvf_mg - -These work like C> but copy the text into the SV instead of -appending it. - -They differ only in that C performs 'set' magic; -C skips all magic. - -They are usually used via their frontends, C> and -C>. - -B - -=cut -*/ - void Perl_sv_vsetpvf(pTHX_ SV *const sv, const char *const pat, va_list *const args) { @@ -11820,20 +11842,6 @@ Perl_sv_vcatpvf_mg(pTHX_ SV *const sv, const char *const pat, va_list *const arg SvSETMAGIC(sv); } -/* -=for apidoc sv_vsetpvfn - -Works like C but copies the text into the SV instead of -appending it. - -B - -Usually used via one of its frontends L> and -L>. - -=cut -*/ - void Perl_sv_vsetpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, va_list *const args, SV **const svargs, const Size_t sv_count, bool *const maybe_tainted)