OpenCoverage

hashcmd.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/hashcmd.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8HASH_TABLE *hashed_filenames = (HASH_TABLE *)-
9 ((void *)0)-
10 ;-
11-
12static void phash_freedata (void *);-
13-
14void-
15phash_create ()-
16{-
17 if (hashed_filenames == 0
hashed_filenames == 0Description
TRUEevaluated 1632 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-1632
18 hashed_filenames = hash_create (64);
executed 1632 times by 1 test: hashed_filenames = hash_create (64);
Executed by:
  • Self test
1632
19}
executed 1632 times by 1 test: end of block
Executed by:
  • Self test
1632
20-
21static void-
22phash_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:
  • Self test
29
28-
29void-
30phash_flush ()-
31{-
32 if (hashed_filenames
hashed_filenamesDescription
TRUEevaluated 41 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 51 times by 1 test
Evaluated by:
  • Self test
)
41-51
33 hash_flush (hashed_filenames, phash_freedata);
executed 41 times by 1 test: hash_flush (hashed_filenames, phash_freedata);
Executed by:
  • Self test
41
34}
executed 92 times by 1 test: end of block
Executed by:
  • Self test
92
35-
36-
37int-
38phash_remove (filename)-
39 const char *filename;-
40{-
41 register BUCKET_CONTENTS *item;-
42-
43 if (hashing_enabled == 0
hashing_enabled == 0Description
TRUEnever evaluated
FALSEevaluated 13 times by 1 test
Evaluated by:
  • Self test
|| hashed_filenames == 0
hashed_filenames == 0Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
)
0-13
44 return
executed 12 times by 1 test: return 0;
Executed by:
  • Self test
0;
executed 12 times by 1 test: return 0;
Executed by:
  • Self test
12
45-
46 item = hash_remove (filename, hashed_filenames, 0);-
47 if (item
itemDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
)
0-1
48 {-
49 if (item->data
item->dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
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: return 0;
0;
never executed: return 0;
0
54 }-
55 return
executed 1 time by 1 test: return 1;
Executed by:
  • Self test
1;
executed 1 time by 1 test: return 1;
Executed by:
  • Self test
1
56}-
57-
58-
59-
60-
61-
62-
63void-
64phash_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
hashing_enabled == 0Description
TRUEnever evaluated
FALSEevaluated 5290 times by 1 test
Evaluated by:
  • Self test
)
0-5290
71 return;
never executed: return;
0
72-
73 if (hashed_filenames == 0
hashed_filenames == 0Description
TRUEevaluated 1632 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3658 times by 1 test
Evaluated by:
  • Self test
)
1632-3658
74 phash_create ();
executed 1632 times by 1 test: phash_create ();
Executed by:
  • Self test
1632
75-
76 item = hash_insert (filename, hashed_filenames, 0);-
77 if (item->data
item->dataDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5288 times by 1 test
Evaluated by:
  • Self test
)
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:
  • Self test
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:
  • Self test
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
check_dotDescription
TRUEevaluated 5181 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 109 times by 1 test
Evaluated by:
  • Self test
)
109-5181
87 ((
executed 5181 times by 1 test: ((PATH_DATA *)(item)->data)->flags |= 0x02;
Executed by:
  • Self test
PATH_DATA *)(item)->data)->flags |= 0x02;
executed 5181 times by 1 test: ((PATH_DATA *)(item)->data)->flags |= 0x02;
Executed by:
  • Self test
5181
88 if (*
*full_path != '/'Description
TRUEevaluated 249 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5041 times by 1 test
Evaluated by:
  • Self test
full_path != '/'
*full_path != '/'Description
TRUEevaluated 249 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5041 times by 1 test
Evaluated by:
  • Self test
)
249-5041
89 ((
executed 249 times by 1 test: ((PATH_DATA *)(item)->data)->flags |= 0x01;
Executed by:
  • Self test
PATH_DATA *)(item)->data)->flags |= 0x01;
executed 249 times by 1 test: ((PATH_DATA *)(item)->data)->flags |= 0x01;
Executed by:
  • Self test
