ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Devel-FindRef/FindRef.xs
(Generate patch)

Comparing Devel-FindRef/FindRef.xs (file contents):
Revision 1.8 by root, Sun Apr 27 05:59:06 2008 UTC vs.
Revision 1.9 by root, Fri Jul 11 15:29:48 2008 UTC

8 && (PERL_VERSION > (b) \ 8 && (PERL_VERSION > (b) \
9 || (PERL_VERSION == (b) && PERLSUBVERSION >= (c))))) 9 || (PERL_VERSION == (b) && PERLSUBVERSION >= (c)))))
10 10
11#if !PERL_VERSION_ATLEAST (5,8,9) 11#if !PERL_VERSION_ATLEAST (5,8,9)
12# define SVt_LAST 16 12# define SVt_LAST 16
13#endif
14
15#if !PERL_VERSION_ATLEAST (5,10,0)
16# define SvPAD_OUR(dummy) 0
13#endif 17#endif
14 18
15#define res_pair(text) \ 19#define res_pair(text) \
16 do { \ 20 do { \
17 AV *av = newAV (); \ 21 AV *av = newAV (); \
46void 50void
47find_ (SV *target) 51find_ (SV *target)
48 PPCODE: 52 PPCODE:
49{ 53{
50 SV *arena, *targ; 54 SV *arena, *targ;
51 int rmagical, i; 55 U32 rmagical;
56 int i;
52 AV *about = newAV (); 57 AV *about = newAV ();
53 AV *excl = newAV (); 58 AV *excl = newAV ();
54 59
55 if (!SvROK (target)) 60 if (!SvROK (target))
56 croak ("find expects a reference to a perl value"); 61 croak ("find expects a reference to a perl value");
74 if ((rmagical = SvRMAGICAL (sv))) 79 if ((rmagical = SvRMAGICAL (sv)))
75 SvRMAGICAL_off (sv); 80 SvRMAGICAL_off (sv);
76 81
77 if (SvTYPE (sv) >= SVt_PVMG) 82 if (SvTYPE (sv) >= SVt_PVMG)
78 { 83 {
79 MAGIC *mg = SvMAGIC (sv); 84
80 while (mg) 85 if (SvTYPE (sv) != SVt_PVMG || SvPAD_OUR (sv))
81 { 86 {
82 if (mg->mg_obj == targ) 87 MAGIC *mg = SvMAGIC (sv);
83 res_pair (form ("referenced (in mg_obj) by '%c' type magic attached to", mg->mg_type));
84 88
85 if ((SV *)mg->mg_ptr == targ && mg->mg_flags & MGf_REFCOUNTED) 89 while (mg)
90 {
91 if (mg->mg_obj == targ)
86 res_pair (form ("referenced (in mg_ptr) by '%c' type magic attached to", mg->mg_type)); 92 res_pair (form ("referenced (in mg_obj) by '%c' type magic attached to", mg->mg_type));
87 93
94 if ((SV *)mg->mg_ptr == targ && mg->mg_flags & MGf_REFCOUNTED)
95 res_pair (form ("referenced (in mg_ptr) by '%c' type magic attached to", mg->mg_type));
96
88 mg = mg->mg_moremagic; 97 mg = mg->mg_moremagic;
98 }
89 } 99 }
90 } 100 }
91 101
92 if (SvROK (sv)) 102 if (SvROK (sv))
93 { 103 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines