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
This commit is contained in:
Greg V 2022-06-27 14:41:59 -06:00 committed by Warner Losh
parent f25727898a
commit e6ba4cda73

View File

@ -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);