git: 2bfdc1ee9b1f - main - cons: Use bool for boolean variables
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 24 Feb 2022 17:58:01 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2bfdc1ee9b1ff244753fa4b163e15f1de774944c commit 2bfdc1ee9b1ff244753fa4b163e15f1de774944c Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2022-02-24 17:57:03 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2022-02-24 17:58:07 +0000 cons: Use bool for boolean variables MFC After: 3 days Sponsored by: Netflix --- sys/kern/kern_cons.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c index d33811f1e3c8..06adbcc69348 100644 --- a/sys/kern/kern_cons.c +++ b/sys/kern/kern_cons.c @@ -101,7 +101,7 @@ SYSCTL_INT(_kern, OID_AUTO, consmute, CTLFLAG_RW, &cn_mute, 0, static char *consbuf; /* buffer used by `consmsgbuf' */ static struct callout conscallout; /* callout for outputting to constty */ struct msgbuf consmsgbuf; /* message buffer for console tty */ -static u_char console_pausing; /* pause after each line during probe */ +static bool console_pausing; /* pause after each line during probe */ static const char console_pausestr[] = "<pause; press any key to proceed to next line or '.' to end pause mode>"; struct tty *constty; /* pointer to console "window" tty */ @@ -183,7 +183,7 @@ cninit(void) cnadd(best_cn); } if (boothowto & RB_PAUSE) - console_pausing = 1; + console_pausing = true; /* * Make the best console the preferred console. */ @@ -200,7 +200,7 @@ cninit(void) void cninit_finish() { - console_pausing = 0; + console_pausing = false; } /* add a new physical console to back the virtual console */ @@ -321,7 +321,8 @@ sysctl_kern_console(SYSCTL_HANDLER_ARGS) struct cn_device *cnd; struct consdev *cp, **list; char *p; - int delete, error; + bool delete; + int error; struct sbuf *sb; sb = sbuf_new(NULL, NULL, CNDEVPATHMAX * 2, SBUF_AUTOEXTEND | @@ -342,9 +343,9 @@ sysctl_kern_console(SYSCTL_HANDLER_ARGS) if (error == 0 && req->newptr != NULL) { p = sbuf_data(sb); error = ENXIO; - delete = 0; + delete = false; if (*p == '-') { - delete = 1; + delete = true; p++; } SET_FOREACH(list, cons_set) { @@ -525,7 +526,7 @@ cnputc(int c) cnputc(*cp); cngrab(); if (cngetc() == '.') - console_pausing = 0; + console_pausing = false; cnungrab(); cnputc('\r'); for (cp = console_pausestr; *cp != '\0'; cp++) @@ -538,7 +539,7 @@ void cnputsn(const char *p, size_t n) { size_t i; - int unlock_reqd = 0; + bool unlock_reqd = false; if (mtx_initialized(&cnputs_mtx)) { /* @@ -549,7 +550,7 @@ cnputsn(const char *p, size_t n) if (mtx_owned(&cnputs_mtx)) return; mtx_lock_spin(&cnputs_mtx); - unlock_reqd = 1; + unlock_reqd = true; } for (i = 0; i < n; i++)