XS.xs

filter: Statementstmt 91.6% 33 / 36 Branchbran 61.7% 21 / 34 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 77.1% 54 / 70 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
↑ Summary src/xh_x2h.h »
1 #include "src/xh_config.h"
2 #include "src/xh_core.h"
3  
4 MODULE = XML::Hash::XS PACKAGE = XML::Hash::XS
5  
6 PROTOTYPES: DISABLE
7  
8 xh_opts_t *
9 new(CLASS,...)
10 PREINIT:
11 xh_opts_t *opts;
12 CODE:
13 3 dXCPT;
14  
15 3 ▶ if ((opts = xh_create_opts()) == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((opts = xh_create_opts()) == NULL) 0 3 3
16 0 croak("Malloc error in new()");
17  
18 3 ▶ XCPT_TRY_START
Branch: 1 branch
BranchTrueFalseTotal
XCPT_TRY_START 3 2 5
19 {
20 3 xh_parse_param(opts, 1, ax, items);
21 3 } XCPT_TRY_END
22  
23 3 ▶ XCPT_CATCH
Branch: 1 branch
BranchTrueFalseTotal
XCPT_CATCH 2 1 3
24 {
25 2 xh_destroy_opts(opts);
26 2 ▶ XCPT_RETHROW;
Branch: 2 branches
BranchTrueFalseTotal
XCPT_RETHROW; 2 0 2
XCPT_RETHROW; 0 0 0
27 }
28  
29 1 RETVAL = opts;
30 OUTPUT:
31 RETVAL
32  
33 SV *
34 hash2xml(...)
35 PREINIT:
36 xh_h2x_ctx_t ctx;
37 SV *result;
38 CODE:
39 41 dXCPT;
40 41 ▶ XCPT_TRY_START
Branch: 1 branch
BranchTrueFalseTotal
XCPT_TRY_START 41 0 41
41 {
42 41 xh_h2x_init_ctx(&ctx, ax, items);
43  
44 /* hack */
45 #ifdef XH_HAVE_DOM
46 if (ctx.opts.doc) {
47 result = xh_h2d(&ctx);
48 }
49 else {
50 result = xh_h2x(&ctx);
51 }
52 #else
53 41 result = xh_h2x(&ctx);
54 #endif
55 41 } XCPT_TRY_END
56  
57 41 ▶ XCPT_CATCH
Branch: 1 branch
BranchTrueFalseTotal
XCPT_CATCH 0 41 41
58 {
59 0 xh_h2x_destroy_ctx(&ctx);
60 0 ▶ XCPT_RETHROW;
Branch: 2 branches
BranchTrueFalseTotal
XCPT_RETHROW; 0 0 0
XCPT_RETHROW; 0 0 0
61 }
62  
63 41 ▶ if (ctx.opts.output != NULL) result = NULL;
Branch: 1 branch
BranchTrueFalseTotal
if (ctx.opts.output != NULL) result = NULL; 2 39 41
64  
65 41 xh_h2x_destroy_ctx(&ctx);
66  
67 41 ▶ if (result == NULL) XSRETURN_UNDEF;
Branch: 1 branch
BranchTrueFalseTotal
if (result == NULL) XSRETURN_UNDEF; 2 39 41
68  
69 39 RETVAL = result;
70  
71 OUTPUT:
72 RETVAL
73  
74 SV *
75 xml2hash(...)
76 PREINIT:
77 xh_x2h_ctx_t ctx;
78 SV *result;
79 CODE:
80 16 dXCPT;
81 16 ▶ XCPT_TRY_START
Branch: 1 branch
BranchTrueFalseTotal
XCPT_TRY_START 16 4 20
82 {
83 16 xh_x2h_init_ctx(&ctx, ax, items);
84  
85 16 result = xh_x2h(&ctx);
86 16 } XCPT_TRY_END
87  
88 16 ▶ XCPT_CATCH
Branch: 1 branch
BranchTrueFalseTotal
XCPT_CATCH 4 12 16
89 {
90 4 xh_x2h_destroy_ctx(&ctx);
91 4 ▶ XCPT_RETHROW;
Branch: 2 branches
BranchTrueFalseTotal
XCPT_RETHROW; 4 0 4
XCPT_RETHROW; 0 0 0
92 }
93  
94 12 ▶ if (ctx.opts.cb != NULL) result = NULL;
Branch: 1 branch
BranchTrueFalseTotal
if (ctx.opts.cb != NULL) result = NULL; 1 11 12
95  
96 12 xh_x2h_destroy_ctx(&ctx);
97  
98 12 ▶ if (result == NULL) XSRETURN_UNDEF;
Branch: 1 branch
BranchTrueFalseTotal
if (result == NULL) XSRETURN_UNDEF; 1 11 12
99  
100 11 RETVAL = result;
101  
102 OUTPUT:
103 RETVAL
104  
105 void
106 DESTROY(opts)
107 xh_opts_t *opts;
108 CODE:
109 1 xh_destroy_opts(opts);
110 1 free(opts);
↑ Summary src/xh_x2h.h »