| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/fts-cycle.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||||||||
| 3 | struct Active_dir | - | ||||||||||||||||||||||||||||||||||||
| 4 | { | - | ||||||||||||||||||||||||||||||||||||
| 5 | dev_t dev; | - | ||||||||||||||||||||||||||||||||||||
| 6 | ino_t ino; | - | ||||||||||||||||||||||||||||||||||||
| 7 | FTSENT *fts_ent; | - | ||||||||||||||||||||||||||||||||||||
| 8 | }; | - | ||||||||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||||||||
| 10 | static | - | ||||||||||||||||||||||||||||||||||||
| 11 | _Bool | - | ||||||||||||||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||||||||||||||
| 13 | AD_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: ax->ino == ay->inoreturn ax->ino == ay->ino && ax->dev == ay->dev;Executed by:
executed 1431 times by 3 tests: return ax->ino == ay->ino && ax->dev == ay->dev;Executed by:
| 1431 | ||||||||||||||||||||||||||||||||||||
| 18 | && ax->dev == ay->dev; executed 1431 times by 3 tests: return ax->ino == ay->ino && ax->dev == ay->dev;Executed by:
| 1431 | ||||||||||||||||||||||||||||||||||||
| 19 | } | - | ||||||||||||||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||||||||||||||
| 21 | static size_t | - | ||||||||||||||||||||||||||||||||||||
| 22 | AD_hash (void const *x, size_t table_size) | - | ||||||||||||||||||||||||||||||||||||
| 23 | { | - | ||||||||||||||||||||||||||||||||||||
| 24 | struct Active_dir const *ax = x; | - | ||||||||||||||||||||||||||||||||||||
| 25 | return executed 2858 times by 3 tests: (uintmax_t) ax->ino % table_size;return (uintmax_t) ax->ino % table_size;Executed by:
executed 2858 times by 3 tests: return (uintmax_t) ax->ino % table_size;Executed by:
| 2858 | ||||||||||||||||||||||||||||||||||||
| 26 | } | - | ||||||||||||||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||||||||||||||
| 30 | static | - | ||||||||||||||||||||||||||||||||||||
| 31 | _Bool | - | ||||||||||||||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||||||||||||||
| 33 | setup_dir (FTS *fts) | - | ||||||||||||||||||||||||||||||||||||
| 34 | { | - | ||||||||||||||||||||||||||||||||||||
| 35 | if (fts->fts_options & (0x0100 | 0x0002)
| 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
| 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 blockExecuted by:
| 530 | ||||||||||||||||||||||||||||||||||||
| 47 | else | - | ||||||||||||||||||||||||||||||||||||
| 48 | { | - | ||||||||||||||||||||||||||||||||||||
| 49 | fts->fts_cycle.state = malloc (sizeof *fts->fts_cycle.state); | - | ||||||||||||||||||||||||||||||||||||
| 50 | if (! fts->fts_cycle.state
| 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 blockExecuted by:
| 14208 | ||||||||||||||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||||||||||||||
| 57 | return executed 14738 times by 6 tests: return 1 ;Executed by:
executed 14738 times by 6 tests: return 1 ;Executed by:
| 14738 | ||||||||||||||||||||||||||||||||||||
| 58 | 1 executed 14738 times by 6 tests: return 1 ;Executed by:
| 14738 | ||||||||||||||||||||||||||||||||||||
| 59 | ; executed 14738 times by 6 tests: return 1 ;Executed by:
| 14738 | ||||||||||||||||||||||||||||||||||||
| 60 | } | - | ||||||||||||||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||||||||||||||
| 64 | static | - | ||||||||||||||||||||||||||||||||||||
| 65 | _Bool | - | ||||||||||||||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||||||||||||||
| 67 | enter_dir (FTS *fts, FTSENT *ent) | - | ||||||||||||||||||||||||||||||||||||
| 68 | { | - | ||||||||||||||||||||||||||||||||||||
| 69 | if (fts->fts_options & (0x0100 | 0x0002)
| 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
| 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
| 2-1387 | ||||||||||||||||||||||||||||||||||||
| 90 | { | - | ||||||||||||||||||||||||||||||||||||
| 91 | free (ad); | - | ||||||||||||||||||||||||||||||||||||
| 92 | if (!ad_from_table
| 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 blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||||||||
| 102 | } executed 1389 times by 3 tests: end of blockExecuted by:
| 1389 | ||||||||||||||||||||||||||||||||||||
| 103 | else | - | ||||||||||||||||||||||||||||||||||||
| 104 | { | - | ||||||||||||||||||||||||||||||||||||
| 105 | if (cycle_check (fts->fts_cycle.state, ent->fts_statp)
| 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 blockExecuted by:
| 100755 | ||||||||||||||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||||||||||||||
| 116 | return executed 102144 times by 6 tests: return 1 ;Executed by:
executed 102144 times by 6 tests: return 1 ;Executed by:
| 102144 | ||||||||||||||||||||||||||||||||||||
| 117 | 1 executed 102144 times by 6 tests: return 1 ;Executed by:
| 102144 | ||||||||||||||||||||||||||||||||||||
| 118 | ; executed 102144 times by 6 tests: return 1 ;Executed by:
| 102144 | ||||||||||||||||||||||||||||||||||||
| 119 | } | - | ||||||||||||||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||||||||||||||
| 123 | static void | - | ||||||||||||||||||||||||||||||||||||
| 124 | leave_dir (FTS *fts, FTSENT *ent) | - | ||||||||||||||||||||||||||||||||||||
| 125 | { | - | ||||||||||||||||||||||||||||||||||||
| 126 | struct stat const *st = ent->fts_statp; | - | ||||||||||||||||||||||||||||||||||||
| 127 | if (fts->fts_options & (0x0100 | 0x0002)
| 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
| 0-1387 | ||||||||||||||||||||||||||||||||||||
| 135 | abort (); never executed: abort (); | 0 | ||||||||||||||||||||||||||||||||||||
| 136 | free (found); | - | ||||||||||||||||||||||||||||||||||||
| 137 | } executed 1387 times by 3 tests: end of blockExecuted by:
| 1387 | ||||||||||||||||||||||||||||||||||||
| 138 | else | - | ||||||||||||||||||||||||||||||||||||
| 139 | { | - | ||||||||||||||||||||||||||||||||||||
| 140 | FTSENT *parent = ent->fts_parent; | - | ||||||||||||||||||||||||||||||||||||
| 141 | if (parent !=
| 0-100750 | ||||||||||||||||||||||||||||||||||||
| 142 | ((void *)0)
| 0-100750 | ||||||||||||||||||||||||||||||||||||
| 143 | && 0 <= parent->fts_level
| 4889-95861 | ||||||||||||||||||||||||||||||||||||
| 144 | do { if ((
never executed: if ((((abort ();
executed 1632 times by 5 tests: }end of blockExecuted by:
executed 95861 times by 5 tests: while (0)end of blockExecuted by:
| 0-95861 | ||||||||||||||||||||||||||||||||||||
| 145 | ; | - | ||||||||||||||||||||||||||||||||||||
| 146 | } executed 100750 times by 6 tests: end of blockExecuted by:
| 100750 | ||||||||||||||||||||||||||||||||||||
| 147 | } | - | ||||||||||||||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||||||||||||||
| 151 | static void | - | ||||||||||||||||||||||||||||||||||||
| 152 | free_dir (FTS *sp) | - | ||||||||||||||||||||||||||||||||||||
| 153 | { | - | ||||||||||||||||||||||||||||||||||||
| 154 | if (sp->fts_options & (0x0100 | 0x0002)
| 530-14208 | ||||||||||||||||||||||||||||||||||||
| 155 | { | - | ||||||||||||||||||||||||||||||||||||
| 156 | if (sp->fts_cycle.ht
| 0-530 | ||||||||||||||||||||||||||||||||||||
| 157 | hash_free (sp->fts_cycle.ht); executed 530 times by 3 tests: hash_free (sp->fts_cycle.ht);Executed by:
| 530 | ||||||||||||||||||||||||||||||||||||
| 158 | } executed 530 times by 3 tests: end of blockExecuted by:
| 530 | ||||||||||||||||||||||||||||||||||||
| 159 | else | - | ||||||||||||||||||||||||||||||||||||
| 160 | free (sp->fts_cycle.state); executed 14208 times by 6 tests: free (sp->fts_cycle.state);Executed by:
| 14208 | ||||||||||||||||||||||||||||||||||||
| 161 | } | - | ||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |