Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/hashcmd.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | - | |||||||||||||
8 | HASH_TABLE *hashed_filenames = (HASH_TABLE *) | - | ||||||||||||
9 | ((void *)0) | - | ||||||||||||
10 | ; | - | ||||||||||||
11 | - | |||||||||||||
12 | static void phash_freedata (void *); | - | ||||||||||||
13 | - | |||||||||||||
14 | void | - | ||||||||||||
15 | phash_create () | - | ||||||||||||
16 | { | - | ||||||||||||
17 | if (hashed_filenames == 0
| 0-1632 | ||||||||||||
18 | hashed_filenames = hash_create (64); executed 1632 times by 1 test: hashed_filenames = hash_create (64); Executed by:
| 1632 | ||||||||||||
19 | } executed 1632 times by 1 test: end of block Executed by:
| 1632 | ||||||||||||
20 | - | |||||||||||||
21 | static void | - | ||||||||||||
22 | phash_freedata (data) | - | ||||||||||||
23 | void * data; | - | ||||||||||||
24 | { | - | ||||||||||||
25 | sh_xfree((((PATH_DATA *)data)->path), "hashcmd.c", 53); | - | ||||||||||||
26 | sh_xfree((data), "hashcmd.c", 54); | - | ||||||||||||
27 | } executed 29 times by 1 test: end of block Executed by:
| 29 | ||||||||||||
28 | - | |||||||||||||
29 | void | - | ||||||||||||
30 | phash_flush () | - | ||||||||||||
31 | { | - | ||||||||||||
32 | if (hashed_filenames
| 41-51 | ||||||||||||
33 | hash_flush (hashed_filenames, phash_freedata); executed 41 times by 1 test: hash_flush (hashed_filenames, phash_freedata); Executed by:
| 41 | ||||||||||||
34 | } executed 92 times by 1 test: end of block Executed by:
| 92 | ||||||||||||
35 | - | |||||||||||||
36 | - | |||||||||||||
37 | int | - | ||||||||||||
38 | phash_remove (filename) | - | ||||||||||||
39 | const char *filename; | - | ||||||||||||
40 | { | - | ||||||||||||
41 | register BUCKET_CONTENTS *item; | - | ||||||||||||
42 | - | |||||||||||||
43 | if (hashing_enabled == 0
| 0-13 | ||||||||||||
44 | return executed 12 times by 1 test: 0;return 0; Executed by:
executed 12 times by 1 test: return 0; Executed by:
| 12 | ||||||||||||
45 | - | |||||||||||||
46 | item = hash_remove (filename, hashed_filenames, 0); | - | ||||||||||||
47 | if (item
| 0-1 | ||||||||||||
48 | { | - | ||||||||||||
49 | if (item->data
| 0 | ||||||||||||
50 | phash_freedata (item->data); never executed: phash_freedata (item->data); | 0 | ||||||||||||
51 | sh_xfree((item->key), "hashcmd.c", 79); | - | ||||||||||||
52 | sh_xfree((item), "hashcmd.c", 80); | - | ||||||||||||
53 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
54 | } | - | ||||||||||||
55 | return executed 1 time by 1 test: 1;return 1; Executed by:
executed 1 time by 1 test: return 1; Executed by:
| 1 | ||||||||||||
56 | } | - | ||||||||||||
57 | - | |||||||||||||
58 | - | |||||||||||||
59 | - | |||||||||||||
60 | - | |||||||||||||
61 | - | |||||||||||||
62 | - | |||||||||||||
63 | void | - | ||||||||||||
64 | phash_insert (filename, full_path, check_dot, found) | - | ||||||||||||
65 | char *filename, *full_path; | - | ||||||||||||
66 | int check_dot, found; | - | ||||||||||||
67 | { | - | ||||||||||||
68 | register BUCKET_CONTENTS *item; | - | ||||||||||||
69 | - | |||||||||||||
70 | if (hashing_enabled == 0
| 0-5290 | ||||||||||||
71 | return; never executed: return; | 0 | ||||||||||||
72 | - | |||||||||||||
73 | if (hashed_filenames == 0
| 1632-3658 | ||||||||||||
74 | phash_create (); executed 1632 times by 1 test: phash_create (); Executed by:
| 1632 | ||||||||||||
75 | - | |||||||||||||
76 | item = hash_insert (filename, hashed_filenames, 0); | - | ||||||||||||
77 | if (item->data
| 2-5288 | ||||||||||||
78 | sh_xfree((((PATH_DATA *)(item)->data)->path), "hashcmd.c", 106); executed 2 times by 1 test: sh_xfree((((PATH_DATA *)(item)->data)->path), "hashcmd.c", 106); Executed by:
| 2 | ||||||||||||
79 | else | - | ||||||||||||
80 | { | - | ||||||||||||
81 | item->key = (char *)strcpy (sh_xmalloc((1 + strlen (filename)), "hashcmd.c", 109), (filename)); | - | ||||||||||||
82 | item->data = sh_xmalloc((sizeof (PATH_DATA)), "hashcmd.c", 110); | - | ||||||||||||
83 | } executed 5288 times by 1 test: end of block Executed by:
| 5288 | ||||||||||||
84 | ((PATH_DATA *)(item)->data)->path = (char *)strcpy (sh_xmalloc((1 + strlen (full_path)), "hashcmd.c", 112), (full_path)); | - | ||||||||||||
85 | ((PATH_DATA *)(item)->data)->flags = 0; | - | ||||||||||||
86 | if (check_dot
| 109-5181 | ||||||||||||
87 | (( executed 5181 times by 1 test: PATH_DATA *)(item)->data)->flags |= 0x02;((PATH_DATA *)(item)->data)->flags |= 0x02; Executed by:
executed 5181 times by 1 test: ((PATH_DATA *)(item)->data)->flags |= 0x02; Executed by:
| 5181 | ||||||||||||
88 | if (*
| 249-5041 | ||||||||||||
89 | (( executed 249 times by 1 test: PATH_DATA *)(item)->data)->flags |= 0x01;((PATH_DATA *)(item)->data)->flags |= 0x01; Executed by:
executed 249 times by 1 test: ((PATH_DATA *)(item)->data)->flags |= 0x01; Executed by:
| 249 | ||||||||||||
90 | item->times_found = found; | - | ||||||||||||
91 | } executed 5290 times by 1 test: end of block Executed by:
| 5290 | ||||||||||||
92 | - | |||||||||||||
93 | - | |||||||||||||
94 | - | |||||||||||||
95 | - | |||||||||||||
96 | - | |||||||||||||
97 | - | |||||||||||||
98 | char * | - | ||||||||||||
99 | phash_search (filename) | - | ||||||||||||
100 | const char *filename; | - | ||||||||||||
101 | { | - | ||||||||||||
102 | register BUCKET_CONTENTS *item; | - | ||||||||||||
103 | char *path, *dotted_filename, *tail; | - | ||||||||||||
104 | int same; | - | ||||||||||||
105 | - | |||||||||||||
106 | if (hashing_enabled == 0
| 0-26869 | ||||||||||||
107 | return executed 1686 times by 1 test: ((char *)return ((char *) ((void *)0) ); Executed by:
executed 1686 times by 1 test: return ((char *) ((void *)0) ); Executed by:
| 1686 | ||||||||||||
108 | ((void *)0) executed 1686 times by 1 test: return ((char *) ((void *)0) ); Executed by:
| 1686 | ||||||||||||
109 | ); executed 1686 times by 1 test: return ((char *) ((void *)0) ); Executed by:
| 1686 | ||||||||||||
110 | - | |||||||||||||
111 | item = hash_search (filename, hashed_filenames, 0); | - | ||||||||||||
112 | - | |||||||||||||
113 | if (item ==
| 3696-21487 | ||||||||||||
114 | ((void *)0)
| 3696-21487 | ||||||||||||
115 | ) | - | ||||||||||||
116 | return executed 3696 times by 1 test: ((char *)return ((char *) ((void *)0) ); Executed by:
executed 3696 times by 1 test: return ((char *) ((void *)0) ); Executed by:
| 3696 | ||||||||||||
117 | ((void *)0) executed 3696 times by 1 test: return ((char *) ((void *)0) ); Executed by:
| 3696 | ||||||||||||
118 | ); executed 3696 times by 1 test: return ((char *) ((void *)0) ); Executed by:
| 3696 | ||||||||||||
119 | - | |||||||||||||
120 | - | |||||||||||||
121 | - | |||||||||||||
122 | - | |||||||||||||
123 | path = ((PATH_DATA *)(item)->data)->path; | - | ||||||||||||
124 | if (((
| 18-21469 | ||||||||||||
125 | { | - | ||||||||||||
126 | tail = (((
| 4906-16563 | ||||||||||||
127 | - | |||||||||||||
128 | if (tail[0] != '.'
| 0-16563 | ||||||||||||
129 | { | - | ||||||||||||
130 | dotted_filename = (char *)sh_xmalloc((3 + strlen (tail)), "hashcmd.c", 152); | - | ||||||||||||
131 | dotted_filename[0] = '.'; dotted_filename[1] = '/'; | - | ||||||||||||
132 | strcpy (dotted_filename + 2, tail); | - | ||||||||||||
133 | } executed 16563 times by 1 test: end of block Executed by:
| 16563 | ||||||||||||
134 | else | - | ||||||||||||
135 | dotted_filename = (char *)strcpy (sh_xmalloc((1 + strlen (tail)), "hashcmd.c", 157), (tail)); executed 4906 times by 1 test: dotted_filename = (char *)strcpy (sh_xmalloc((1 + strlen (tail)), "hashcmd.c", 157), (tail)); Executed by:
| 4906 | ||||||||||||
136 | - | |||||||||||||
137 | if (executable_file (dotted_filename)
| 4916-16553 | ||||||||||||
138 | return executed 4916 times by 1 test: (dotted_filename);return (dotted_filename); Executed by:
executed 4916 times by 1 test: return (dotted_filename); Executed by:
| 4916 | ||||||||||||
139 | - | |||||||||||||
140 | sh_xfree((dotted_filename), "hashcmd.c", 162); | - | ||||||||||||
141 | if (*
| 2-16551 | ||||||||||||
142 | { | - | ||||||||||||
143 | same = 0; | - | ||||||||||||
144 | tail = (char *)strrchr (path, '/'); | - | ||||||||||||
145 | - | |||||||||||||
146 | if (tail
| 0-2 | ||||||||||||
147 | { | - | ||||||||||||
148 | *tail = '\0'; | - | ||||||||||||
149 | same = same_file (".", path, (struct stat *) | - | ||||||||||||
150 | ((void *)0) | - | ||||||||||||
151 | , (struct stat *) | - | ||||||||||||
152 | ((void *)0) | - | ||||||||||||
153 | ); | - | ||||||||||||
154 | *tail = '/'; | - | ||||||||||||
155 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
156 | - | |||||||||||||
157 | return executed 2 times by 1 test: same ? (char *)return same ? (char *) ((void *)0) : (char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 190), (path)); Executed by:
executed 2 times by 1 test: return same ? (char *) ((void *)0) : (char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 190), (path)); Executed by:
| 2 | ||||||||||||
158 | ((void *)0) executed 2 times by 1 test: return same ? (char *) ((void *)0) : (char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 190), (path)); Executed by:
| 2 | ||||||||||||
159 | : (char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 190), (path)); executed 2 times by 1 test: return same ? (char *) ((void *)0) : (char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 190), (path)); Executed by:
| 2 | ||||||||||||
160 | } | - | ||||||||||||
161 | } executed 16551 times by 1 test: end of block Executed by:
| 16551 | ||||||||||||
162 | - | |||||||||||||
163 | return executed 16569 times by 1 test: ((char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 194), (path)));return ((char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 194), (path))); Executed by:
executed 16569 times by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 194), (path))); Executed by:
| 16569 | ||||||||||||
164 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |