| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#include "EXTERN.h" |
|
2
|
|
|
|
|
|
|
#include "perl.h" |
|
3
|
|
|
|
|
|
|
#include "XSUB.h" |
|
4
|
|
|
|
|
|
|
#include "INLINE.h" |
|
5
|
|
|
|
|
|
|
|
|
6
|
10
|
|
|
|
|
|
AV* ckeys (AV* hashes) { |
|
7
|
|
|
|
|
|
|
int num_to_merge, i; |
|
8
|
|
|
|
|
|
|
HE *hash_entry; |
|
9
|
|
|
|
|
|
|
SV *sv_key, *hash_ref, *merge_ref; |
|
10
|
|
|
|
|
|
|
HV *merger, *hash; |
|
11
|
10
|
|
|
|
|
|
AV* hkeys = newAV(); |
|
12
|
|
|
|
|
|
|
|
|
13
|
10
|
|
|
|
|
|
merger = newHV(); |
|
14
|
10
|
|
|
|
|
|
num_to_merge = av_len(hashes) + 1; |
|
15
|
|
|
|
|
|
|
|
|
16
|
40
|
100
|
|
|
|
|
for (i = 0; i < num_to_merge; i++) { |
|
17
|
30
|
|
|
|
|
|
hash_ref = av_shift(hashes); |
|
18
|
30
|
50
|
|
|
|
|
if (SvTYPE(SvRV(hash_ref)) != SVt_PVHV) croak("Index is not a hash reference %d", i); |
|
19
|
30
|
|
|
|
|
|
hash = (HV*)SvRV(hash_ref); |
|
20
|
30
|
|
|
|
|
|
(void) hv_iterinit(hash); |
|
21
|
80
|
100
|
|
|
|
|
while ((hash_entry = hv_iternext(hash))) { |
|
22
|
50
|
|
|
|
|
|
sv_key = hv_iterkeysv(hash_entry); |
|
23
|
50
|
|
|
|
|
|
hv_store_ent(merger, sv_key, newSViv(1), 0); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
10
|
|
|
|
|
|
(void) hv_iterinit(merger); |
|
28
|
44
|
100
|
|
|
|
|
while ((hash_entry = hv_iternext(merger))) { |
|
29
|
34
|
|
|
|
|
|
sv_key = hv_iterkeysv(hash_entry); |
|
30
|
34
|
|
|
|
|
|
av_push(hkeys, newSVpvf("%s", SvPV(sv_key, PL_na))); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
10
|
|
|
|
|
|
sortsv(AvARRAY(hkeys), av_len(hkeys)+1, Perl_sv_cmp_locale); |
|
34
|
10
|
|
|
|
|
|
return hkeys; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
MODULE = Combine::Keys PACKAGE = Combine::Keys |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
AV * |
|
44
|
|
|
|
|
|
|
ckeys (hashes) |
|
45
|
|
|
|
|
|
|
AV * hashes |
|
46
|
|
|
|
|
|
|
|