mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-29 12:50:43 +00:00
Speed up sensors_get_ignored() a bit. We can return as soon as an ignore
statement is found to match, even if it isn't an exact match. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4640 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
5611ffe6d1
commit
db2c145d9d
2 files changed
+8
-10
No files matched your search
@@ -3,6 +3,7 @@ lm_sensors CHANGES file
|
||||
|
||||
SVN HEAD
|
||||
Library: Fix a memory leak on error
|
||||
Speed up sensors_get_ignored() a bit
|
||||
Module i2c-piix4: Add ATI SB700 support (2.6 backport)
|
||||
|
||||
|
||||
|
||||
+7
-10
@@ -196,10 +196,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.prefix, feature)))
|
||||
@@ -212,13 +210,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
|
||||
|
||||
Reference in new issue
Block a user