| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#include "EXTERN.h" |
|
2
|
|
|
|
|
|
|
#include "perl.h" |
|
3
|
|
|
|
|
|
|
#include "XSUB.h" |
|
4
|
|
|
|
|
|
|
|
|
5
|
7
|
|
|
|
|
|
int arrays_same_i (SV* x, SV* y) { |
|
6
|
7
|
|
|
|
|
|
AV* arrx = (AV*)SvRV(x); |
|
7
|
7
|
|
|
|
|
|
AV* arry = (AV*)SvRV(y); |
|
8
|
7
|
50
|
|
|
|
|
if (arrx == arry) { |
|
9
|
0
|
|
|
|
|
|
return 2; |
|
10
|
|
|
|
|
|
|
} |
|
11
|
7
|
|
|
|
|
|
int len = av_len(arrx); |
|
12
|
7
|
100
|
|
|
|
|
if (len != av_len(arry)) { |
|
13
|
2
|
|
|
|
|
|
return 0; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
int i; |
|
16
|
11
|
100
|
|
|
|
|
for (i=0; i<=len; i++) { |
|
17
|
8
|
|
|
|
|
|
SV** elemx = av_fetch(arrx, i, 0); |
|
18
|
8
|
|
|
|
|
|
SV** elemy = av_fetch(arry, i, 0); |
|
19
|
8
|
100
|
|
|
|
|
int ix = SvIV(*elemx); |
|
20
|
8
|
100
|
|
|
|
|
int iy = SvIV(*elemy); |
|
21
|
8
|
100
|
|
|
|
|
if (ix != iy) { |
|
22
|
2
|
|
|
|
|
|
return 0; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
} |
|
25
|
3
|
|
|
|
|
|
return 1; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
7
|
|
|
|
|
|
int arrays_same_s (SV* x, SV* y) { |
|
29
|
7
|
|
|
|
|
|
AV* arrx = (AV*)SvRV(x); |
|
30
|
7
|
|
|
|
|
|
AV* arry = (AV*)SvRV(y); |
|
31
|
7
|
50
|
|
|
|
|
if (arrx == arry) { |
|
32
|
0
|
|
|
|
|
|
return 2; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
7
|
|
|
|
|
|
int len = av_len(arrx); |
|
35
|
7
|
100
|
|
|
|
|
if (len != av_len(arry)) { |
|
36
|
2
|
|
|
|
|
|
return 0; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
int i; |
|
39
|
10
|
100
|
|
|
|
|
for (i=0; i<=len; i++) { |
|
40
|
8
|
|
|
|
|
|
SV** elemx = av_fetch(arrx, i, 0); |
|
41
|
8
|
|
|
|
|
|
SV** elemy = av_fetch(arry, i, 0); |
|
42
|
|
|
|
|
|
|
STRLEN dummy; |
|
43
|
8
|
100
|
|
|
|
|
char* strx = SvPV(*elemx, dummy); |
|
44
|
8
|
100
|
|
|
|
|
char* stry = SvPV(*elemy, dummy); |
|
45
|
8
|
100
|
|
|
|
|
if (strcmp(strx, stry) != 0) { |
|
46
|
3
|
|
|
|
|
|
return 0; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
} |
|
49
|
2
|
|
|
|
|
|
return 1; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
MODULE = Arrays::Same PACKAGE = Arrays::Same |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
int |
|
57
|
|
|
|
|
|
|
arrays_same_i (x, y) |
|
58
|
|
|
|
|
|
|
SV * x |
|
59
|
|
|
|
|
|
|
SV * y |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
int |
|
62
|
|
|
|
|
|
|
arrays_same_s (x, y) |
|
63
|
|
|
|
|
|
|
SV * x |
|
64
|
|
|
|
|
|
|
SV * y |