git: d8d0ac7b5d73 - stable/13 - efivar: use bool for booleans
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Mar 2022 21:57:36 UTC
The branch stable/13 has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=d8d0ac7b5d735f412c1d1ed7d5be0ab2ecffd1d5 commit d8d0ac7b5d735f412c1d1ed7d5be0ab2ecffd1d5 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2021-04-09 22:35:50 +0000 Commit: Eric van Gyzen <vangyzen@FreeBSD.org> CommitDate: 2022-03-02 21:56:31 +0000 efivar: use bool for booleans Rather than int flags we ++, use booleans for all command line args. No functional change intended. Reviewed by: markj@ Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D29621 (cherry picked from commit 066b096d13a150e802c7142602d821c0b494487b) --- usr.sbin/efivar/efivar.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/usr.sbin/efivar/efivar.c b/usr.sbin/efivar/efivar.c index 2fdf0e4d09b8..eb9a6e0257c8 100644 --- a/usr.sbin/efivar/efivar.c +++ b/usr.sbin/efivar/efivar.c @@ -70,9 +70,8 @@ static struct option longopts[] = { }; -static int aflag, Aflag, bflag, dflag, Dflag, gflag, Hflag, Nflag, - lflag, Lflag, Rflag, wflag, pflag, uflag, load_opt_flag; -static bool quiet; +static bool aflag, Aflag, bflag, dflag, Dflag, gflag, Hflag, Nflag, + lflag, Lflag, Rflag, wflag, pflag, uflag, load_opt_flag, quiet; static char *varname; static char *fromfile; static u_long attrib = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS; @@ -316,58 +315,58 @@ parse_args(int argc, char **argv) longopts, NULL)) != -1) { switch (ch) { case 'a': - aflag++; + aflag = true; break; case 'A': - Aflag++; + Aflag = true; break; case 'b': - bflag++; + bflag = true; break; case 'd': - dflag++; + dflag = true; break; case 'D': - Dflag++; + Dflag = true; break; case 'g': - gflag++; + gflag = true; break; case 'H': - Hflag++; + Hflag = true; break; case 'l': - lflag++; + lflag = true; break; case 'L': - Lflag++; + Lflag = true; break; case 'n': varname = optarg; break; case 'N': - Nflag++; + Nflag = true; break; case 'O': - load_opt_flag++; + load_opt_flag = true; break; case 'p': - pflag++; + pflag = true; break; case 'q': quiet = true; break; case 'R': - Rflag++; + Rflag = true; break; case 't': attrib = strtoul(optarg, NULL, 16); break; case 'u': - uflag++; + uflag = true; break; case 'w': - wflag++; + wflag = true; break; case 'f': free(fromfile); @@ -386,13 +385,13 @@ parse_args(int argc, char **argv) if (argc == 1) varname = argv[0]; - if (aflag + Dflag + wflag > 1) { + if ((int)aflag + (int)Dflag + (int)wflag > 1) { warnx("Can only use one of -a (--append), " "-D (--delete) and -w (--write)"); usage(); } - if (aflag + Dflag + wflag > 0 && varname == NULL) { + if ((int)aflag + (int)Dflag + (int)wflag > 0 && varname == NULL) { warnx("Must specify a variable for -a (--append), " "-D (--delete) or -w (--write)"); usage(); @@ -407,13 +406,13 @@ parse_args(int argc, char **argv) else if (Lflag) print_known_guid(); else if (fromfile) { - Nflag = 1; + Nflag = true; print_var(NULL, NULL); } else if (varname) { - pflag++; + pflag = true; print_variable(varname); } else if (argc > 0) { - pflag++; + pflag = true; for (i = 0; i < argc; i++) print_variable(argv[i]); } else