xs/installer.h

filter: Statementstmt 71.1% 242 / 340 Branchbran 40.6% 52 / 128 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 62.8% 294 / 468 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« xs/fimpl.h ↑ Summary xs/accessors.h »
1 #ifndef __INHERITED_XS_INSTALLER_H_
2 #define __INHERITED_XS_INSTALLER_H_
3  
4 inline void
5 887 CAIXS_payload_attach(pTHX_ CV* cv, AV* payload_av) {
6 #ifndef MULTIPLICITY
7 887 CvXSUBANY(cv).any_ptr = (void*)AvARRAY(payload_av);
8 #endif
9  
10 887 sv_magicext((SV*)cv, (SV*)payload_av, PERL_MAGIC_ext, &sv_payload_marker, NULL, 0);
11 887 SvREFCNT_dec_NN((SV*)payload_av);
12 887 SvRMAGICAL_off((SV*)cv);
13 887 }
14  
15 template <AccessorType type> static
16 shared_keys*
17 887 CAIXS_payload_init(pTHX_ CV* cv) {
18 887 AV* payload_av = newAV();
19  
20 887 av_extend(payload_av, ALLOC_SIZE[type]);
21 887 AvFILLp(payload_av) = ALLOC_SIZE[type];
22  
23 887 CAIXS_payload_attach(aTHX_ cv, payload_av);
24 887 return (shared_keys*)AvARRAY(payload_av);
25 }
26  
27 template <AccessorType type, AccessorOpts opts> static
28 CV*
29 0 CAIXS_install_cv(pTHX_ SV* full_name) {
30 STRLEN len;
31  
32 0 const char* full_name_buf = SvPV_const(full_name, len);
33 #ifdef CAIX_BINARY_UNSAFE
34 0 ▶ if (strnlen(full_name_buf, len) < len) {
Branch: 25 branches
BranchTrueFalseTotal
if (strnlen(full_name_buf, len) < len) { 0 1 1
if (strnlen(full_name_buf, len) < len) { 0 3 3
if (strnlen(full_name_buf, len) < len) { 0 0 0
if (strnlen(full_name_buf, len) < len) { 0 0 0
if (strnlen(full_name_buf, len) < len) { 0 0 0
if (strnlen(full_name_buf, len) < len) { 0 0 0
if (strnlen(full_name_buf, len) < len) { 0 0 0
if (strnlen(full_name_buf, len) < len) { 0 0 0
if (strnlen(full_name_buf, len) < len) { 0 0 0
if (strnlen(full_name_buf, len) < len) { 0 0 0
if (strnlen(full_name_buf, len) < len) { 0 1 1
if (strnlen(full_name_buf, len) < len) { 0 1 1
if (strnlen(full_name_buf, len) < len) { 0 1 1
if (strnlen(full_name_buf, len) < len) { 0 13 13
if (strnlen(full_name_buf, len) < len) { 0 0 0
if (strnlen(full_name_buf, len) < len) { 0 0 0
if (strnlen(full_name_buf, len) < len) { 0 1 1
if (strnlen(full_name_buf, len) < len) { 0 2 2
if (strnlen(full_name_buf, len) < len) { 0 3 3
if (strnlen(full_name_buf, len) < len) { 0 5 5
if (strnlen(full_name_buf, len) < len) { 0 2 2
if (strnlen(full_name_buf, len) < len) { 0 12 12
if (strnlen(full_name_buf, len) < len) { 0 438 438
if (strnlen(full_name_buf, len) < len) { 0 3 3
if (strnlen(full_name_buf, len) < len) { 0 404 404
35 0 croak("Attempted to install binary accessor, but they're not supported on this perl");
36 }
37 #endif
38  
39 0 CV* cv = Perl_newXS_len_flags(aTHX_ full_name_buf, len, (&CAIXS_entersub_wrapper<type, opts>), __FILE__, NULL, NULL, SvUTF8(full_name));
40 0 ▶ if (!cv) croak("Can't install XS accessor");
Branch: 25 branches
BranchTrueFalseTotal
if (!cv) croak("Can't install XS accessor"); 0 1 1
if (!cv) croak("Can't install XS accessor"); 0 3 3
if (!cv) croak("Can't install XS accessor"); 0 0 0
if (!cv) croak("Can't install XS accessor"); 0 0 0
if (!cv) croak("Can't install XS accessor"); 0 0 0
if (!cv) croak("Can't install XS accessor"); 0 0 0
if (!cv) croak("Can't install XS accessor"); 0 0 0
if (!cv) croak("Can't install XS accessor"); 0 0 0
if (!cv) croak("Can't install XS accessor"); 0 0 0
if (!cv) croak("Can't install XS accessor"); 0 0 0
if (!cv) croak("Can't install XS accessor"); 0 1 1
if (!cv) croak("Can't install XS accessor"); 0 1 1
if (!cv) croak("Can't install XS accessor"); 0 1 1
if (!cv) croak("Can't install XS accessor"); 0 13 13
if (!cv) croak("Can't install XS accessor"); 0 0 0
if (!cv) croak("Can't install XS accessor"); 0 0 0
if (!cv) croak("Can't install XS accessor"); 0 1 1
if (!cv) croak("Can't install XS accessor"); 0 2 2
if (!cv) croak("Can't install XS accessor"); 0 3 3
if (!cv) croak("Can't install XS accessor"); 0 5 5
if (!cv) croak("Can't install XS accessor"); 0 2 2
if (!cv) croak("Can't install XS accessor"); 0 12 12
if (!cv) croak("Can't install XS accessor"); 0 438 438
if (!cv) croak("Can't install XS accessor"); 0 3 3
if (!cv) croak("Can't install XS accessor"); 0 404 404
41  
42 0 return cv;
43 }
44  
45 template <AccessorType type, AccessorOpts opts>
46 struct CImpl {
47 2657 static shared_keys* CAIXS_install_accessor(pTHX_ AccessorOpts val, SV* full_name) {
48 28 if (TYPE_INHERITED && (opts & IsReadonly)) goto next;
49 if (type == Constructor) goto next;
50  
51 2629 ▶ if ((val & opts) == opts) {
Branch: 14 branches
BranchTrueFalseTotal
if ((val & opts) == opts) { 1 439 440
if ((val & opts) == opts) { 0 440 440
if ((val & opts) == opts) { 0 6 6
if ((val & opts) == opts) { 0 408 408
if ((val & opts) == opts) { 0 19 19
if ((val & opts) == opts) { 0 2 2
if ((val & opts) == opts) { 0 12 12
if ((val & opts) == opts) { 5 13 18
if ((val & opts) == opts) { 1 5 6
if ((val & opts) == opts) { 1 407 408
if ((val & opts) == opts) { 1 18 19
if ((val & opts) == opts) { 1 438 439
if ((val & opts) == opts) { 2 3 5
if ((val & opts) == opts) { 3 404 407
52 0 CV* cv = CAIXS_install_cv<type, opts>(aTHX_ full_name);
53 0 return CAIXS_payload_init<type>(aTHX_ cv);
54 }
55  
56 2642 next:
57 2642 return CImpl<type, (AccessorOpts)(opts-1)>::CAIXS_install_accessor(aTHX_ val, full_name);
58 }};
59  
60 template <AccessorType type>
61 struct CImpl<type, (AccessorOpts)0> {
62 872 static shared_keys* CAIXS_install_accessor(pTHX_ int val, SV* full_name) {
63 872 CV* cv = CAIXS_install_cv<type, None>(aTHX_ full_name);
64 872 return CAIXS_payload_init<type>(aTHX_ cv);
65 }};
66  
67 #endif /* __INHERITED_XS_INSTALLER_H_ */
« xs/fimpl.h ↑ Summary xs/accessors.h »