summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorYitzchak Scott-Thoennes <sthoenna@efn.org>2004-01-15 06:10:37 -0800
committerDave Mitchell <davem@fdisolutions.com>2004-01-16 19:24:14 +0000
commit891f9566d7fc0fb068ade9d98aed69773e02d39c (patch)
tree76e1dc8cf2b8b754bbb271ca11f01314964798b8 /sv.h
parent0bd0581c0da439d1bc9686c40ce8eabbab0f37cd (diff)
downloadperl-891f9566d7fc0fb068ade9d98aed69773e02d39c.tar.gz
Re: [perl #24816] Magic vars seem unsure if they are purely numeric
Message-Id: <20040115221037.GA2392@efn.org> Add sv_2iv_flags() to allow magic to be optionally processed. p4raw-id: //depot/perl@22163
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sv.h b/sv.h
index b31cb14851..332a7f4b58 100644
--- a/sv.h
+++ b/sv.h
@@ -854,6 +854,9 @@ C<SvPVx> for a version which guarantees to evaluate sv only once.
=for apidoc Am|char*|SvPVx|SV* sv|STRLEN len
A version of C<SvPV> which guarantees to evaluate sv only once.
+=for apidoc Am|char*|SvPV_nomg|SV* sv|STRLEN len
+Like C<SvPV> but doesn't process magic.
+
=for apidoc Am|char*|SvPV_nolen|SV* sv
Returns a pointer to the string in the SV, or a stringified form of
the SV if the SV does not contain a string. The SV may cache the
@@ -863,6 +866,9 @@ stringified form becoming C<SvPOK>. Handles 'get' magic.
Coerces the given SV to an integer and returns it. See C<SvIVx> for a
version which guarantees to evaluate sv only once.
+=for apidoc Am|IV|SvIV_nomg|SV* sv
+Like C<SvIV> but doesn't process magic.
+
=for apidoc Am|IV|SvIVx|SV* sv
Coerces the given SV to an integer and returns it. Guarantees to evaluate
sv only once. Use the more efficient C<SvIV> otherwise.
@@ -879,6 +885,9 @@ sv only once. Use the more efficient C<SvNV> otherwise.
Coerces the given SV to an unsigned integer and returns it. See C<SvUVx>
for a version which guarantees to evaluate sv only once.
+=for apidoc Am|UV|SvUV_nomg|SV* sv
+Like C<SvUV> but doesn't process magic.
+
=for apidoc Am|UV|SvUVx|SV* sv
Coerces the given SV to an unsigned integer and returns it. Guarantees to
evaluate sv only once. Use the more efficient C<SvUV> otherwise.
@@ -942,6 +951,9 @@ scalar.
#define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv))
#define SvNV(sv) (SvNOK(sv) ? SvNVX(sv) : sv_2nv(sv))
+#define SvIV_nomg(sv) (SvIOK(sv) ? SvIVX(sv) : sv_2iv_flags(sv, 0))
+#define SvUV_nomg(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv_flags(sv, 0))
+
/* ----*/
#define SvPV(sv, lp) SvPV_flags(sv, lp, SV_GMAGIC)
@@ -1114,6 +1126,8 @@ scalar.
#define sv_2pv_nomg(sv, lp) sv_2pv_flags(sv, lp, 0)
#define sv_pvn_force(sv, lp) sv_pvn_force_flags(sv, lp, SV_GMAGIC)
#define sv_utf8_upgrade(sv) sv_utf8_upgrade_flags(sv, SV_GMAGIC)
+#define sv_2iv(sv) sv_2iv_flags(sv, SV_GMAGIC)
+#define sv_2uv(sv) sv_2uv_flags(sv, SV_GMAGIC)
/* Should be named SvCatPVN_utf8_upgrade? */
#define sv_catpvn_utf8_upgrade(dsv, sstr, slen, nsv) \