… | |
… | |
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 (); \ |
… | |
… | |
46 | void |
50 | void |
47 | find_ (SV *target) |
51 | find_ (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 | { |
|
|
87 | /* I have no clue what this is */ |
|
|
88 | /* maybe some placeholder for our variables for eval? */ |
|
|
89 | /* it doesn'T seem to reference anything, so we should be able to ignore it */ |
|
|
90 | } |
|
|
91 | else |
|
|
92 | { |
|
|
93 | MAGIC *mg = SvMAGIC (sv); |
|
|
94 | |
|
|
95 | while (mg) |
|
|
96 | { |
82 | if (mg->mg_obj == targ) |
97 | if (mg->mg_obj == targ) |
83 | res_pair (form ("referenced (in mg_obj) by '%c' type magic attached to", mg->mg_type)); |
98 | res_pair (form ("referenced (in mg_obj) by '%c' type magic attached to", mg->mg_type)); |
84 | |
99 | |
85 | if ((SV *)mg->mg_ptr == targ && mg->mg_flags & MGf_REFCOUNTED) |
100 | if ((SV *)mg->mg_ptr == targ && mg->mg_flags & MGf_REFCOUNTED) |
86 | res_pair (form ("referenced (in mg_ptr) by '%c' type magic attached to", mg->mg_type)); |
101 | res_pair (form ("referenced (in mg_ptr) by '%c' type magic attached to", mg->mg_type)); |
87 | |
102 | |
88 | mg = mg->mg_moremagic; |
103 | mg = mg->mg_moremagic; |
|
|
104 | } |
89 | } |
105 | } |
90 | } |
106 | } |
91 | |
107 | |
92 | if (SvROK (sv)) |
108 | if (SvROK (sv)) |
93 | { |
109 | { |