git: ea002c1017f8 - main - devmatch: Convert command line flags to bools
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 Apr 2024 22:57:53 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ea002c1017f86fd5d1b778f9600b06f3561ab868 commit ea002c1017f86fd5d1b778f9600b06f3561ab868 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2024-04-05 22:34:03 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-04-05 22:53:47 +0000 devmatch: Convert command line flags to bools These are bools, and should have been bools from the start. Make them bools. Sponsored by: Netflix --- sbin/devmatch/devmatch.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/sbin/devmatch/devmatch.c b/sbin/devmatch/devmatch.c index 6124794d113a..49f9be00a2e7 100644 --- a/sbin/devmatch/devmatch.c +++ b/sbin/devmatch/devmatch.c @@ -30,6 +30,7 @@ #include <errno.h> #include <fcntl.h> #include <getopt.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -54,13 +55,13 @@ static struct option longopts[] = { #define DEVMATCH_MAX_HITS 256 -static int all_flag; -static int dump_flag; +static bool all_flag; +static bool dump_flag; static char *linker_hints; static char *nomatch_str; -static int quiet_flag; -static int unbound_flag; -static int verbose_flag; +static bool quiet_flag; +static bool unbound_flag; +static bool verbose_flag; static void *hints; static void *hints_end; @@ -573,10 +574,10 @@ main(int argc, char **argv) longopts, NULL)) != -1) { switch (ch) { case 'a': - all_flag++; + all_flag = true; break; case 'd': - dump_flag++; + dump_flag = true; break; case 'h': linker_hints = optarg; @@ -585,13 +586,13 @@ main(int argc, char **argv) nomatch_str = optarg; break; case 'q': - quiet_flag++; + quiet_flag = true; break; case 'u': - unbound_flag++; + unbound_flag = true; break; case 'v': - verbose_flag++; + verbose_flag = true; break; default: usage();