… | |
… | |
8 | #include <stdio.h> |
8 | #include <stdio.h> |
9 | #include <limits.h> |
9 | #include <limits.h> |
10 | #include <float.h> |
10 | #include <float.h> |
11 | |
11 | |
12 | #include "ecb.h" |
12 | #include "ecb.h" |
|
|
13 | |
|
|
14 | // compatibility with perl <5.18 |
|
|
15 | #ifndef HvNAMELEN_get |
|
|
16 | # define HvNAMELEN_get(hv) strlen (HvNAME (hv)) |
|
|
17 | #endif |
|
|
18 | #ifndef HvNAMELEN |
|
|
19 | # define HvNAMELEN(hv) HvNAMELEN_get (hv) |
|
|
20 | #endif |
|
|
21 | #ifndef HvNAMEUTF8 |
|
|
22 | # define HvNAMEUTF8(hv) 0 |
|
|
23 | #endif |
13 | |
24 | |
14 | // known tags |
25 | // known tags |
15 | enum cbor_tag |
26 | enum cbor_tag |
16 | { |
27 | { |
17 | // inofficial extensions (pending iana registration) |
28 | // inofficial extensions (pending iana registration) |
… | |
… | |
598 | |
609 | |
599 | SV *k = decode_sv (dec); |
610 | SV *k = decode_sv (dec); |
600 | SV *v = decode_sv (dec); |
611 | SV *v = decode_sv (dec); |
601 | |
612 | |
602 | hv_store_ent (hv, k, v, 0); |
613 | hv_store_ent (hv, k, v, 0); |
|
|
614 | SvREFCNT_dec (k); |
603 | } |
615 | } |
604 | } |
616 | } |
605 | else |
617 | else |
606 | { |
618 | { |
607 | int len = decode_uint (dec); |
619 | int len = decode_uint (dec); |
… | |
… | |
610 | { |
622 | { |
611 | SV *k = decode_sv (dec); |
623 | SV *k = decode_sv (dec); |
612 | SV *v = decode_sv (dec); |
624 | SV *v = decode_sv (dec); |
613 | |
625 | |
614 | hv_store_ent (hv, k, v, 0); |
626 | hv_store_ent (hv, k, v, 0); |
|
|
627 | SvREFCNT_dec (k); |
615 | } |
628 | } |
616 | } |
629 | } |
617 | |
630 | |
618 | DEC_DEC_DEPTH; |
631 | DEC_DEC_DEPTH; |
619 | return newRV_noinc ((SV *)hv); |
632 | return newRV_noinc ((SV *)hv); |
… | |
… | |
708 | |
721 | |
709 | PUTBACK; |
722 | PUTBACK; |
710 | call_sv ((SV *)GvCV (method), G_SCALAR); |
723 | call_sv ((SV *)GvCV (method), G_SCALAR); |
711 | SPAGAIN; |
724 | SPAGAIN; |
712 | |
725 | |
|
|
726 | SvREFCNT_dec (sv); |
713 | sv = SvREFCNT_inc (POPs); |
727 | sv = SvREFCNT_inc (POPs); |
714 | |
728 | |
715 | PUTBACK; |
729 | PUTBACK; |
716 | |
730 | |
717 | FREETMPS; LEAVE; |
731 | FREETMPS; LEAVE; |