OpenCoverage

fts-cycle.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/fts-cycle.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3struct Active_dir-
4{-
5 dev_t dev;-
6 ino_t ino;-
7 FTSENT *fts_ent;-
8};-
9-
10static -
11 _Bool-
12-
13AD_compare (void const *x, void const *y)-
14{-
15 struct Active_dir const *ax = x;-
16 struct Active_dir const *ay = y;-
17 return
executed 1431 times by 3 tests: return ax->ino == ay->ino && ax->dev == ay->dev;
Executed by:
  • chgrp
  • chown
  • du
ax->ino == ay->ino
executed 1431 times by 3 tests: return ax->ino == ay->ino && ax->dev == ay->dev;
Executed by:
  • chgrp
  • chown
  • du
1431
18 && ax->dev == ay->dev;
executed 1431 times by 3 tests: return ax->ino == ay->ino && ax->dev == ay->dev;
Executed by:
  • chgrp
  • chown
  • du
1431
19}-
20-
21static size_t-
22AD_hash (void const *x, size_t table_size)-
23{-
24 struct Active_dir const *ax = x;-
25 return
executed 2858 times by 3 tests: return (uintmax_t) ax->ino % table_size;
Executed by:
  • chgrp
  • chown
  • du
(uintmax_t) ax->ino % table_size;
executed 2858 times by 3 tests: return (uintmax_t) ax->ino % table_size;
Executed by:
  • chgrp
  • chown
  • du
2858
26}-
27-
28-
29-
30static -
31 _Bool-
32-
33setup_dir (FTS *fts)-
34{-
35 if (fts->fts_options & (0x0100 | 0x0002)
fts->fts_optio...0100 | 0x0002)Description
TRUEevaluated 530 times by 3 tests
Evaluated by:
  • chgrp
  • chown
  • du
FALSEevaluated 14208 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
)
530-14208
36 {-
37 enum { HT_INITIAL_SIZE = 31 };-
38 fts->fts_cycle.ht = hash_initialize (HT_INITIAL_SIZE, -
39 ((void *)0)-
40 , AD_hash,-
41 AD_compare, free);-
42 if (! fts->fts_cycle.ht
! fts->fts_cycle.htDescription
TRUEnever evaluated
FALSEevaluated 530 times by 3 tests
Evaluated by:
  • chgrp
  • chown
  • du
)
0-530
43 return
never executed: return 0 ;
never executed: return 0 ;
0
44 0
never executed: return 0 ;
0
45 ;
never executed: return 0 ;
0
46 }
executed 530 times by 3 tests: end of block
Executed by:
  • chgrp
  • chown
  • du
530
47 else-
48 {-
49 fts->fts_cycle.state = malloc (sizeof *fts->fts_cycle.state);-
50 if (! fts->fts_cycle.state
! fts->fts_cycle.stateDescription
TRUEnever evaluated
FALSEevaluated 14208 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
)
0-14208
51 return
never executed: return 0 ;
never executed: return 0 ;
0
52 0
never executed: return 0 ;
0
53 ;
never executed: return 0 ;
0
54 cycle_check_init (fts->fts_cycle.state);-
55 }
executed 14208 times by 6 tests: end of block
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
14208
56-
57 return
executed 14738 times by 6 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
executed 14738 times by 6 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
14738
58 1
executed 14738 times by 6 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
14738
59 ;
executed 14738 times by 6 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
14738
60}-
61-
62-
63-
64static -
65 _Bool-
66-
67enter_dir (FTS *fts, FTSENT *ent)-
68{-
69 if (fts->fts_options & (0x0100 | 0x0002)
fts->fts_optio...0100 | 0x0002)Description
TRUEevaluated 1389 times by 3 tests
Evaluated by:
  • chgrp
  • chown
  • du
FALSEevaluated 100755 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
)
1389-100755
70 {-
71 struct stat const *st = ent->fts_statp;-
72 struct Active_dir *ad = malloc (sizeof *ad);-
73 struct Active_dir *ad_from_table;-
74-
75 if (!ad
!adDescription
TRUEnever evaluated
FALSEevaluated 1389 times by 3 tests
Evaluated by:
  • chgrp
  • chown
  • du
)
0-1389
76 return
never executed: return 0 ;
never executed: return 0 ;
0
77 0
never executed: return 0 ;
0
78 ;
never executed: return 0 ;
0
79-
80 ad->dev = st->st_dev;-
81 ad->ino = st->st_ino;-
82 ad->fts_ent = ent;-
83-
84-
85-
86-
87 ad_from_table = hash_insert (fts->fts_cycle.ht, ad);-
88-
89 if (ad_from_table != ad
ad_from_table != adDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • du
FALSEevaluated 1387 times by 3 tests
Evaluated by:
  • chgrp
  • chown
  • du
)
2-1387
90 {-
91 free (ad);-
92 if (!ad_from_table
!ad_from_tableDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • du
)
0-2
93 return
never executed: return 0 ;
never executed: return 0 ;
0
94 0
never executed: return 0 ;
0
95 ;
never executed: return 0 ;
0
96-
97-
98-
99 ent->fts_cycle = ad_from_table->fts_ent;-
100 ent->fts_info = 2;-
101 }
executed 2 times by 1 test: end of block
Executed by:
  • du
2
102 }
executed 1389 times by 3 tests: end of block
Executed by:
  • chgrp
  • chown
  • du
