| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/backup-find.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | - | |||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | char * | - | ||||||||||||||||||
| 11 | find_backup_file_name (char const *file, enum backup_type backup_type) | - | ||||||||||||||||||
| 12 | { | - | ||||||||||||||||||
| 13 | char *result = backupfile_internal (file, backup_type, | - | ||||||||||||||||||
| 14 | 0 | - | ||||||||||||||||||
| 15 | ); | - | ||||||||||||||||||
| 16 | if (!result
| 0-9 | ||||||||||||||||||
| 17 | xalloc_die (); never executed: xalloc_die (); | 0 | ||||||||||||||||||
| 18 | return executed 9 times by 2 tests: result;return result;Executed by:
executed 9 times by 2 tests: return result;Executed by:
| 9 | ||||||||||||||||||
| 19 | } | - | ||||||||||||||||||
| 20 | - | |||||||||||||||||||
| 21 | static char const *const backup_args[] = | - | ||||||||||||||||||
| 22 | { | - | ||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | - | |||||||||||||||||||
| 25 | "none", "off", | - | ||||||||||||||||||
| 26 | "simple", "never", | - | ||||||||||||||||||
| 27 | "existing", "nil", | - | ||||||||||||||||||
| 28 | "numbered", "t", | - | ||||||||||||||||||
| 29 | - | |||||||||||||||||||
| 30 | ((void *)0) | - | ||||||||||||||||||
| 31 | - | |||||||||||||||||||
| 32 | }; | - | ||||||||||||||||||
| 33 | - | |||||||||||||||||||
| 34 | static const enum backup_type backup_types[] = | - | ||||||||||||||||||
| 35 | { | - | ||||||||||||||||||
| 36 | no_backups, no_backups, | - | ||||||||||||||||||
| 37 | simple_backups, simple_backups, | - | ||||||||||||||||||
| 38 | numbered_existing_backups, numbered_existing_backups, | - | ||||||||||||||||||
| 39 | numbered_backups, numbered_backups | - | ||||||||||||||||||
| 40 | }; | - | ||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | - | |||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | _Static_assert ((sizeof (backup_args) / sizeof *(backup_args)) == (sizeof (backup_types) / sizeof *(backup_types)) + 1, "verify (" "ARRAY_CARDINALITY (backup_args) == ARRAY_CARDINALITY (backup_types) + 1" ")"); | - | ||||||||||||||||||
| 45 | - | |||||||||||||||||||
| 46 | - | |||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | - | |||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | - | |||||||||||||||||||
| 51 | enum backup_type | - | ||||||||||||||||||
| 52 | get_version (char const *context, char const *version) | - | ||||||||||||||||||
| 53 | { | - | ||||||||||||||||||
| 54 | if (version == 0
| 0-138 | ||||||||||||||||||
| 55 | return executed 21 times by 3 tests: numbered_existing_backups;return numbered_existing_backups;Executed by:
executed 21 times by 3 tests: return numbered_existing_backups;Executed by:
| 21 | ||||||||||||||||||
| 56 | else | - | ||||||||||||||||||
| 57 | return executed 138 times by 4 tests: ((backup_types) [__xargmatch_internal (context, version, backup_args, (char const *) (backup_types), sizeof *(backup_types), argmatch_die)]);return ((backup_types) [__xargmatch_internal (context, version, backup_args, (char const *) (backup_types), sizeof *(backup_types), argmatch_die)]);Executed by:
executed 138 times by 4 tests: return ((backup_types) [__xargmatch_internal (context, version, backup_args, (char const *) (backup_types), sizeof *(backup_types), argmatch_die)]);Executed by:
| 138 | ||||||||||||||||||
| 58 | } | - | ||||||||||||||||||
| 59 | enum backup_type | - | ||||||||||||||||||
| 60 | xget_version (char const *context, char const *version) | - | ||||||||||||||||||
| 61 | { | - | ||||||||||||||||||
| 62 | if (version
| 0-94 | ||||||||||||||||||
| 63 | return executed 94 times by 4 tests: get_version (context, version);return get_version (context, version);Executed by:
executed 94 times by 4 tests: return get_version (context, version);Executed by:
| 94 | ||||||||||||||||||
| 64 | else | - | ||||||||||||||||||
| 65 | return executed 65 times by 3 tests: get_version ("$VERSION_CONTROL", getenv ("VERSION_CONTROL"));return get_version ("$VERSION_CONTROL", getenv ("VERSION_CONTROL"));Executed by:
executed 65 times by 3 tests: return get_version ("$VERSION_CONTROL", getenv ("VERSION_CONTROL"));Executed by:
| 65 | ||||||||||||||||||
| 66 | } | - | ||||||||||||||||||
| Switch to Source code | Preprocessed file |