File Coverage

Faster.xs
Criterion Covered Total %
statement 57 61 93.4
branch 6 8 75.0
condition n/a
subroutine n/a
pod n/a
total 63 69 91.3


line stmt bran cond sub pod time code
1             #include "EXTERN.h"
2             #include "perl.h"
3             #include "XSUB.h"
4             #include "ppport.h"
5             #include
6              
7             #include "gzip-faster-perl.c"
8              
9             typedef gzip_faster_t * Gzip__Faster;
10              
11             MODULE=Gzip::Faster PACKAGE=Gzip::Faster
12              
13             PROTOTYPES: DISABLE
14              
15             SV * gzip (plain)
16             SV * plain
17             PREINIT:
18             gzip_faster_t gz;
19             CODE:
20 7           gz.in = plain;
21 7           gz.is_gzip = 1;
22 7           gz.is_raw = 0;
23 7           gz.user_object = 0;
24 7           RETVAL = gzip_faster (& gz);
25             OUTPUT:
26             RETVAL
27              
28             SV * gunzip (zipped)
29             SV * zipped
30             PREINIT:
31             gzip_faster_t gz;
32             CODE:
33 10           gz.in = zipped;
34 10           gz.is_gzip = 1;
35 10           gz.is_raw = 0;
36 10           gz.user_object = 0;
37 10           RETVAL = gunzip_faster (& gz);
38             OUTPUT:
39             RETVAL
40              
41             SV * deflate (plain)
42             SV * plain
43             PREINIT:
44             gzip_faster_t gz;
45             CODE:
46 2           gz.in = plain;
47 2           gz.is_gzip = 0;
48 2           gz.is_raw = 0;
49 2           gz.user_object = 0;
50 2           RETVAL = gzip_faster (& gz);
51             OUTPUT:
52             RETVAL
53              
54             SV * inflate (deflated)
55             SV * deflated
56             PREINIT:
57             gzip_faster_t gz;
58             CODE:
59 2           gz.in = deflated;
60 2           gz.is_gzip = 0;
61 2           gz.is_raw = 0;
62 2           gz.user_object = 0;
63 2           RETVAL = gunzip_faster (& gz);
64             OUTPUT:
65             RETVAL
66              
67             SV * deflate_raw (plain)
68             SV * plain
69             PREINIT:
70             gzip_faster_t gz;
71             CODE:
72 3           gz.in = plain;
73 3           gz.is_gzip = 0;
74 3           gz.is_raw = 1;
75 3           gz.user_object = 0;
76 3           RETVAL = gzip_faster (& gz);
77             OUTPUT:
78             RETVAL
79              
80             SV * inflate_raw (deflated)
81             SV * deflated
82             PREINIT:
83             gzip_faster_t gz;
84             CODE:
85 3           gz.is_gzip = 0;
86 3           gz.is_raw = 1;
87 3           gz.in = deflated;
88 3           gz.user_object = 0;
89 3           RETVAL = gunzip_faster (& gz);
90             OUTPUT:
91             RETVAL
92              
93             Gzip::Faster
94             new (class)
95             const char * class;
96             CODE:
97 17           Newxz (RETVAL, 1, gzip_faster_t);
98 17           new_user_object (RETVAL);
99 17 50         if (! class) {
100 0           croak ("No class");
101             }
102             OUTPUT:
103             RETVAL
104              
105             void
106             DESTROY (gf)
107             Gzip::Faster gf
108             CODE:
109 17 50         if (! gf->user_object) {
110 0           croak ("%s:%d: THIS IS NOT A USER-VISIBLE OBJECT",
111             __FILE__, __LINE__);
112             }
113 17           gf_delete_file_name (gf);
114 17           gf_delete_mod_time (gf);
115 17           Safefree (gf);
116              
117             void
118             level (gf, level = Z_DEFAULT_COMPRESSION)
119             Gzip::Faster gf;
120             int level;
121             CODE:
122 3           set_compression_level (gf, level);
123              
124             SV *
125             zip (gf, plain)
126             Gzip::Faster gf;
127             SV * plain;
128             CODE:
129 11           gf->in = plain;
130 11           RETVAL = gzip_faster (gf);
131             OUTPUT:
132             RETVAL
133              
134             SV *
135             unzip (gf, deflated)
136             Gzip::Faster gf
137             SV * deflated
138             CODE:
139 12           gf->in = deflated;
140 12           RETVAL = gunzip_faster (gf);
141             OUTPUT:
142             RETVAL
143              
144             void
145             copy_perl_flags (gf, on_off)
146             Gzip::Faster gf;
147             SV * on_off;
148             CODE:
149 1           gf->copy_perl_flags = SvTRUE (on_off);
150              
151             void
152             raw (gf, on_off)
153             Gzip::Faster gf;
154             SV * on_off;
155             CODE:
156 1           gf->is_raw = SvTRUE (on_off);
157 1           gf->is_gzip = 0;
158              
159             void
160             gzip_format (gf, on_off)
161             Gzip::Faster gf;
162             SV * on_off;
163             CODE:
164 0           gf->is_gzip = SvTRUE (on_off);
165 0           gf->is_raw = 0;
166              
167             SV *
168             file_name (gf, filename = 0)
169             Gzip::Faster gf;
170             SV * filename;
171             CODE:
172 11 100         if (filename) {
173 4           gf_set_file_name (gf, filename);
174             /* We increment the reference count twice, once here
175             because it returns its own value, and once in
176             gf_set_file_name. Unless the user captures the
177             following return value, Perl then decrements it by
178             one as the return value is discarded, so it has to
179             be done twice. */
180 4           SvREFCNT_inc (filename);
181 4           RETVAL = filename;
182             }
183             else {
184 7           SvREFCNT_inc (gf->file_name);
185 7           RETVAL = gf_get_file_name (gf);
186             }
187             OUTPUT:
188             RETVAL
189              
190             SV *
191             mod_time (gf, modtime = 0)
192             Gzip::Faster gf;
193             SV * modtime;
194             CODE:
195 6 100         if (modtime) {
196 1           gf_set_mod_time (gf, modtime);
197             /* We increment the reference count twice, once here
198             because it returns its own value, and once in
199             gf_set_mod_time. Unless the user captures the
200             following return value, Perl then decrements it by
201             one as the return value is discarded, so it has to
202             be done twice. */
203 1           SvREFCNT_inc (modtime);
204 1           RETVAL = modtime;
205             }
206             else {
207 5           SvREFCNT_inc (gf->mod_time);
208 5           RETVAL = gf_get_mod_time (gf);
209             }
210             OUTPUT:
211             RETVAL