1389
103 else-
104 {-
105 if (cycle_check (fts->fts_cycle.state, ent->fts_statp)
cycle_check (f...nt->fts_statp)Description
TRUEnever evaluated
FALSEevaluated 100755 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
)
0-100755
106 {-
107-
108-
109-
110-
111 ent->fts_cycle = ent;-
112 ent->fts_info = 2;-
113 }
never executed: end of block
0
114 }
executed 100755 times by 6 tests: end of block
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
100755
115-
116 return
executed 102144 times by 6 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
executed 102144 times by 6 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
102144
117 1
executed 102144 times by 6 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
102144
118 ;
executed 102144 times by 6 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
102144
119}-
120-
121-
122-
123static void-
124leave_dir (FTS *fts, FTSENT *ent)-
125{-
126 struct stat const *st = ent->fts_statp;-
127 if (fts->fts_options & (0x0100 | 0x0002)
fts->fts_optio...0100 | 0x0002)Description
TRUEevaluated 1387 times by 3 tests
Evaluated by:
  • chgrp
  • chown
  • du
FALSEevaluated 100750 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
)
1387-100750
128 {-
129 struct Active_dir obj;-
130 void *found;-
131 obj.dev = st->st_dev;-
132 obj.ino = st->st_ino;-
133 found = hash_delete (fts->fts_cycle.ht, &obj);-
134 if (!found
!foundDescription
TRUEnever evaluated
FALSEevaluated 1387 times by 3 tests
Evaluated by:
  • chgrp
  • chown
  • du
)
0-1387
135 abort ();
never executed: abort ();
0
136 free (found);-
137 }
executed 1387 times by 3 tests: end of block
Executed by:
  • chgrp
  • chown
  • du
1387
138 else-
139 {-
140 FTSENT *parent = ent->fts_parent;-
141 if (parent !=
parent != ((void *)0)Description
TRUEevaluated 100750 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
FALSEnever evaluated
0-100750
142 ((void *)0)
parent != ((void *)0)Description
TRUEevaluated 100750 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
FALSEnever evaluated
0-100750
143 && 0 <= parent->fts_level
0 <= parent->fts_levelDescription
TRUEevaluated 95861 times by 5 tests
Evaluated by:
  • chgrp
  • chmod
  • du
  • mv
  • rm
FALSEevaluated 4889 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
)
4889-95861
144 do { if ((
(fts->fts_cycl...r_counter == 0Description
TRUEnever evaluated
FALSEevaluated 95861 times by 5 tests
Evaluated by:
  • chgrp
  • chmod
  • du
  • mv
  • rm
fts->fts_cycle.state)->chdir_counter == 0
(fts->fts_cycl...r_counter == 0Description
TRUEnever evaluated
FALSEevaluated 95861 times by 5 tests
Evaluated by:
  • chgrp
  • chmod
  • du
  • mv
  • rm
) abort ();
never executed: abort ();
if ((((
((fts->fts_cyc...= (*st).st_inoDescription
TRUEevaluated 1632 times by 5 tests
Evaluated by:
  • chgrp
  • chmod
  • du
  • mv
  • rm
FALSEevaluated 94229 times by 4 tests
Evaluated by:
  • chmod
  • du
  • mv
  • rm
fts->fts_cycle.state)->dev_ino).st_ino == (*st).st_ino
((fts->fts_cyc...= (*st).st_inoDescription
TRUEevaluated 1632 times by 5 tests
Evaluated by:
  • chgrp
  • chmod
  • du
  • mv
  • rm
FALSEevaluated 94229 times by 4 tests
Evaluated by:
  • chmod
  • du
  • mv
  • rm
&& ((
((fts->fts_cyc...= (*st).st_devDescription
TRUEevaluated 1632 times by 5 tests
Evaluated by:
  • chgrp
  • chmod
  • du
  • mv
  • rm
FALSEnever evaluated
fts->fts_cycle.state)->dev_ino).st_dev == (*st).st_dev
((fts->fts_cyc...= (*st).st_devDescription
TRUEevaluated 1632 times by 5 tests
Evaluated by:
  • chgrp
  • chmod
  • du
  • mv
  • rm
FALSEnever evaluated
)) { (fts->fts_cycle.state)->dev_ino.st_dev = (*(parent->fts_statp)).st_dev; (fts->fts_cycle.state)->dev_ino.st_ino = (*(parent->fts_statp)).st_ino; }
executed 1632 times by 5 tests: end of block
Executed by:
  • chgrp
  • chmod
  • du
  • mv
  • rm
}
executed 95861 times by 5 tests: end of block
Executed by:
  • chgrp
  • chmod
  • du
  • mv
  • rm
while (0)
0-95861
145 ;-
146 }
executed 100750 times by 6 tests: end of block
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
100750
147}-
148-
149-
150-
151static void-
152free_dir (FTS *sp)-
153{-
154 if (sp->fts_options & (0x0100 | 0x0002)
sp->fts_option...0100 | 0x0002)Description
TRUEevaluated 530 times by 3 tests
Evaluated by:
  • chgrp
  • chown
  • du
FALSEevaluated 14208 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
)
530-14208
155 {-
156 if (sp->fts_cycle.ht
sp->fts_cycle.htDescription
TRUEevaluated 530 times by 3 tests
Evaluated by:
  • chgrp
  • chown
  • du
FALSEnever evaluated
)
0-530
157 hash_free (sp->fts_cycle.ht);
executed 530 times by 3 tests: hash_free (sp->fts_cycle.ht);
Executed by:
  • chgrp
  • chown
  • du
530
158 }
executed 530 times by 3 tests: end of block
Executed by:
  • chgrp
  • chown
  • du
530
159 else-
160 free (sp->fts_cycle.state);
executed 14208 times by 6 tests: free (sp->fts_cycle.state);
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
14208
161}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2