X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsensors.c;h=63a1c8ee01ae6f56bd10c081194b3f53b9680651;hb=db35efb33e81d0a013e09a8a6ffa362ad5962f7c;hp=2f3695f264401caa44b5feba6decfdec31636714;hpb=8ed3735980de12f32dd488d0d285d108f098836e;p=collectd.git diff --git a/src/sensors.c b/src/sensors.c index 2f3695f2..63a1c8ee 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -18,7 +18,7 @@ * * Authors: * Florian octo Forster - * + * * Lubos Stanek Wed Oct 27, 2006 * - config ExtendedSensorNaming option * - precise sensor feature selection (chip-bus-address/type-feature) @@ -76,7 +76,7 @@ struct sensors_labeltypes_s typedef struct sensors_labeltypes_s sensors_labeltypes_t; /* finite list of known labels extracted from lm_sensors */ -static sensors_labeltypes_t known_features[] = +static sensors_labeltypes_t known_features[] = { { "fan1", SENSOR_TYPE_FANSPEED }, { "fan2", SENSOR_TYPE_FANSPEED }, @@ -178,7 +178,7 @@ static _Bool use_labels = 0; "as bug." #endif -featurelist_t *first_feature = NULL; +static featurelist_t *first_feature = NULL; static ignorelist_t *sensor_list; #if SENSORS_API_VERSION < 0x400 @@ -273,7 +273,7 @@ static int sensors_config (const char *key, const char *value) return (0); } -void sensors_free_features (void) +static void sensors_free_features (void) { featurelist_t *thisft; featurelist_t *nextft; @@ -297,7 +297,7 @@ static int sensors_load_conf (void) FILE *fh = NULL; featurelist_t *last_feature = NULL; - + const sensors_chip_name *chip; int chip_num; @@ -386,13 +386,12 @@ static int sensors_load_conf (void) continue; } - fl = (featurelist_t *) malloc (sizeof (featurelist_t)); + fl = calloc (1, sizeof (*fl)); if (fl == NULL) { - ERROR ("sensors plugin: malloc failed."); + ERROR ("sensors plugin: calloc failed."); continue; } - memset (fl, '\0', sizeof (featurelist_t)); fl->chip = chip; fl->data = feature; @@ -443,13 +442,12 @@ static int sensors_load_conf (void) && (subfeature->type != SENSORS_SUBFEATURE_POWER_INPUT)) continue; - fl = (featurelist_t *) malloc (sizeof (featurelist_t)); + fl = calloc (1, sizeof (*fl)); if (fl == NULL) { - ERROR ("sensors plugin: malloc failed."); + ERROR ("sensors plugin: calloc failed."); continue; } - memset (fl, '\0', sizeof (featurelist_t)); fl->chip = chip; fl->feature = feature;