Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/dirname-lgpl.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | - | |||||||||||||
8 | - | |||||||||||||
9 | - | |||||||||||||
10 | size_t | - | ||||||||||||
11 | dir_len (char const *file) | - | ||||||||||||
12 | { | - | ||||||||||||
13 | size_t prefix_length = 0; | - | ||||||||||||
14 | size_t length; | - | ||||||||||||
15 | - | |||||||||||||
16 | - | |||||||||||||
17 | prefix_length += (prefix_length != 0
| 0-205 | ||||||||||||
18 | ? (0 | - | ||||||||||||
19 | && (( dead code: file[prefix_length]) == '/')((file[prefix_length]) == '/') dead code: )((file[prefix_length]) == '/') | - | ||||||||||||
20 | : (((
| 17-188 | ||||||||||||
21 | ? ((0 | - | ||||||||||||
22 | && (( dead code: file[1]) == '/')((file[1]) == '/') dead code: && ! ((file[2]) == '/')((file[1]) == '/') dead code: ! ((file[2]) == '/') | - | ||||||||||||
23 | ? 2 dead code: : 1))2 | - | ||||||||||||
24 | : 0)); | - | ||||||||||||
25 | - | |||||||||||||
26 | - | |||||||||||||
27 | for (length = last_component (file) - file; | - | ||||||||||||
28 | prefix_length < length
| 131-157 | ||||||||||||
29 | if (! ((file[length - 1]) == '/')
| 74-83 | ||||||||||||
30 | break; executed 74 times by 7 tests: break; Executed by:
| 74 | ||||||||||||
31 | return executed 205 times by 9 tests: length;return length; Executed by:
executed 205 times by 9 tests: return length; Executed by:
| 205 | ||||||||||||
32 | } | - | ||||||||||||
33 | char * | - | ||||||||||||
34 | mdir_name (char const *file) | - | ||||||||||||
35 | { | - | ||||||||||||
36 | size_t length = dir_len (file); | - | ||||||||||||
37 | - | |||||||||||||
38 | _Bool | - | ||||||||||||
39 | append_dot = (length == 0
| 39-44 | ||||||||||||
40 | || (0 | - | ||||||||||||
41 | && length == 0 dead code: length == 0 | - | ||||||||||||
42 | && file[2] != '\0' dead code: && ! ((file[2]) == '/')file[2] != '\0' dead code: ));! ((file[2]) == '/') | - | ||||||||||||
43 | char *dir = malloc (length + append_dot + 1); | - | ||||||||||||
44 | if (!dir
| 0-83 | ||||||||||||
45 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
46 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
47 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
48 | memcpy (dir, file, length); | - | ||||||||||||
49 | if (append_dot
| 39-44 | ||||||||||||
50 | dir[length++] = '.'; executed 39 times by 4 tests: dir[length++] = '.'; Executed by:
| 39 | ||||||||||||
51 | dir[length] = '\0'; | - | ||||||||||||
52 | return executed 83 times by 5 tests: dir;return dir; Executed by:
executed 83 times by 5 tests: return dir; Executed by:
| 83 | ||||||||||||
53 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |