From bb6495d47debf3599e2da18a57160a401b3ec1ca Mon Sep 17 00:00:00 2001 From: Andre Prendel Date: Wed, 4 Nov 2009 19:07:38 +0000 Subject: [PATCH] sensord: Change signature of (*FeatureFN) This patch changes the signature of function pointer (*FeatureFN) and the related functions: rrdGetSensors_DS() rrdCGI_DEF() rrdCGI_LINE() Return type is now void because none of the functions return an error code. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5793 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/rrd.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index 3ca0c266..c676471c 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -68,8 +68,8 @@ static char rrdLabels[MAX_RRD_SENSORS][RAW_LABEL_LENGTH + 1]; #define LOADAVG "loadavg" #define LOAD_AVERAGE "Load Average" -typedef int (*FeatureFN) (void *data, const char *rawLabel, const char *label, - const FeatureDescriptor *feature); +typedef void (*FeatureFN) (void *data, const char *rawLabel, const char *label, + const FeatureDescriptor *feature); static char rrdNextChar(char c) { @@ -141,7 +141,7 @@ static int _applyToFeatures(FeatureFN fn, void *data, const sensors_chip_name *chip, const ChipDescriptor *desc) { - int i, ret; + int i; const FeatureDescriptor *features = desc->features; const FeatureDescriptor *feature; const char *rawLabel; @@ -159,7 +159,7 @@ static int _applyToFeatures(FeatureFN fn, void *data, } rrdCheckLabel(rawLabel, i); - ret = fn(data, rrdLabels[i], label, feature); + fn(data, rrdLabels[i], label, feature); free(label); } return 0; @@ -210,9 +210,9 @@ struct ds { const char **argv; }; -static int rrdGetSensors_DS(void *_data, const char *rawLabel, - const char *label, - const FeatureDescriptor *feature) +static void rrdGetSensors_DS(void *_data, const char *rawLabel, + const char *label, + const FeatureDescriptor *feature) { (void) label; /* no warning */ if (!feature || feature->rrd) { @@ -247,7 +247,6 @@ static int rrdGetSensors_DS(void *_data, const char *rawLabel, sprintf(ptr, "DS:%s:GAUGE:%d:%s:%s", rawLabel, 5 * sensord_args.rrdTime, min, max); } - return 0; } static int rrdGetSensors(const char **argv) @@ -256,7 +255,7 @@ static int rrdGetSensors(const char **argv) struct ds data = { 0, argv}; ret = applyToFeatures(rrdGetSensors_DS, &data); if (!ret && sensord_args.doLoad) - ret = rrdGetSensors_DS(&data, LOADAVG, LOAD_AVERAGE, NULL); + rrdGetSensors_DS(&data, LOADAVG, LOAD_AVERAGE, NULL); return ret ? -1 : data.num; } @@ -323,15 +322,14 @@ struct gr { int loadAvg; }; -static int rrdCGI_DEF(void *_data, const char *rawLabel, const char *label, - const FeatureDescriptor *feature) +static void rrdCGI_DEF(void *_data, const char *rawLabel, const char *label, + const FeatureDescriptor *feature) { struct gr *data = _data; (void) label; /* no warning */ if (!feature || (feature->rrd && (feature->type == data->type))) printf("\n\tDEF:%s=%s:%s:AVERAGE", rawLabel, sensord_args.rrdFile, rawLabel); - return 0; } /* @@ -359,14 +357,13 @@ static int rrdCGI_color(const char *label) return color; } -static int rrdCGI_LINE(void *_data, const char *rawLabel, const char *label, - const FeatureDescriptor *feature) +static void rrdCGI_LINE(void *_data, const char *rawLabel, const char *label, + const FeatureDescriptor *feature) { struct gr *data = _data; if (!feature || (feature->rrd && (feature->type == data->type))) printf("\n\tLINE2:%s#%.6x:\"%s\"", rawLabel, rrdCGI_color(label), label); - return 0; } static struct gr graphs[] = { @@ -488,11 +485,11 @@ int rrdCGI(void) if (!ret) ret = applyToFeatures(rrdCGI_DEF, graph); if (!ret && sensord_args.doLoad && graph->loadAvg) - ret = rrdCGI_DEF(graph, LOADAVG, LOAD_AVERAGE, NULL); + rrdCGI_DEF(graph, LOADAVG, LOAD_AVERAGE, NULL); if (!ret) ret = applyToFeatures(rrdCGI_LINE, graph); if (!ret && sensord_args.doLoad && graph->loadAvg) - ret = rrdCGI_LINE(graph, LOADAVG, LOAD_AVERAGE, NULL); + rrdCGI_LINE(graph, LOADAVG, LOAD_AVERAGE, NULL); printf (">\n

\n"); } printf("

\nsensord by "