diff --git a/CHANGES b/CHANGES index fd221732..899237c8 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,7 @@ SVN HEAD Delete all remnants of algorithm names Drop all the chip-specific support Fix a memory leak on error + Speed up sensors_get_ignored() a bit Makefile: Drop the package and version targets Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete diff --git a/lib/access.c b/lib/access.c index 4312add2..8b4006f8 100644 --- a/lib/access.c +++ b/lib/access.c @@ -198,10 +198,8 @@ int sensors_get_ignored(sensors_chip_name name, int feature) const sensors_chip *chip; const sensors_chip_feature *featureptr; const sensors_chip_feature *alt_featureptr; - int i, res; + int i; - /* Default: valid */ - res = 1; if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; if (!(featureptr = sensors_lookup_feature_nr(&name, feature))) @@ -214,13 +212,12 @@ int sensors_get_ignored(sensors_chip_name name, int feature) return -SENSORS_ERR_NO_ENTRY; for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->ignores_count; i++) - if (!strcasecmp(featureptr->data.name, chip->ignores[i].name)) - return 0; /* Exact match always overrules! */ - else if (alt_featureptr && - !strcasecmp(alt_featureptr->data.name, - chip->ignores[i].name)) - res = 0; - return res; + if (!strcasecmp(featureptr->data.name, chip->ignores[i].name) || + (alt_featureptr && + !strcasecmp(alt_featureptr->data.name, chip->ignores[i].name))) + return 0; + /* valid */ + return 1; } /* Read the value of a feature of a certain chip. Note that chip should not