lib/Escape/Houdini.xs

filter: Statementstmt 100% 20 / 20 Branchbran 45.0% 36 / 80 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 56.0% 56 / 100 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
↑ Summary blib/lib/Escape/Houdini.pm »
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4 #include <buffer.h>
5 #include <houdini.h>
6  
7 #define WRAPPER(name) \
8 SV *_##name(SV *input){ \
9 gh_buf buffer = GH_BUF_INIT; \
10 SV *result; \
11 STRLEN slen; \
12 char *src_string; \
13 \
14 if( !SvPOK(input) && !SvNOK(input) && !SvIOK(input) ) {\
15 croak( #name "() argument not a string"); \
16 } \
17 \
18 src_string = SvPV(input, slen); \
19 \
20 if( !houdini_##name( &buffer, src_string, slen ) ) { \
21 return newSVsv(input); \
22 } \
23 \
24 result = newSVpvn( buffer.ptr, buffer.size ); \
25 gh_buf_free(&buffer); \
26 SvUTF8_on(result); \
27 \
28 return result; \
29 }
30  
31 19 ▶WRAPPER(escape_html)
Branch: 4 branches
BranchTrueFalseTotal
WRAPPER(escape_html) 2 8 10
WRAPPER(escape_html) 2 0 2
WRAPPER(escape_html) 1 1 2
WRAPPER(escape_html) 3 6 9
32 13 ▶WRAPPER(unescape_html)
Branch: 4 branches
BranchTrueFalseTotal
WRAPPER(unescape_html) 2 5 7
WRAPPER(unescape_html) 2 0 2
WRAPPER(unescape_html) 1 1 2
WRAPPER(unescape_html) 3 3 6
33 6 ▶WRAPPER(escape_xml)
Branch: 4 branches
BranchTrueFalseTotal
WRAPPER(escape_xml) 0 3 3
WRAPPER(escape_xml) 0 0 0
WRAPPER(escape_xml) 0 0 0
WRAPPER(escape_xml) 0 3 3
34 8 ▶WRAPPER(escape_url)
Branch: 4 branches
BranchTrueFalseTotal
WRAPPER(escape_url) 0 4 4
WRAPPER(escape_url) 0 0 0
WRAPPER(escape_url) 0 0 0
WRAPPER(escape_url) 0 4 4
35 8 ▶WRAPPER(escape_uri)
Branch: 4 branches
BranchTrueFalseTotal
WRAPPER(escape_uri) 0 4 4
WRAPPER(escape_uri) 0 0 0
WRAPPER(escape_uri) 0 0 0
WRAPPER(escape_uri) 1 3 4
36 8 ▶WRAPPER(unescape_url)
Branch: 4 branches
BranchTrueFalseTotal
WRAPPER(unescape_url) 0 4 4
WRAPPER(unescape_url) 0 0 0
WRAPPER(unescape_url) 0 0 0
WRAPPER(unescape_url) 2 2 4
37 8 ▶WRAPPER(unescape_uri)
Branch: 4 branches
BranchTrueFalseTotal
WRAPPER(unescape_uri) 0 4 4
WRAPPER(unescape_uri) 0 0 0
WRAPPER(unescape_uri) 0 0 0
WRAPPER(unescape_uri) 3 1 4
38 8 ▶WRAPPER(escape_js)
Branch: 4 branches
BranchTrueFalseTotal
WRAPPER(escape_js) 0 4 4
WRAPPER(escape_js) 0 0 0
WRAPPER(escape_js) 0 0 0
WRAPPER(escape_js) 2 2 4
39 8 ▶WRAPPER(unescape_js)
Branch: 4 branches
BranchTrueFalseTotal
WRAPPER(unescape_js) 0 4 4
WRAPPER(unescape_js) 0 0 0
WRAPPER(unescape_js) 0 0 0
WRAPPER(unescape_js) 2 2 4
40 8 ▶WRAPPER(escape_href)
Branch: 4 branches
BranchTrueFalseTotal
WRAPPER(escape_href) 0 4 4
WRAPPER(escape_href) 0 0 0
WRAPPER(escape_href) 0 0 0
WRAPPER(escape_href) 1 3 4
41  
42 MODULE = Escape::Houdini PACKAGE = Escape::Houdini
43  
44 SV *
45 escape_xml(str)
46 SV *str;
47 CODE:
48 3 RETVAL = _escape_xml(str);
49 OUTPUT:
50 RETVAL
51  
52 SV *
53 escape_html(str)
54 SV *str;
55 CODE:
56 10 RETVAL = _escape_html(str);
57 OUTPUT:
58 RETVAL
59  
60 SV *
61 unescape_html(str)
62 SV *str;
63 CODE:
64 7 RETVAL = _unescape_html(str);
65 OUTPUT:
66 RETVAL
67  
68 SV *
69 escape_uri(str)
70 SV *str;
71 CODE:
72 4 RETVAL = _escape_uri(str);
73 OUTPUT:
74 RETVAL
75  
76 SV *
77 escape_url(str)
78 SV *str;
79 CODE:
80 4 RETVAL = _escape_url(str);
81 OUTPUT:
82 RETVAL
83  
84 SV *
85 escape_href(str)
86 SV *str;
87 CODE:
88 4 RETVAL = _escape_href(str);
89 OUTPUT:
90 RETVAL
91  
92 SV *
93 unescape_uri(str)
94 SV *str;
95 CODE:
96 4 RETVAL = _unescape_uri(str);
97 OUTPUT:
98 RETVAL
99  
100 SV *
101 unescape_url(str)
102 SV *str;
103 CODE:
104 4 RETVAL = _unescape_url(str);
105 OUTPUT:
106 RETVAL
107  
108 SV *
109 escape_js(str)
110 SV *str;
111 CODE:
112 4 RETVAL = _escape_js(str);
113 OUTPUT:
114 RETVAL
115  
116 SV *
117 unescape_js(str)
118 SV *str;
119 CODE:
120 4 RETVAL = _unescape_js(str);
121 OUTPUT:
122 RETVAL
↑ Summary blib/lib/Escape/Houdini.pm »