git: e6ba4cda739c - main - devmatch: Properly ignore commented fields

From: Warner Losh <imp_at_FreeBSD.org>
Date: Mon, 27 Jun 2022 20:46:10 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e6ba4cda739c555e341460a5d3279890206c9b3c

commit e6ba4cda739c555e341460a5d3279890206c9b3c
Author:     Greg V <greg@unrelenting.technology>
AuthorDate: 2022-06-27 20:41:59 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-06-27 20:44:23 +0000

    devmatch: Properly ignore commented fields
    
    Any field that starts with # is a commented out field (there as a place
    holder only, the data in that place holder is completely ignored). The
    previous code improperly detected this using strcmp. Instead, any field
    whose names starts with '#' is ignored.
    
    Differential Reivsion: https://reviews.freebsd.org/D34633
---
 sbin/devmatch/devmatch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sbin/devmatch/devmatch.c b/sbin/devmatch/devmatch.c
index fbb05222fa5e..20a57353ecf6 100644
--- a/sbin/devmatch/devmatch.c
+++ b/sbin/devmatch/devmatch.c
@@ -313,7 +313,7 @@ search_hints(const char *bus, const char *dev, const char *pnpinfo)
 						}
 						if (bit >= 0 && ((1 << bit) & mask) == 0)
 							break;
-						if (strcmp(cp + 2, "#") == 0) {
+						if (cp[2] == '#') {
 							if (verbose_flag) {
 								printf("Ignoring %s (%c) table=%#x tomatch=%#x\n",
 								    cp + 2, *cp, v, ival);
@@ -358,7 +358,7 @@ search_hints(const char *bus, const char *dev, const char *pnpinfo)
 							break;
 						if (bit >= 0 && ((1 << bit) & mask) == 0)
 							break;
-						if (strcmp(cp + 2, "#") == 0) {
+						if (cp[2] == '#') {
 							if (verbose_flag) {
 								printf("Ignoring %s (%c) table=%#x tomatch=%#x\n",
 								    cp + 2, *cp, v, ival);