| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/cp-hash.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | - | |||||||
| 6 | - | |||||||
| 7 | - | |||||||
| 8 | - | |||||||
| 9 | struct Src_to_dest | - | ||||||
| 10 | { | - | ||||||
| 11 | ino_t st_ino; | - | ||||||
| 12 | dev_t st_dev; | - | ||||||
| 13 | - | |||||||
| 14 | - | |||||||
| 15 | - | |||||||
| 16 | char *name; | - | ||||||
| 17 | }; | - | ||||||
| 18 | - | |||||||
| 19 | - | |||||||
| 20 | - | |||||||
| 21 | static Hash_table *src_to_dest; | - | ||||||
| 22 | - | |||||||
| 23 | - | |||||||
| 24 | - | |||||||
| 25 | - | |||||||
| 26 | static size_t | - | ||||||
| 27 | src_to_dest_hash (void const *x, size_t table_size) | - | ||||||
| 28 | { | - | ||||||
| 29 | struct Src_to_dest const *p = x; | - | ||||||
| 30 | - | |||||||
| 31 | - | |||||||
| 32 | - | |||||||
| 33 | - | |||||||
| 34 | return executed 60272 times by 2 tests: (uintmax_t) p->st_ino % table_size;return (uintmax_t) p->st_ino % table_size;Executed by:
executed 60272 times by 2 tests: return (uintmax_t) p->st_ino % table_size;Executed by:
| 60272 | ||||||
| 35 | } | - | ||||||
| 36 | - | |||||||
| 37 | - | |||||||
| 38 | - | |||||||
| 39 | static | - | ||||||
| 40 | _Bool | - | ||||||
| 41 | - | |||||||
| 42 | src_to_dest_compare (void const *x, void const *y) | - | ||||||
| 43 | { | - | ||||||
| 44 | struct Src_to_dest const *a = x; | - | ||||||
| 45 | struct Src_to_dest const *b = y; | - | ||||||
| 46 | return executed 11704 times by 2 tests: ((*a).st_ino == (*b).st_ino && (*a).st_dev == (*b).st_dev) ? return ((*a).st_ino == (*b).st_ino && (*a).st_dev == (*b).st_dev) ? 1 : 0 ;Executed by:
executed 11704 times by 2 tests: return ((*a).st_ino == (*b).st_ino && (*a).st_dev == (*b).st_dev) ? 1 : 0 ;Executed by:
| 11704 | ||||||
| 47 | 1 executed 11704 times by 2 tests: return ((*a).st_ino == (*b).st_ino && (*a).st_dev == (*b).st_dev) ? 1 : 0 ;Executed by:
| 11704 | ||||||
| 48 | : executed 11704 times by 2 tests: return ((*a).st_ino == (*b).st_ino && (*a).st_dev == (*b).st_dev) ? 1 : 0 ;Executed by:
| 11704 | ||||||
| 49 | 0 executed 11704 times by 2 tests: return ((*a).st_ino == (*b).st_ino && (*a).st_dev == (*b).st_dev) ? 1 : 0 ;Executed by:
| 11704 | ||||||
| 50 | ; executed 11704 times by 2 tests: return ((*a).st_ino == (*b).st_ino && (*a).st_dev == (*b).st_dev) ? 1 : 0 ;Executed by:
| 11704 | ||||||
| 51 | } | - | ||||||
| 52 | - | |||||||
| 53 | static void | - | ||||||
| 54 | src_to_dest_free (void *x) | - | ||||||
| 55 | { | - | ||||||
| 56 | struct Src_to_dest *a = x; | - | ||||||
| 57 | free (a->name); | - | ||||||
| 58 | free (x); | - | ||||||
| 59 | } executed 27 times by 2 tests: end of blockExecuted by:
| 27 | ||||||
| 60 | - | |||||||
| 61 | - | |||||||
| 62 | - | |||||||
| 63 | extern void | - | ||||||
| 64 | forget_created (ino_t ino, dev_t dev) | - | ||||||
| 65 | { | - | ||||||
| 66 | struct Src_to_dest probe; | - | ||||||
| 67 | struct Src_to_dest *ent; | - | ||||||
| 68 | - | |||||||
| 69 | probe.st_ino = ino; | - | ||||||
| 70 | probe.st_dev = dev; | - | ||||||
| 71 | probe.name = | - | ||||||
| 72 | ((void *)0) | - | ||||||
| 73 | ; | - | ||||||
| 74 | - | |||||||
| 75 | ent = hash_delete (src_to_dest, &probe); | - | ||||||
| 76 | if (ent
| 4-9 | ||||||
| 77 | src_to_dest_free (ent); executed 4 times by 1 test: src_to_dest_free (ent);Executed by:
| 4 | ||||||
| 78 | } executed 13 times by 2 tests: end of blockExecuted by:
| 13 | ||||||
| 79 | - | |||||||
| 80 | - | |||||||
| 81 | - | |||||||
| 82 | - | |||||||
| 83 | extern char * | - | ||||||
| 84 | src_to_dest_lookup (ino_t ino, dev_t dev) | - | ||||||
| 85 | { | - | ||||||
| 86 | struct Src_to_dest ent; | - | ||||||
| 87 | struct Src_to_dest const *e; | - | ||||||
| 88 | ent.st_ino = ino; | - | ||||||
| 89 | ent.st_dev = dev; | - | ||||||
| 90 | e = hash_lookup (src_to_dest, &ent); | - | ||||||
| 91 | return executed 34481 times by 2 tests: e ? e->name : return e ? e->name : ((void *)0) ;Executed by:
executed 34481 times by 2 tests: return e ? e->name : ((void *)0) ;Executed by:
| 34481 | ||||||
| 92 | ((void *)0) executed 34481 times by 2 tests: return e ? e->name : ((void *)0) ;Executed by:
| 34481 | ||||||
| 93 | ; executed 34481 times by 2 tests: return e ? e->name : ((void *)0) ;Executed by:
| 34481 | ||||||
| 94 | } | - | ||||||
| 95 | - | |||||||
| 96 | - | |||||||
| 97 | - | |||||||
| 98 | - | |||||||
| 99 | - | |||||||
| 100 | extern char * | - | ||||||
| 101 | remember_copied (const char *name, ino_t ino, dev_t dev) | - | ||||||
| 102 | { | - | ||||||
| 103 | struct Src_to_dest *ent; | - | ||||||
| 104 | struct Src_to_dest *ent_from_table; | - | ||||||
| 105 | - | |||||||
| 106 | ent = xmalloc (sizeof *ent); | - | ||||||
| 107 | ent->name = xstrdup (name); | - | ||||||
| 108 | ent->st_ino = ino; | - | ||||||
| 109 | ent->st_dev = dev; | - | ||||||
| 110 | - | |||||||
| 111 | ent_from_table = hash_insert (src_to_dest, ent); | - | ||||||
| 112 | if (ent_from_table ==
| 0-7959 | ||||||
| 113 | ((void *)0)
| 0-7959 | ||||||
| 114 | ) | - | ||||||
| 115 | { | - | ||||||
| 116 | - | |||||||
| 117 | xalloc_die (); | - | ||||||
| 118 | } never executed: end of block | 0 | ||||||
| 119 | - | |||||||
| 120 | - | |||||||
| 121 | - | |||||||
| 122 | - | |||||||
| 123 | if (ent_from_table != ent
| 23-7936 | ||||||
| 124 | { | - | ||||||
| 125 | src_to_dest_free (ent); | - | ||||||
| 126 | return executed 23 times by 2 tests: (char *) ent_from_table->name;return (char *) ent_from_table->name;Executed by:
executed 23 times by 2 tests: return (char *) ent_from_table->name;Executed by:
| 23 | ||||||
| 127 | } | - | ||||||
| 128 | - | |||||||
| 129 | - | |||||||
| 130 | return executed 7936 times by 2 tests: return ((void *)0) ;Executed by:
executed 7936 times by 2 tests: return ((void *)0) ;Executed by:
| 7936 | ||||||
| 131 | ((void *)0) executed 7936 times by 2 tests: return ((void *)0) ;Executed by:
| 7936 | ||||||
| 132 | ; executed 7936 times by 2 tests: return ((void *)0) ;Executed by:
| 7936 | ||||||
| 133 | } | - | ||||||
| 134 | - | |||||||
| 135 | - | |||||||
| 136 | extern void | - | ||||||
| 137 | hash_init (void) | - | ||||||
| 138 | { | - | ||||||
| 139 | src_to_dest = hash_initialize (103, | - | ||||||
| 140 | ((void *)0) | - | ||||||
| 141 | , | - | ||||||
| 142 | src_to_dest_hash, | - | ||||||
| 143 | src_to_dest_compare, | - | ||||||
| 144 | src_to_dest_free); | - | ||||||
| 145 | if (src_to_dest ==
| 0-1336 | ||||||
| 146 | ((void *)0)
| 0-1336 | ||||||
| 147 | ) | - | ||||||
| 148 | xalloc_die (); never executed: xalloc_die (); | 0 | ||||||
| 149 | } executed 1336 times by 3 tests: end of blockExecuted by:
| 1336 | ||||||
| 150 | - | |||||||
| 151 | - | |||||||
| 152 | - | |||||||
| 153 | - | |||||||
| 154 | extern void | - | ||||||
| 155 | forget_all (void) | - | ||||||
| 156 | { | - | ||||||
| 157 | hash_free (src_to_dest); | - | ||||||
| 158 | } never executed: end of block | 0 | ||||||
| Switch to Source code | Preprocessed file |