249
90 item->times_found = found;-
91}
executed 5290 times by 1 test: end of block
Executed by:
  • Self test
5290
92-
93-
94-
95-
96-
97-
98char *-
99phash_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
hashing_enabled == 0Description
TRUEnever evaluated
FALSEevaluated 26869 times by 1 test
Evaluated by:
  • Self test
|| hashed_filenames == 0
hashed_filenames == 0Description
TRUEevaluated 1686 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 25183 times by 1 test
Evaluated by:
  • Self test
)
0-26869
107 return
executed 1686 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
((char *)
executed 1686 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
1686
108 ((void *)0)
executed 1686 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
1686
109 );
executed 1686 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
1686
110-
111 item = hash_search (filename, hashed_filenames, 0);-
112-
113 if (item ==
item == ((void *)0)Description
TRUEevaluated 3696 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 21487 times by 1 test
Evaluated by:
  • Self test
3696-21487
114 ((void *)0)
item == ((void *)0)Description
TRUEevaluated 3696 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 21487 times by 1 test
Evaluated by:
  • Self test
3696-21487
115 )-
116 return
executed 3696 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
((char *)
executed 3696 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
3696
117 ((void *)0)
executed 3696 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
3696
118 );
executed 3696 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
3696
119-
120-
121-
122-
123 path = ((PATH_DATA *)(item)->data)->path;-
124 if (((
((PATH_DATA *)... & (0x02|0x01)Description
TRUEevaluated 21469 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 18 times by 1 test
Evaluated by:
  • Self test
PATH_DATA *)(item)->data)->flags & (0x02|0x01)
((PATH_DATA *)... & (0x02|0x01)Description
TRUEevaluated 21469 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 18 times by 1 test
Evaluated by:
  • Self test
)
18-21469
125 {-
126 tail = (((
(((PATH_DATA *...>flags & 0x01)Description
TRUEevaluated 4906 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16563 times by 1 test
Evaluated by:
  • Self test
PATH_DATA *)(item)->data)->flags & 0x01)
(((PATH_DATA *...>flags & 0x01)Description
TRUEevaluated 4906 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16563 times by 1 test
Evaluated by:
  • Self test
? path : (char *)filename;
4906-16563
127-
128 if (tail[0] != '.'
tail[0] != '.'Description
TRUEevaluated 16563 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4906 times by 1 test
Evaluated by:
  • Self test
|| tail[1] != '/'
tail[1] != '/'Description
TRUEnever evaluated
FALSEevaluated 4906 times by 1 test
Evaluated by:
  • Self test
)
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:
  • Self test
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:
  • Self test
4906
136-
137 if (executable_file (dotted_filename)
executable_fil...tted_filename)Description
TRUEevaluated 4916 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16553 times by 1 test
Evaluated by:
  • Self test
)
4916-16553
138 return
executed 4916 times by 1 test: return (dotted_filename);
Executed by:
  • Self test
(dotted_filename);
executed 4916 times by 1 test: return (dotted_filename);
Executed by:
  • Self test
4916
139-
140 sh_xfree((dotted_filename), "hashcmd.c", 162);-
141 if (*
*path == '.'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16551 times by 1 test
Evaluated by:
  • Self test
path == '.'
*path == '.'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16551 times by 1 test
Evaluated by:
  • Self test
)
2-16551
142 {-
143 same = 0;-
144 tail = (char *)strrchr (path, '/');-
145-
146 if (tail
tailDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
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:
  • Self test
2
156-
157 return
executed 2 times by 1 test: return same ? (char *) ((void *)0) : (char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 190), (path));
Executed by:
  • Self test
same ? (char *)
executed 2 times by 1 test: return same ? (char *) ((void *)0) : (char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 190), (path));
Executed by:
  • Self test
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:
  • Self test
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:
  • Self test
2
160 }-
161 }
executed 16551 times by 1 test: end of block
Executed by:
  • Self test
16551
162-
163 return
executed 16569 times by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 194), (path)));
Executed by:
  • Self test
((char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 194), (path)));
executed 16569 times by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen (path)), "hashcmd.c", 194), (path)));
Executed by:
  • Self test
16569
164}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2