Strip.xs

filter: Statementstmt 100% 25 / 25 Branchbran 85.7% 36 / 42 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 91.0% 61 / 67 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
↑ Summary blib/lib/String/Strip.pm »
1 #ifdef __cplusplus
2 extern "C" {
3 #endif
4 #include "EXTERN.h"
5 #include "perl.h"
6 #include "XSUB.h"
7 #include <ctype.h>
8 #include <string.h>
9 #ifdef __cplusplus
10 }
11 #endif
12  
13  
14 MODULE = String::Strip PACKAGE = String::Strip
15
16 PROTOTYPES: ENABLE
17  
18 void
19 StripTSpace(arg)
20 char *arg
21 CODE:
22 char *pc;
23 int i;
24  
25 7 ▶ if (!SvOK(ST(0)))
Branch: 1 branch
BranchTrueFalseTotal
if (!SvOK(ST(0))) 1 6 7
26 1 XSRETURN_UNDEF;
27  
28 6 ▶ if (i = strlen(arg)) {
Branch: 1 branch
BranchTrueFalseTotal
if (i = strlen(arg)) { 3 3 6
29 10 ▶ for (pc = arg + i - 1; (pc >= arg) && *pc && isspace(*pc); --pc)
Branch: 3 branches
BranchTrueFalseTotal
for (pc = arg + i - 1; (pc >= arg) && *pc && isspace(*pc); --pc) 10 0 10
for (pc = arg + i - 1; (pc >= arg) && *pc && isspace(*pc); --pc) 10 0 10
for (pc = arg + i - 1; (pc >= arg) && *pc && isspace(*pc); --pc) 7 3 10
30 ;
31 3 *++pc = 0;
32 }
33 OUTPUT:
34 arg
35  
36 void
37 StripLSpace(arg)
38 char *arg
39 CODE:
40 char *pcF, *pcR;
41 int i;
42  
43 7 ▶ if (!SvOK(ST(0)))
Branch: 1 branch
BranchTrueFalseTotal
if (!SvOK(ST(0))) 1 6 7
44 1 XSRETURN_UNDEF;
45  
46 6 ▶ if (i = strlen(arg)) {
Branch: 1 branch
BranchTrueFalseTotal
if (i = strlen(arg)) { 5 1 6
47 16 ▶ for (pcF = arg; *pcF && isspace(*pcF); pcF++)
Branch: 2 branches
BranchTrueFalseTotal
for (pcF = arg; *pcF && isspace(*pcF); pcF++) 14 2 16
for (pcF = arg; *pcF && isspace(*pcF); pcF++) 11 3 14
48 ;
49  
50 5 memmove(arg, pcF, i);
51 }
52 OUTPUT:
53 arg
54  
55 void
56 StripLTSpace(arg)
57 char *arg
58 CODE:
59 char *pcF, *pcR;
60 int i;
61  
62 10 ▶ if (!SvOK(ST(0)))
Branch: 1 branch
BranchTrueFalseTotal
if (!SvOK(ST(0))) 1 9 10
63 1 XSRETURN_UNDEF;
64  
65 9 ▶ if (i = strlen(arg)) {
Branch: 1 branch
BranchTrueFalseTotal
if (i = strlen(arg)) { 6 3 9
66 16 ▶ for (pcR = arg + i - 1; (pcR > arg) && *pcR && isspace(*pcR); --pcR)
Branch: 3 branches
BranchTrueFalseTotal
for (pcR = arg + i - 1; (pcR > arg) && *pcR && isspace(*pcR); --pcR) 16 0 16
for (pcR = arg + i - 1; (pcR > arg) && *pcR && isspace(*pcR); --pcR) 16 0 16
for (pcR = arg + i - 1; (pcR > arg) && *pcR && isspace(*pcR); --pcR) 10 6 16
67 ;
68 6 *++pcR = 0;
69  
70 6 ▶ if (arg < pcR) {
Branch: 1 branch
BranchTrueFalseTotal
if (arg < pcR) { 6 0 6
71 14 ▶ for (pcF = arg; *pcF && isspace(*pcF); pcF++)
Branch: 2 branches
BranchTrueFalseTotal
for (pcF = arg; *pcF && isspace(*pcF); pcF++) 14 0 14
for (pcF = arg; *pcF && isspace(*pcF); pcF++) 8 6 14
72 ;
73  
74 6 memmove(arg, pcF,i);
75 }
76 }
77 OUTPUT:
78 arg
79  
80 void
81 StripSpace(arg)
82 char *arg
83 CODE:
84 char *pcF, *pcR;
85 17 ▶ if (!SvOK(ST(0)))
Branch: 1 branch
BranchTrueFalseTotal
if (!SvOK(ST(0))) 1 16 17
86 1 XSRETURN_UNDEF;
87  
88 16 ▶ if (strlen(arg)) {
Branch: 1 branch
BranchTrueFalseTotal
if (strlen(arg)) { 13 3 16
89 92 ▶ for (pcF = pcR = arg; *pcR; pcR++)
Branch: 1 branch
BranchTrueFalseTotal
for (pcF = pcR = arg; *pcR; pcR++) 79 13 92
90 79 ▶ if (!isspace(*pcR))
Branch: 1 branch
BranchTrueFalseTotal
if (!isspace(*pcR)) 52 27 79
91 52 *pcF++ = *pcR;
92 13 *pcF = 0;
93 }
94 OUTPUT:
95 arg
96  
↑ Summary blib/lib/String/Strip.pm »