mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-12-05 22:08:19 +00:00
With the new dynamic chip features enumeration code, the sensors_proc_chips
and sensors_chip_features_list arrays tend to track the same information. So it's much more simple, and more efficient, to have a single array. I decided to keep sensors_proc_chips, because it already has memory management helpers. One nice side effect is that the arbitrary limit to the number of supported chips is now gone. Another one is that some of the memory leaks were fixed. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4510 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
32b1b71245
commit
92b5982180
5 files changed
+51
-64
No files matched your search
+10
-10
@@ -105,9 +105,9 @@ const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *c
|
||||
int i, j;
|
||||
const sensors_chip_feature *features;
|
||||
|
||||
for (i = 0; sensors_chip_features_list[i].chip.prefix; i++)
|
||||
if (sensors_match_chip(sensors_chip_features_list[i].chip, *chip)) {
|
||||
features = sensors_chip_features_list[i].feature;
|
||||
for (i = 0; i < sensors_proc_chips_count; i++)
|
||||
if (sensors_match_chip(sensors_proc_chips[i].chip, *chip)) {
|
||||
features = sensors_proc_chips[i].feature;
|
||||
for (j = 0; features[j].data.name; j++)
|
||||
if (features[j].data.number == feature)
|
||||
return features + j;
|
||||
@@ -124,9 +124,9 @@ const sensors_chip_feature *sensors_lookup_feature_name(const sensors_chip_name
|
||||
int i, j;
|
||||
const sensors_chip_feature *features;
|
||||
|
||||
for (i = 0; sensors_chip_features_list[i].chip.prefix; i++)
|
||||
if (sensors_match_chip(sensors_chip_features_list[i].chip, *chip)) {
|
||||
features = sensors_chip_features_list[i].feature;
|
||||
for (i = 0; i < sensors_proc_chips_count; i++)
|
||||
if (sensors_match_chip(sensors_proc_chips[i].chip, *chip)) {
|
||||
features = sensors_proc_chips[i].feature;
|
||||
for (j = 0; features[j].data.name; j++)
|
||||
if (!strcasecmp(features[j].data.name, feature))
|
||||
return features + j;
|
||||
@@ -304,7 +304,7 @@ const sensors_chip_name *sensors_get_detected_chips(int *nr)
|
||||
{
|
||||
const sensors_chip_name *res;
|
||||
res = (*nr >= sensors_proc_chips_count ?
|
||||
NULL : &sensors_proc_chips[*nr]);
|
||||
NULL : &sensors_proc_chips[*nr].chip);
|
||||
(*nr)++;
|
||||
return res;
|
||||
}
|
||||
@@ -332,9 +332,9 @@ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name,
|
||||
sensors_chip_feature *feature_list;
|
||||
int i;
|
||||
|
||||
for (i = 0; sensors_chip_features_list[i].chip.prefix; i++)
|
||||
if (sensors_match_chip(sensors_chip_features_list[i].chip, name)) {
|
||||
feature_list = sensors_chip_features_list[i].feature;
|
||||
for (i = 0; i < sensors_proc_chips_count; i++)
|
||||
if (sensors_match_chip(sensors_proc_chips[i].chip, name)) {
|
||||
feature_list = sensors_proc_chips[i].feature;
|
||||
if (!*nr1 && !*nr2) { /* Return the first entry */
|
||||
if (!feature_list[0].data.name) /* The list may be empty */
|
||||
return NULL;
|
||||
|
||||
Reference in new issue
Block a user