2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 06:15:15 +00:00

We no longer need sensors_get_label_and_valid(), as it does hardly

more than sensors_get_label(). This allows for some cleanups.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4645 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2007-07-24 08:21:23 +00:00
parent e9c8c5fb06
commit 9896986247
3 changed files with 15 additions and 42 deletions

View File

@@ -86,46 +86,32 @@ void print_label(const char *label, int space)
printf("%s:%*s", label, space - len, "");
}
int sensors_get_label_and_valid(sensors_chip_name name, int feature, char **label,
int *valid)
{
int err;
err = sensors_get_label(name,feature,label);
*valid = !err;
return err;
}
void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size)
{
char *label;
int valid;
double vid;
if (!sensors_get_label_and_valid(*name,f_vid,&label,&valid)
if (!sensors_get_label(*name, f_vid, &label)
&& !sensors_get_feature(*name,f_vid,&vid) ) {
if (valid) {
print_label(label, label_size);
printf("%+6.3f V\n", vid);
}
print_label(label, label_size);
printf("%+6.3f V\n", vid);
}
free(label);
}
void print_unknown_chip(const sensors_chip_name *name)
{
int a, valid;
int a;
const sensors_feature_data *data;
char *label;
double val;
a = 0;
while((data=sensors_get_all_features(*name, &a))) {
if (sensors_get_label_and_valid(*name,data->number,&label,&valid)) {
if (sensors_get_label(*name, data->number, &label)) {
printf("ERROR: Can't get feature `%s' data!\n",data->name);
continue;
}
if (! valid)
continue;
if (data->mode & SENSORS_MODE_R) {
if(sensors_get_feature(*name,data->number,&val)) {
printf("ERROR: Can't get feature `%s' data!\n",data->name);