blob: 483db735146728000ac7d7a01174061c12194f1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
MODULE = Hash::Util PACKAGE = Hash::Util
void
all_keys(hash,keys,placeholder)
HV *hash
AV *keys
AV *placeholder
PROTOTYPE: \%\@\@
PREINIT:
SV *key;
HE *he;
PPCODE:
av_clear(keys);
av_clear(placeholder);
(void)hv_iterinit(hash);
while((he = hv_iternext_flags(hash, HV_ITERNEXT_WANTPLACEHOLDERS))!= NULL) {
key=hv_iterkeysv(he);
av_push(HeVAL(he) == &PL_sv_placeholder ? placeholder : keys,
SvREFCNT_inc(key));
}
XSRETURN(1);
void
hidden_ref_keys(hash)
HV *hash
ALIAS:
Hash::Util::legal_ref_keys = 1
PREINIT:
SV *key;
HE *he;
PPCODE:
(void)hv_iterinit(hash);
while((he = hv_iternext_flags(hash, HV_ITERNEXT_WANTPLACEHOLDERS))!= NULL) {
key=hv_iterkeysv(he);
if (ix || HeVAL(he) == &PL_sv_placeholder) {
XPUSHs( key );
}
}
void
hv_store(hash, key, val)
HV *hash
SV* key
SV* val
PROTOTYPE: \%$$
CODE:
{
SvREFCNT_inc(val);
if (!hv_store_ent(hash, key, val, 0)) {
SvREFCNT_dec(val);
XSRETURN_NO;
} else {
XSRETURN_YES;
}
}
|