s |void |del_xrv |XRV* p
s |void |sv_unglob |SV* sv
s |void |not_a_number |SV *sv
-s |I32 |visit |SVFUNC_t f
+s |I32 |visit |SVFUNC_t f|U32 flags|U32 mask
s |void |sv_add_backref |SV *tsv|SV *sv
s |void |sv_del_backref |SV *sv
# ifdef DEBUGGING
#define not_a_number(a) S_not_a_number(aTHX_ a)
#endif
#ifdef PERL_CORE
-#define visit(a) S_visit(aTHX_ a)
+#define visit(a,b,c) S_visit(aTHX_ a,b,c)
#endif
#ifdef PERL_CORE
#define sv_add_backref(a,b) S_sv_add_backref(aTHX_ a,b)
STATIC void S_del_xrv(pTHX_ XRV* p);
STATIC void S_sv_unglob(pTHX_ SV* sv);
STATIC void S_not_a_number(pTHX_ SV *sv);
-STATIC I32 S_visit(pTHX_ SVFUNC_t f);
+STATIC I32 S_visit(pTHX_ SVFUNC_t f, U32 flags, U32 mask);
STATIC void S_sv_add_backref(pTHX_ SV *tsv, SV *sv);
STATIC void S_sv_del_backref(pTHX_ SV *sv);
# ifdef DEBUGGING
return sv;
}
-/* visit(): call the named function for each non-free SV in the arenas. */
+/* visit(): call the named function for each non-free SV in the arenas
+ * whose flags field matches the flags/mask args. */
STATIC I32
-S_visit(pTHX_ SVFUNC_t f)
+S_visit(pTHX_ SVFUNC_t f, U32 flags, U32 mask)
{
SV* sva;
SV* sv;
for (sva = PL_sv_arenaroot; sva; sva = (SV*)SvANY(sva)) {
svend = &sva[SvREFCNT(sva)];
for (sv = sva + 1; sv < svend; ++sv) {
- if (SvTYPE(sv) != SVTYPEMASK && SvREFCNT(sv)) {
+ if (SvTYPE(sv) != SVTYPEMASK
+ && (sv->sv_flags & mask) == flags
+ && SvREFCNT(sv))
+ {
(FCALL)(aTHX_ sv);
++visited;
}
Perl_sv_report_used(pTHX)
{
#ifdef DEBUGGING
- visit(do_report_used);
+ visit(do_report_used, 0, 0);
#endif
}
Perl_sv_clean_objs(pTHX)
{
PL_in_clean_objs = TRUE;
- visit(do_clean_objs);
+ visit(do_clean_objs, SVf_ROK, SVf_ROK);
#ifndef DISABLE_DESTRUCTOR_KLUDGE
/* some barnacles may yet remain, clinging to typeglobs */
- visit(do_clean_named_objs);
+ visit(do_clean_named_objs, SVt_PVGV, SVTYPEMASK);
#endif
PL_in_clean_objs = FALSE;
}
{
I32 cleaned;
PL_in_clean_all = TRUE;
- cleaned = visit(do_clean_all);
+ cleaned = visit(do_clean_all, 0,0);
PL_in_clean_all = FALSE;
return cleaned;
}