summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-06-23 07:01:34 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-06-25 06:42:58 -0400
commit20b7effb9761caf5aee8475b6a6d731b40c80cd7 (patch)
tree21daa8d7a8d91dd62ad42ceefe7027787d7ceaf5 /sv.c
parent51f14a05690a52120145e5118962964658734217 (diff)
downloadperl-20b7effb9761caf5aee8475b6a6d731b40c80cd7.tar.gz
Remove or downgrade unnecessary dVAR.
You need to configure with g++ *and* -Accflags=-DPERL_GLOBAL_STRUCT or -Accflags=-DPERL_GLOBAL_STRUCT_PRIVATE to see any difference. (g++ does not do the "post-annotation" form of "unused".) The version code has some of these issues, reported upstream.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c100
1 files changed, 3 insertions, 97 deletions
diff --git a/sv.c b/sv.c
index b938d8b0de..5ac1d3e175 100644
--- a/sv.c
+++ b/sv.c
@@ -310,7 +310,6 @@ Public API:
STATIC SV*
S_more_sv(pTHX)
{
- dVAR;
SV* sv;
char *chunk; /* must use New here to match call to */
Newx(chunk,PERL_ARENA_SIZE,char); /* Safefree() in sv_free_arenas() */
@@ -432,7 +431,6 @@ and split it into a list of free SVs.
static void
S_sv_add_arena(pTHX_ char *const ptr, const U32 size, const U32 flags)
{
- dVAR;
SV *const sva = MUTABLE_SV(ptr);
SV* sv;
SV* svend;
@@ -472,7 +470,6 @@ S_sv_add_arena(pTHX_ char *const ptr, const U32 size, const U32 flags)
STATIC I32
S_visit(pTHX_ SVFUNC_t f, const U32 flags, const U32 mask)
{
- dVAR;
SV* sva;
I32 visited = 0;
@@ -531,7 +528,6 @@ Perl_sv_report_used(pTHX)
static void
do_clean_objs(pTHX_ SV *const ref)
{
- dVAR;
assert (SvROK(ref));
{
SV * const target = SvRV(ref);
@@ -557,7 +553,6 @@ do_clean_objs(pTHX_ SV *const ref)
static void
do_clean_named_objs(pTHX_ SV *const sv)
{
- dVAR;
SV *obj;
assert(SvTYPE(sv) == SVt_PVGV);
assert(isGV_with_GP(sv));
@@ -601,7 +596,6 @@ do_clean_named_objs(pTHX_ SV *const sv)
static void
do_clean_named_io_objs(pTHX_ SV *const sv)
{
- dVAR;
SV *obj;
assert(SvTYPE(sv) == SVt_PVGV);
assert(isGV_with_GP(sv));
@@ -638,7 +632,6 @@ Attempt to destroy all objects not yet freed.
void
Perl_sv_clean_objs(pTHX)
{
- dVAR;
GV *olddef, *olderr;
PL_in_clean_objs = TRUE;
visit(do_clean_objs, SVf_ROK, SVf_ROK);
@@ -667,7 +660,6 @@ Perl_sv_clean_objs(pTHX)
static void
do_clean_all(pTHX_ SV *const sv)
{
- dVAR;
if (sv == (const SV *) PL_fdpid || sv == (const SV *)PL_strtab) {
/* don't clean pid table and strtab */
return;
@@ -690,7 +682,6 @@ SVs which are in complex self-referential hierarchies.
I32
Perl_sv_clean_all(pTHX)
{
- dVAR;
I32 cleaned;
PL_in_clean_all = TRUE;
cleaned = visit(do_clean_all, 0,0);
@@ -746,7 +737,6 @@ heads and bodies within the arenas must already have been freed.
void
Perl_sv_free_arenas(pTHX)
{
- dVAR;
SV* sva;
SV* svanext;
unsigned int i;
@@ -1076,7 +1066,6 @@ void *
Perl_more_bodies (pTHX_ const svtype sv_type, const size_t body_size,
const size_t arena_size)
{
- dVAR;
void ** const root = &PL_body_roots[sv_type];
struct arena_desc *adesc;
struct arena_set *aroot = (struct arena_set *) PL_body_arenas;
@@ -1084,6 +1073,9 @@ Perl_more_bodies (pTHX_ const svtype sv_type, const size_t body_size,
char *start;
const char *end;
const size_t good_arena_size = Perl_malloc_good_size(arena_size);
+#if defined(DEBUGGING) && defined(PERL_GLOBAL_STRUCT)
+ dVAR;
+#endif
#if defined(DEBUGGING) && !defined(PERL_GLOBAL_STRUCT_PRIVATE)
static bool done_sanity_check;
@@ -1182,7 +1174,6 @@ Perl_more_bodies (pTHX_ const svtype sv_type, const size_t body_size,
STATIC void *
S_new_body(pTHX_ const svtype sv_type)
{
- dVAR;
void *xpv;
new_body_inline(xpv, sv_type);
return xpv;
@@ -1209,7 +1200,6 @@ C<svtype>.
void
Perl_sv_upgrade(pTHX_ SV *const sv, svtype new_type)
{
- dVAR;
void* old_body;
void* new_body;
const svtype old_type = SvTYPE(sv);
@@ -1629,8 +1619,6 @@ Does not handle 'set' magic. See also C<sv_setiv_mg>.
void
Perl_sv_setiv(pTHX_ SV *const sv, const IV i)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_SETIV;
SV_CHECK_THINKFIRST_COW_DROP(sv);
@@ -1741,8 +1729,6 @@ Does not handle 'set' magic. See also C<sv_setnv_mg>.
void
Perl_sv_setnv(pTHX_ SV *const sv, const NV num)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_SETNV;
SV_CHECK_THINKFIRST_COW_DROP(sv);
@@ -1798,7 +1784,6 @@ Perl_sv_setnv_mg(pTHX_ SV *const sv, const NV num)
STATIC void
S_not_a_number(pTHX_ SV *const sv)
{
- dVAR;
SV *dsv;
char tmpbuf[64];
const char *pv;
@@ -2008,8 +1993,6 @@ S_sv_2iuv_non_preserve(pTHX_ SV *const sv
# endif
)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_2IUV_NON_PRESERVE;
PERL_UNUSED_CONTEXT;
@@ -2060,8 +2043,6 @@ S_sv_2iuv_non_preserve(pTHX_ SV *const sv
STATIC bool
S_sv_2iuv_common(pTHX_ SV *const sv)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_2IUV_COMMON;
if (SvNOKp(sv)) {
@@ -2338,8 +2319,6 @@ Normally used via the C<SvIV(sv)> and C<SvIVx(sv)> macros.
IV
Perl_sv_2iv_flags(pTHX_ SV *const sv, const I32 flags)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_2IV_FLAGS;
assert (SvTYPE(sv) != SVt_PVAV && SvTYPE(sv) != SVt_PVHV
@@ -2433,8 +2412,6 @@ Normally used via the C<SvUV(sv)> and C<SvUVx(sv)> macros.
UV
Perl_sv_2uv_flags(pTHX_ SV *const sv, const I32 flags)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_2UV_FLAGS;
if (SvGMAGICAL(sv) && (flags & SV_GMAGIC))
@@ -2515,8 +2492,6 @@ Normally used via the C<SvNV(sv)> and C<SvNVx(sv)> macros.
NV
Perl_sv_2nv_flags(pTHX_ SV *const sv, const I32 flags)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_2NV_FLAGS;
assert (SvTYPE(sv) != SVt_PVAV && SvTYPE(sv) != SVt_PVHV
@@ -2818,7 +2793,6 @@ C<sv_2pv()> and C<sv_2pv_nomg> usually end up here too.
char *
Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags)
{
- dVAR;
char *s;
PERL_ARGS_ASSERT_SV_2PV_FLAGS;
@@ -3189,8 +3163,6 @@ contain SV_GMAGIC, then it does an mg_get() first.
bool
Perl_sv_2bool_flags(pTHX_ SV *sv, I32 flags)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_2BOOL_FLAGS;
restart:
@@ -3306,8 +3278,6 @@ especially if it could return the position of the first one.
STRLEN
Perl_sv_utf8_upgrade_flags_grow(pTHX_ SV *const sv, const I32 flags, STRLEN extra)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_UTF8_UPGRADE_FLAGS_GROW;
if (sv == &PL_sv_undef)
@@ -3566,8 +3536,6 @@ use the Encode extension for that.
bool
Perl_sv_utf8_downgrade(pTHX_ SV *const sv, const bool fail_ok)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_UTF8_DOWNGRADE;
if (SvPOKp(sv) && SvUTF8(sv)) {
@@ -4105,7 +4073,6 @@ S_sv_buf_to_rw(pTHX_ SV *sv)
void
Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* sstr, const I32 flags)
{
- dVAR;
U32 sflags;
int dtype;
svtype stype;
@@ -4705,7 +4672,6 @@ undefined. Does not handle 'set' magic. See C<sv_setpvn_mg>.
void
Perl_sv_setpvn(pTHX_ SV *const sv, const char *const ptr, const STRLEN len)
{
- dVAR;
char *dptr;
PERL_ARGS_ASSERT_SV_SETPVN;
@@ -4763,7 +4729,6 @@ Does not handle 'set' magic. See C<sv_setpv_mg>.
void
Perl_sv_setpv(pTHX_ SV *const sv, const char *const ptr)
{
- dVAR;
STRLEN len;
PERL_ARGS_ASSERT_SV_SETPV;
@@ -4804,8 +4769,6 @@ Perl_sv_setpv_mg(pTHX_ SV *const sv, const char *const ptr)
void
Perl_sv_sethek(pTHX_ SV *const sv, const HEK *const hek)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_SETHEK;
if (!hek) {
@@ -4875,7 +4838,6 @@ C<len>, and already meets the requirements for storing in C<SvPVX>).
void
Perl_sv_usepvn_flags(pTHX_ SV *const sv, char *ptr, const STRLEN len, const U32 flags)
{
- dVAR;
STRLEN allocate;
PERL_ARGS_ASSERT_SV_USEPVN_FLAGS;
@@ -4998,8 +4960,6 @@ of. Hence, it croaks on read-only values.
static void
S_sv_uncow(pTHX_ SV * const sv, const U32 flags)
{
- dVAR;
-
assert(SvIsCOW(sv));
{
#ifdef PERL_ANY_COW
@@ -5272,7 +5232,6 @@ in terms of this function.
void
Perl_sv_catpvn_flags(pTHX_ SV *const dsv, const char *sstr, const STRLEN slen, const I32 flags)
{
- dVAR;
STRLEN dlen;
const char * const dstr = SvPV_force_flags(dsv, dlen, flags);
@@ -5338,8 +5297,6 @@ and C<sv_catsv_mg> are implemented in terms of this function.
void
Perl_sv_catsv_flags(pTHX_ SV *const dsv, SV *const ssv, const I32 flags)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_CATSV_FLAGS;
if (ssv) {
@@ -5369,7 +5326,6 @@ valid UTF-8. Handles 'get' magic, but not 'set' magic. See C<sv_catpv_mg>.
void
Perl_sv_catpv(pTHX_ SV *const sv, const char *ptr)
{
- dVAR;
STRLEN len;
STRLEN tlen;
char *junk;
@@ -5445,7 +5401,6 @@ modules supporting older perls.
SV *
Perl_newSV(pTHX_ const STRLEN len)
{
- dVAR;
SV *sv;
new_SV(sv);
@@ -5478,7 +5433,6 @@ MAGIC *
Perl_sv_magicext(pTHX_ SV *const sv, SV *const obj, const int how,
const MGVTBL *const vtable, const char *const name, const I32 namlen)
{
- dVAR;
MAGIC* mg;
PERL_ARGS_ASSERT_SV_MAGICEXT;
@@ -5586,7 +5540,6 @@ void
Perl_sv_magic(pTHX_ SV *const sv, SV *const obj, const int how,
const char *const name, const I32 namlen)
{
- dVAR;
const MGVTBL *vtable;
MAGIC* mg;
unsigned int flags;
@@ -5793,7 +5746,6 @@ Perl_sv_rvweaken(pTHX_ SV *const sv)
void
Perl_sv_add_backref(pTHX_ SV *const tsv, SV *const sv)
{
- dVAR;
SV **svp;
AV *av = NULL;
MAGIC *mg = NULL;
@@ -5854,7 +5806,6 @@ Perl_sv_add_backref(pTHX_ SV *const tsv, SV *const sv)
void
Perl_sv_del_backref(pTHX_ SV *const tsv, SV *const sv)
{
- dVAR;
SV **svp = NULL;
PERL_ARGS_ASSERT_SV_DEL_BACKREF;
@@ -6076,7 +6027,6 @@ C<SvPV_force_flags> that applies to C<bigstr>.
void
Perl_sv_insert_flags(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len, const char *const little, const STRLEN littlelen, const U32 flags)
{
- dVAR;
char *big;
char *mid;
char *midend;
@@ -6174,7 +6124,6 @@ time you'll want to use C<sv_setsv> or one of its many macro front-ends.
void
Perl_sv_replace(pTHX_ SV *const sv, SV *const nsv)
{
- dVAR;
const U32 refcnt = SvREFCNT(sv);
PERL_ARGS_ASSERT_SV_REPLACE;
@@ -6652,8 +6601,6 @@ Perl_sv_clear(pTHX_ SV *const orig_sv)
static bool
S_curse(pTHX_ SV * const sv, const bool check_refcnt) {
- dVAR;
-
PERL_ARGS_ASSERT_CURSE;
assert(SvOBJECT(sv));
@@ -6913,7 +6860,6 @@ Perl_sv_len_utf8(pTHX_ SV *const sv)
STRLEN
Perl_sv_len_utf8_nomg(pTHX_ SV * const sv)
{
- dVAR;
STRLEN len;
const U8 *s = (U8*)SvPV_nomg_const(sv, len);
@@ -7588,7 +7534,6 @@ if necessary. If the flags include SV_GMAGIC, it handles get-magic, too.
I32
Perl_sv_eq_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
{
- dVAR;
const char *pv1;
STRLEN cur1;
const char *pv2;
@@ -7690,7 +7635,6 @@ I32
Perl_sv_cmp_flags(pTHX_ SV *const sv1, SV *const sv2,
const U32 flags)
{
- dVAR;
STRLEN cur1, cur2;
const char *pv1, *pv2;
I32 cmp;
@@ -7786,7 +7730,6 @@ I32
Perl_sv_cmp_locale_flags(pTHX_ SV *const sv1, SV *const sv2,
const U32 flags)
{
- dVAR;
#ifdef USE_LOCALE_COLLATE
char *pv1, *pv2;
@@ -7859,7 +7802,6 @@ settings.
char *
Perl_sv_collxfrm_flags(pTHX_ SV *const sv, STRLEN *const nxp, const I32 flags)
{
- dVAR;
MAGIC *mg;
PERL_ARGS_ASSERT_SV_COLLXFRM_FLAGS;
@@ -8050,7 +7992,6 @@ in the SV (typically, C<SvCUR(sv)> is a suitable choice).
char *
Perl_sv_gets(pTHX_ SV *const sv, PerlIO *const fp, I32 append)
{
- dVAR;
const char *rsptr;
STRLEN rslen;
STDCHAR rslast;
@@ -8520,7 +8461,6 @@ if necessary. Handles operator overloading. Skips handling 'get' magic.
void
Perl_sv_inc_nomg(pTHX_ SV *const sv)
{
- dVAR;
char *d;
int flags;
@@ -8682,7 +8622,6 @@ if necessary. Handles 'get' magic and operator overloading.
void
Perl_sv_dec(pTHX_ SV *const sv)
{
- dVAR;
if (!sv)
return;
SvGETMAGIC(sv);
@@ -8701,7 +8640,6 @@ if necessary. Handles operator overloading. Skips handling 'get' magic.
void
Perl_sv_dec_nomg(pTHX_ SV *const sv)
{
- dVAR;
int flags;
if (!sv)
@@ -8838,7 +8776,6 @@ statement boundaries. See also C<sv_newmortal> and C<sv_2mortal>.
SV *
Perl_sv_mortalcopy_flags(pTHX_ SV *const oldstr, U32 flags)
{
- dVAR;
SV *sv;
if (flags & SV_GMAGIC)
@@ -8864,7 +8801,6 @@ See also C<sv_mortalcopy> and C<sv_2mortal>.
SV *
Perl_sv_newmortal(pTHX)
{
- dVAR;
SV *sv;
new_SV(sv);
@@ -8898,7 +8834,6 @@ C<newSVpvn_utf8()> is a convenience wrapper for this function, defined as
SV *
Perl_newSVpvn_flags(pTHX_ const char *const s, const STRLEN len, const U32 flags)
{
- dVAR;
SV *sv;
/* All the flags we don't support must be zero.
@@ -8966,7 +8901,6 @@ For efficiency, consider using C<newSVpvn> instead.
SV *
Perl_newSVpv(pTHX_ const char *const s, const STRLEN len)
{
- dVAR;
SV *sv;
new_SV(sv);
@@ -8990,9 +8924,7 @@ undefined.
SV *
Perl_newSVpvn(pTHX_ const char *const buffer, const STRLEN len)
{
- dVAR;
SV *sv;
-
new_SV(sv);
sv_setpvn(sv,buffer,len);
return sv;
@@ -9011,7 +8943,6 @@ SV if the hek is NULL.
SV *
Perl_newSVhek(pTHX_ const HEK *const hek)
{
- dVAR;
if (!hek) {
SV *sv;
@@ -9179,7 +9110,6 @@ Perl_newSVpvf(pTHX_ const char *const pat, ...)
SV *
Perl_vnewSVpvf(pTHX_ const char *const pat, va_list *const args)
{
- dVAR;
SV *sv;
PERL_ARGS_ASSERT_VNEWSVPVF;
@@ -9201,7 +9131,6 @@ The reference count for the SV is set to 1.
SV *
Perl_newSVnv(pTHX_ const NV n)
{
- dVAR;
SV *sv;
new_SV(sv);
@@ -9221,7 +9150,6 @@ SV is set to 1.
SV *
Perl_newSViv(pTHX_ const IV i)
{
- dVAR;
SV *sv;
new_SV(sv);
@@ -9241,7 +9169,6 @@ The reference count for the SV is set to 1.
SV *
Perl_newSVuv(pTHX_ const UV u)
{
- dVAR;
SV *sv;
new_SV(sv);
@@ -9280,7 +9207,6 @@ SV is B<not> incremented.
SV *
Perl_newRV_noinc(pTHX_ SV *const tmpRef)
{
- dVAR;
SV *sv = newSV_type(SVt_IV);
PERL_ARGS_ASSERT_NEWRV_NOINC;
@@ -9298,8 +9224,6 @@ Perl_newRV_noinc(pTHX_ SV *const tmpRef)
SV *
Perl_newRV(pTHX_ SV *const sv)
{
- dVAR;
-
PERL_ARGS_ASSERT_NEWRV;
return newRV_noinc(SvREFCNT_inc_simple_NN(sv));
@@ -9317,7 +9241,6 @@ Creates a new SV which is an exact duplicate of the original SV.
SV *
Perl_newSVsv(pTHX_ SV *const old)
{
- dVAR;
SV *sv;
if (!old)
@@ -9355,7 +9278,6 @@ Perl_sv_reset(pTHX_ const char *s, HV *const stash)
void
Perl_sv_resetpvn(pTHX_ const char *s, STRLEN len, HV * const stash)
{
- dVAR;
char todo[PERL_UCHAR_MAX+1];
const char *send;
@@ -9500,7 +9422,6 @@ The flags in C<lref> are passed to gv_fetchsv.
CV *
Perl_sv_2cv(pTHX_ SV *sv, HV **const st, GV **const gvp, const I32 lref)
{
- dVAR;
GV *gv = NULL;
CV *cv = NULL;
@@ -9624,8 +9545,6 @@ C<SvPV_force> and C<SvPV_force_nomg>
char *
Perl_sv_pvn_force_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_PVN_FORCE_FLAGS;
if (flags & SV_GMAGIC) SvGETMAGIC(sv);
@@ -9869,7 +9788,6 @@ reference count is 1. The reference count 1 is owned by C<rv>.
SV*
Perl_newSVrv(pTHX_ SV *const rv, const char *const classname)
{
- dVAR;
SV *sv;
PERL_ARGS_ASSERT_NEWSVRV;
@@ -9937,8 +9855,6 @@ Note that C<sv_setref_pvn> copies the string while this copies the pointer.
SV*
Perl_sv_setref_pv(pTHX_ SV *const rv, const char *const classname, void *const pv)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_SETREF_PV;
if (!pv) {
@@ -10051,7 +9967,6 @@ of the SV is unaffected.
SV*
Perl_sv_bless(pTHX_ SV *const sv, HV *const stash)
{
- dVAR;
SV *tmpRef;
HV *oldstash = NULL;
@@ -10089,7 +10004,6 @@ Perl_sv_bless(pTHX_ SV *const sv, HV *const stash)
PERL_STATIC_INLINE void
S_sv_unglob(pTHX_ SV *const sv, U32 flags)
{
- dVAR;
void *xpvmg;
HV *stash;
SV * const temp = flags & SV_COW_DROP_PV ? NULL : sv_newmortal();
@@ -10539,7 +10453,6 @@ S_vcatpvfn_missing_argument(pTHX) {
STATIC I32
S_expect_number(pTHX_ char **const pattern)
{
- dVAR;
I32 var = 0;
PERL_ARGS_ASSERT_EXPECT_NUMBER;
@@ -10626,7 +10539,6 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
va_list *const args, SV **const svargs, const I32 svmax, bool *const maybe_tainted,
const U32 flags)
{
- dVAR;
char *p;
char *q;
const char *patend;
@@ -14311,8 +14223,6 @@ The PV of the sv is returned.
char *
Perl_sv_recode_to_utf8(pTHX_ SV *sv, SV *encoding)
{
- dVAR;
-
PERL_ARGS_ASSERT_SV_RECODE_TO_UTF8;
if (SvPOK(sv) && !SvUTF8(sv) && !IN_BYTES && SvROK(encoding)) {
@@ -14390,7 +14300,6 @@ bool
Perl_sv_cat_decode(pTHX_ SV *dsv, SV *encoding,
SV *ssv, int *offset, char *tstr, int tlen)
{
- dVAR;
bool ret = FALSE;
PERL_ARGS_ASSERT_SV_CAT_DECODE;
@@ -14476,8 +14385,6 @@ S_find_hash_subscript(pTHX_ const HV *const hv, const SV *const val)
STATIC I32
S_find_array_subscript(pTHX_ const AV *const av, const SV *const val)
{
- dVAR;
-
PERL_ARGS_ASSERT_FIND_ARRAY_SUBSCRIPT;
if (!av || SvMAGICAL(av) || !AvARRAY(av) ||
@@ -15045,7 +14952,6 @@ Print appropriate "Use of uninitialized variable" warning.
void
Perl_report_uninit(pTHX_ const SV *uninit_sv)
{
- dVAR;
if (PL_op) {
SV* varname = NULL;
if (uninit_sv && PL_curpad) {