OpenCoverage

mbschr.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/lib/sh/mbschr.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6extern int locale_mb_cur_max;-
7extern int locale_utf8locale;-
8-
9-
10-
11static inline char *-
12utf8_mbschr (s, c)-
13 const char *s;-
14 int c;-
15{-
16 return
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
17 (__extension__ (__builtin_constant_p (
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
18 c
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
19 ) && !__builtin_constant_p (
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
20 s
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
21 ) && (
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
22 c
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
23 ) == '\0' ? (char *) __rawmemchr (
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
24 s
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
25 ,
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
26 c
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
27 ) : __builtin_strchr (
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
28 s
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
29 ,
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
30 c
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
31 )))
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
32 ;
executed 361596937 times by 1 test: return (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) ;
Executed by:
  • Self test
361596937
33}-
34-
35-
36-
37-
38-
39char *-
40-
41mbschr (const char *s, int c)-
42-
43-
44-
45-
46-
47{-
48-
49 char *pos;-
50 mbstate_t state;-
51 size_t strlength, mblength;-
52-
53 if (locale_utf8locale
locale_utf8localeDescription
TRUEevaluated 363901577 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1056788 times by 1 test
Evaluated by:
  • Self test
&& c < 0x80
c < 0x80Description
TRUEevaluated 361596937 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2304640 times by 1 test
Evaluated by:
  • Self test
)
1056788-363901577
54 return
executed 361596937 times by 1 test: return (utf8_mbschr (s, c));
Executed by:
  • Self test
(utf8_mbschr (s, c));
executed 361596937 times by 1 test: return (utf8_mbschr (s, c));
Executed by:
  • Self test
361596937
55-
56-
57-
58-
59-
60 if ((
(unsigned char)c >= '0'Description
TRUEevaluated 3316024 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 45404 times by 1 test
Evaluated by:
  • Self test
unsigned char)c >= '0'
(unsigned char)c >= '0'Description
TRUEevaluated 3316024 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 45404 times by 1 test
Evaluated by:
  • Self test
&& locale_mb_cur_max > 1
locale_mb_cur_max > 1Description
TRUEevaluated 2304640 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1011384 times by 1 test
Evaluated by:
  • Self test
)
45404-3316024
61 {-
62 pos = (char *)s;-
63 memset (&state, '\0', sizeof(mbstate_t));-
64 strlength = strlen (s);-
65-
66 while (strlength > 0
strlength > 0Description
TRUEevaluated 23046400 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2304640 times by 1 test
Evaluated by:
  • Self test
)
2304640-23046400
67 {-
68 if (is_basic (*pos)
is_basic (*pos)Description
TRUEevaluated 20741760 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2304640 times by 1 test
Evaluated by:
  • Self test
)
2304640-20741760
69 mblength = 1;
executed 20741760 times by 1 test: mblength = 1;
Executed by:
  • Self test
20741760
70 else-
71 {-
72 mblength = mbrlen (pos, strlength, &state);-
73 if (mblength == (size_t)-2
mblength == (size_t)-2Description
TRUEnever evaluated
FALSEevaluated 2304640 times by 1 test
Evaluated by:
  • Self test
|| mblength == (size_t)-1
mblength == (size_t)-1Description
TRUEnever evaluated
FALSEevaluated 2304640 times by 1 test
Evaluated by:
  • Self test
|| mblength == (size_t)0
mblength == (size_t)0Description
TRUEnever evaluated
FALSEevaluated 2304640 times by 1 test
Evaluated by:
  • Self test
)
0-2304640
74 mblength = 1;
never executed: mblength = 1;
0
75 }
executed 2304640 times by 1 test: end of block
Executed by:
  • Self test
2304640
76-
77 if (mblength == 1
mblength == 1Description
TRUEevaluated 23046400 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& c == (unsigned char)*pos
c == (unsigned char)*posDescription
TRUEnever evaluated
FALSEevaluated 23046400 times by 1 test
Evaluated by:
  • Self test
)
0-23046400
78 return
never executed: return pos;
pos;
never executed: return pos;
0
79-
80 strlength -= mblength;-
81 pos += mblength;-
82 }
executed 23046400 times by 1 test: end of block
Executed by:
  • Self test
23046400
83-
84 return
executed 2304640 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
((char *)
executed 2304640 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
2304640
85 ((void *)0)
executed 2304640 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
2304640
86 );
executed 2304640 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
2304640
87 }-
88 else-
89-
90 return
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
(
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
91 (__extension__ (__builtin_constant_p (
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
92 c
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
93 ) && !__builtin_constant_p (
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
94 s
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
95 ) && (
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
96 c
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
97 ) == '\0' ? (char *) __rawmemchr (
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
98 s
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
99 ,
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
100 c
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
101 ) : __builtin_strchr (
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
102 s
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
103 ,
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
104 c
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
105 )))
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
106 );
executed 1056788 times by 1 test: return ( (__extension__ (__builtin_constant_p ( c ) && !__builtin_constant_p ( s ) && ( c ) == '\0' ? (char *) __rawmemchr ( s , c ) : __builtin_strchr ( s , c ))) );
Executed by:
  • Self test
1056788
107}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2