const-xs.inc

filter: Statementstmt 45.0% 9 / 20 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 46.1% 12 / 26 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« Shadow.xs ↑ Summary const-c.inc »
1 void
2 constant(sv)
3 PREINIT:
4 #ifdef dXSTARG
5 1 ▶ dXSTARG; /* Faster if we have it. */
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; /* Faster if we have it. */ 1 0 1
6 #else
7 dTARGET;
8 #endif
9 STRLEN len;
10 int type;
11 /* IV iv; Uncomment this if you need to return IVs */
12 /* NV nv; Uncomment this if you need to return NVs */
13 1 const char *pv = NULL; /* avoid uninit var warning */
14 INPUT:
15 SV * sv;
16 const char * s = SvPV(sv, len);
17 PPCODE:
18 1 type = constant(aTHX_ s, len, &pv);
19 /* Return 1 or 2 items. First is error message, or undef if no error.
20 Second, if present, is found value */
21 1 switch (type) {
22 0 case PERL_constant_NOTFOUND:
23 sv =
24 0 sv_2mortal(newSVpvf("%s is not a valid Linux::Shadow macro", s));
25 0 PUSHs(sv);
26 0 break;
27 0 case PERL_constant_NOTDEF:
28 0 sv = sv_2mortal(newSVpvf(
29 "Your vendor has not defined Linux::Shadow macro %s, used",
30 s));
31 0 PUSHs(sv);
32 0 break;
33 /* Uncomment this if you need to return IVs
34 case PERL_constant_ISIV:
35 EXTEND(SP, 2);
36 PUSHs(&PL_sv_undef);
37 PUSHi(iv);
38 break; */
39 /* Uncomment this if you need to return NOs
40 case PERL_constant_ISNO:
41 EXTEND(SP, 2);
42 PUSHs(&PL_sv_undef);
43 PUSHs(&PL_sv_no);
44 break; */
45 /* Uncomment this if you need to return NVs
46 case PERL_constant_ISNV:
47 EXTEND(SP, 2);
48 PUSHs(&PL_sv_undef);
49 PUSHn(nv);
50 break; */
51 1 case PERL_constant_ISPV:
52 1 ▶ EXTEND(SP, 2);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP, 2); 0 1 1
53 1 PUSHs(&PL_sv_undef);
54 1 ▶ PUSHp(pv, strlen(pv));
Branch: 1 branch
BranchTrueFalseTotal
PUSHp(pv, strlen(pv)); 0 1 1
55 1 break;
56 /* Uncomment this if you need to return PVNs
57 case PERL_constant_ISPVN:
58 EXTEND(SP, 2);
59 PUSHs(&PL_sv_undef);
60 PUSHp(pv, iv);
61 break; */
62 /* Uncomment this if you need to return SVs
63 case PERL_constant_ISSV:
64 EXTEND(SP, 2);
65 PUSHs(&PL_sv_undef);
66 PUSHs(sv);
67 break; */
68 /* Uncomment this if you need to return UNDEFs
69 case PERL_constant_ISUNDEF:
70 break; */
71 /* Uncomment this if you need to return UVs
72 case PERL_constant_ISUV:
73 EXTEND(SP, 2);
74 PUSHs(&PL_sv_undef);
75 PUSHu((UV)iv);
76 break; */
77 /* Uncomment this if you need to return YESs
78 case PERL_constant_ISYES:
79 EXTEND(SP, 2);
80 PUSHs(&PL_sv_undef);
81 PUSHs(&PL_sv_yes);
82 break; */
83 0 default:
84 0 sv = sv_2mortal(newSVpvf(
85 "Unexpected return type %d while processing Linux::Shadow macro %s, used",
86 type, s));
87 0 PUSHs(sv);
88 }
« Shadow.xs ↑ Summary const-c.inc »