Prefer other types to int in tar.c

Use types that are more specific than ‘int’, if that is easy.
* src/tar.c (after_date_option, xattrs_option, check_links_option)
(confirm, confirm_file_EOF, set_xattr_option, optloc_eq)
(get_date_or_file):
Prefer bool to int.
(tar_list_quoting_styles, tar_set_quoting_style, parse_opt):
Prefer idx_t to int.
(optloc_lookup, option_set_in_cl): Prefer enum option_class to int.
(decode_signal): Avoid some pointer reallocation.
(sort_mode_flag, hole_detection_types, set_old_files_option)
(is_subcommand_class): Prefer enum to int.
(parse_opt) [DEVICE_PREFIX]: Remove unused var.
Simplify creation of device name.
(find_argp_option_key, find_argp_option): Prefer char to int.
(enum subcommand_class): Now named.
(subcommand_class): Now char, not int.
(decode_options): Check for unlikely int overflow.
This commit is contained in:
Paul Eggert
2024-11-01 09:40:36 -07:00
parent 0aa69501d3
commit 5a7185ae31
5 changed files with 61 additions and 70 deletions

View File

@@ -936,7 +936,7 @@ start_header (struct tar_stat_info *st)
}
if ((selinux_context_option > 0) && st->cntx_name)
xheader_store ("RHT.security.selinux", st, NULL);
if (xattrs_option > 0)
if (xattrs_option)
for (idx_t i = 0; i < st->xattr_map.xm_size; i++)
xheader_store (st->xattr_map.xm_map[i].xkey, st, &i);
}