start of the interpreter.
The internal function visit() scans the SV arenas list, and calls a specified
-function for each SV it finds which is still live - ie which has an SvTYPE
+function for each SV it finds which is still live, I<i.e.> which has an SvTYPE
other than all 1's, and a non-zero SvREFCNT. visit() is used by the
following functions (specified as [function that calls visit()] / [function
called by visit() for each SV]):
(void)SvNOK_on(sv);
/* Can't use strtol etc to convert this string. (See truth table in
sv_2iv */
- if (SvNVX(sv) <= (UV)IV_MAX) {
+ if (SvNVX(sv) < IV_MAX_P1) {
SvIV_set(sv, I_V(SvNVX(sv)));
if ((NV)(SvIVX(sv)) == SvNVX(sv)) {
SvIOK_on(sv); /* Integer is precise. NOK, IOK */
if (SvNOK(sv) && !SvPOK(sv))
return SvNVX(sv) != 0.0;
- return SvTRUE_common(sv, isGV_with_GP(sv) ? 1 : 0);
+ return SvTRUE_common(sv, 0);
}
/*
/*
=for apidoc sv_catpv
+=for apidoc_item sv_catpv_flags
+=for apidoc_item sv_catpv_mg
+=for apidoc_item sv_catpv_nomg
-Concatenates the C<NUL>-terminated string C<sstr> onto the end of the string which is
-in the SV.
+These concatenate the C<NUL>-terminated string C<sstr> onto the end of the
+string which is in the SV.
If the SV has the UTF-8 status set, then the bytes appended should be
-valid UTF-8. Handles 'get' magic, but not 'set' magic. See
-C<L</sv_catpv_mg>>.
+valid UTF-8.
-=cut */
+They differ only in how they handle magic:
+
+C<sv_catpv_mg> performs both 'get' and 'set' magic.
+
+C<sv_catpv> performs only 'get' magic.
+
+C<sv_catpv_nomg> skips all magic.
+
+C<sv_catpv_flags> has an extra C<flags> parameter which allows you to specify
+any combination of magic handling (using C<SV_GMAGIC> and/or C<SV_SMAGIC>), and
+to also override the UTF-8 handling. By supplying the C<SV_CATUTF8> flag, the
+appended string is forced to be interpreted as UTF-8; by supplying instead the
+C<SV_CATBYTES> flag, it will be interpreted as just bytes. Either the SV or
+the string appended will be upgraded to UTF-8 if necessary.
+
+=cut
+*/
void
Perl_sv_catpv(pTHX_ SV *const dsv, const char *sstr)
SvTAINT(dsv);
}
-/*
-=for apidoc sv_catpv_flags
-
-Concatenates the C<NUL>-terminated string onto the end of the string which is
-in the SV.
-If the SV has the UTF-8 status set, then the bytes appended should
-be valid UTF-8. If C<flags> has the C<SV_SMAGIC> bit set, will C<L</mg_set>>
-on the modified SV if appropriate.
-
-=cut
-*/
-
void
Perl_sv_catpv_flags(pTHX_ SV *dsv, const char *sstr, const I32 flags)
{
sv_catpvn_flags(dsv, sstr, strlen(sstr), flags);
}
-/*
-=for apidoc sv_catpv_mg
-
-Like C<sv_catpv>, but also handles 'set' magic.
-
-=cut
-*/
-
void
Perl_sv_catpv_mg(pTHX_ SV *const dsv, const char *const sstr)
{
/*
=for apidoc sv_setpviv
+=for apidoc_item sv_setpviv_mg
+
+These copy an integer into the given SV, also updating its string value.
-Copies an integer into the given SV, also updating its string value.
-Does not handle 'set' magic. See C<L</sv_setpviv_mg>>.
+They differ only in that C<sv_setpviv_mg> performs 'set' magic; C<sv_setpviv>
+skips any magic.
=cut
*/
sv_setpvn(sv, ptr, ebuf - ptr);
}
-/*
-=for apidoc sv_setpviv_mg
-
-Like C<sv_setpviv>, but also handles 'set' magic.
-
-=cut
-*/
-
void
Perl_sv_setpviv_mg(pTHX_ SV *const sv, const IV iv)
{
/*
=for apidoc sv_setpvf
+=for apidoc_item sv_setpvf_nocontext
+=for apidoc_item sv_setpvf_mg
+=for apidoc_item sv_setpvf_mg_nocontext
+
+These work like C<L</sv_catpvf>> but copy the text into the SV instead of
+appending it.
-Works like C<sv_catpvf> but copies the text into the SV instead of
-appending it. Does not handle 'set' magic. See C<L</sv_setpvf_mg>>.
+The differences between these are:
-=for apidoc sv_setpvf_nocontext
-Like C<L</sv_setpvf>> but does not take a thread context (C<aTHX>) parameter,
-so is used in situations where the caller doesn't already have the thread
-context.
+C<sv_setpvf> and C<sv_setpvf_nocontext> do not handle 'set' magic;
+C<sv_setpvf_mg> and C<sv_setpvf_mg_nocontext> do.
+
+C<sv_setpvf_nocontext> and C<sv_setpvf_mg_nocontext> do not take a thread
+context (C<aTHX>) parameter, so are used in situations where the caller
+doesn't already have the thread context.
=cut
*/
/*
=for apidoc sv_vsetpvf
+=for apidoc_item sv_vsetpvf_mg
-Works like C<sv_vcatpvf> but copies the text into the SV instead of
-appending it. Does not handle 'set' magic. See C<L</sv_vsetpvf_mg>>.
+These work like C<L</sv_vcatpvf>> but copy the text into the SV instead of
+appending it.
-Usually used via its frontend C<sv_setpvf>.
+They differ only in that C<sv_vsetpvf_mg> performs 'set' magic;
+C<sv_vsetpvf> skips all magic.
+
+They are usually used via their frontends, C<L</sv_setpvf>> and
+C<L</sv_setpvf_mg>>.
=cut
*/
sv_vsetpvfn(sv, pat, strlen(pat), args, NULL, 0, NULL);
}
-/*
-=for apidoc sv_setpvf_mg
-
-Like C<sv_setpvf>, but also handles 'set' magic.
-
-=for apidoc sv_setpvf_mg_nocontext
-Like C<L</sv_setpvf_mg>>, but does not take a thread context (C<aTHX>)
-parameter, so is used in situations where the caller doesn't already have the
-thread context.
-
-=cut
-*/
-
void
Perl_sv_setpvf_mg(pTHX_ SV *const sv, const char *const pat, ...)
{
va_end(args);
}
-/*
-=for apidoc sv_vsetpvf_mg
-
-Like C<sv_vsetpvf>, but also handles 'set' magic.
-
-Usually used via its frontend C<sv_setpvf_mg>.
-
-=cut
-*/
-
void
Perl_sv_vsetpvf_mg(pTHX_ SV *const sv, const char *const pat, va_list *const args)
{
/*
=for apidoc sv_catpvf
+=for apidoc_item sv_catpvf_nocontext
+=for apidoc_item sv_catpvf_mg
+=for apidoc_item sv_catpvf_mg_nocontext
+
+These process their arguments like C<sprintf>, and append the formatted
+output to an SV. As with C<sv_vcatpvfn>, argument reordering is not supporte
+when called with a non-null C-style variable argument list.
-Processes its arguments like C<sprintf>, and appends the formatted
-output to an SV. As with C<sv_vcatpvfn> called with a non-null C-style
-variable argument list, argument reordering is not supported.
If the appended data contains "wide" characters
(including, but not limited to, SVs with a UTF-8 PV formatted with C<%s>,
and characters >255 formatted with C<%c>), the original SV might get
-upgraded to UTF-8. Handles 'get' magic, but not 'set' magic. See
-C<L</sv_catpvf_mg>>. If the original SV was UTF-8, the pattern should be
+upgraded to UTF-8.
+
+If the original SV was UTF-8, the pattern should be
valid UTF-8; if the original SV was bytes, the pattern should be too.
-=for apidoc sv_catpvf_nocontext
-Like C<L</sv_catpvf>> but does not take a thread context (C<aTHX>) parameter,
-so is used in situations where the caller doesn't already have the thread
-context.
+All perform 'get' magic, but only C<sv_catpvf_mg> and C<sv_catpvf_mg_nocontext>
+perform 'set' magic.
-=cut */
+C<sv_catpvf_nocontext> and C<sv_catpvf_mg_nocontext> do not take a thread
+context (C<aTHX>) parameter, so are used in situations where the caller
+doesn't already have the thread context.
+
+=cut
+*/
void
Perl_sv_catpvf(pTHX_ SV *const sv, const char *const pat, ...)
/*
=for apidoc sv_vcatpvf
+=for apidoc_item sv_vcatpvf_mg
-Processes its arguments like C<sv_vcatpvfn> called with a non-null C-style
-variable argument list, and appends the formatted output
-to an SV. Does not handle 'set' magic. See C<L</sv_vcatpvf_mg>>.
+These process their arguments like C<sv_vcatpvfn> called with a non-null
+C-style variable argument list, and append the formatted output to C<sv>.
-Usually used via its frontend C<sv_catpvf>.
+They differ only in that C<sv_vcatpvf_mg> performs 'set' magic;
+C<sv_vcatpvf> skips 'set' magic.
+
+Both perform 'get' magic.
+
+They are usually accessed via their frontends C<L</sv_catpvf>> and
+C<L</sv_catpvf_mg>>.
=cut
*/
sv_vcatpvfn_flags(sv, pat, strlen(pat), args, NULL, 0, NULL, SV_GMAGIC|SV_SMAGIC);
}
-/*
-=for apidoc sv_catpvf_mg
-
-Like C<sv_catpvf>, but also handles 'set' magic.
-
-=for apidoc sv_catpvf_mg_nocontext
-Like C<L</sv_catpvf_mg>> but does not take a thread context (C<aTHX>) parameter,
-so is used in situations where the caller doesn't already have the thread
-context.
-
-=cut
-*/
-
void
Perl_sv_catpvf_mg(pTHX_ SV *const sv, const char *const pat, ...)
{
va_end(args);
}
-/*
-=for apidoc sv_vcatpvf_mg
-
-Like C<sv_vcatpvf>, but also handles 'set' magic.
-
-Usually used via its frontend C<sv_catpvf_mg>.
-
-=cut
-*/
-
void
Perl_sv_vcatpvf_mg(pTHX_ SV *const sv, const char *const pat, va_list *const args)
{
assert(!Perl_isinfnan(nv));
if (neg)
nv = -nv;
- if (nv != 0.0 && nv < UV_MAX) {
+ if (nv != 0.0 && nv < (NV) UV_MAX) {
char *p = endbuf;
uv = (UV)nv;
if (uv != nv) {
ptr = POPPTR(ss,ix);
TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
/* FALLTHROUGH */
+ case SAVEt_STRLEN_SMALL:
case SAVEt_INT_SMALL:
case SAVEt_I32_SMALL:
case SAVEt_I16: /* I16 reference */