Skip to contentSkip to conversation

libsensors: Fix sparse warnings

PATCH New Jean Delvare 1 participant 1 message Apr 28, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsensors: Fix sparse warnings

Sparse wants forward declarations of static functions to be static as well. For sensors_eval_expr, do that. For the error callbacks, rearrange the code so that the forward declarations are no longer needed.

---
 lib/access.c |    6 +++---
 lib/error.c  |   27 +++++++++++----------------
 2 files changed, 14 insertions(+), 19 deletions(-)
lib/access.c +3 -3
@@ -435,9 +435,9 @@ sensors_get_subfeature(const sensors_chi
 }
 
 /* Evaluate an expression */
-int sensors_eval_expr(const sensors_chip_features *chip_features,
-		      const sensors_expr *expr,
-		      double val, int depth, double *result)
+static int sensors_eval_expr(const sensors_chip_features *chip_features,
+			     const sensors_expr *expr,
+			     double val, int depth, double *result)
 {
 	double res1, res2;
 	int res;
lib/error.c +9 -14
@@ -24,18 +24,6 @@
 #include "error.h"
 #include "general.h"
 
-static void sensors_default_parse_error(const char *err, int lineno);
-static void sensors_default_parse_error_wfn(const char *err,
-					    const char *filename, int lineno);
-static void sensors_default_fatal_error(const char *proc, const char *err);
-
-void (*sensors_parse_error) (const char *err, int lineno) -						sensors_default_parse_error;
-void (*sensors_parse_error_wfn) (const char *err, const char *filename,
-				 int lineno) = sensors_default_parse_error_wfn;
-void (*sensors_fatal_error) (const char *proc, const char *err) -						sensors_default_fatal_error;
-
 static const char *errorlist[] = {
 	/* Invalid error code    */ "Unknown error",
 	/* SENSORS_ERR_WILDCARDS */ "Wildcard found in chip name",
@@ -60,7 +48,7 @@ const char *sensors_strerror(int errnum)
 	return errorlist[errnum];
 }
 
-void sensors_default_parse_error(const char *err, int lineno)
+static void sensors_default_parse_error(const char *err, int lineno)
 {
 	if (lineno)
 		fprintf(stderr, "Error: Line %d: %s\n", lineno, err);
@@ -68,8 +56,8 @@ void sensors_default_parse_error(const c
 		fprintf(stderr, "Error: %s\n", err);
 }
 
-void sensors_default_parse_error_wfn(const char *err,
-				     const char *filename, int lineno)
+static void sensors_default_parse_error_wfn(const char *err,
+					    const char *filename, int lineno)
 {
 	/* If application provided a custom parse error reporting function
 	   but not the variant with the filename, fall back to the original
@@ -85,8 +73,15 @@ void sensors_default_parse_error_wfn(con
 		fprintf(stderr, "Error: File %s: %s\n", filename, err);
 }
 
-void sensors_default_fatal_error(const char *proc, const char *err)
+static void sensors_default_fatal_error(const char *proc, const char *err)
 {
 	fprintf(stderr, "Fatal error in `%s': %s\n", proc, err);
 	exit(1);
 }
+
+void (*sensors_parse_error) (const char *err, int lineno) +						sensors_default_parse_error;
+void (*sensors_parse_error_wfn) (const char *err, const char *filename,
+				 int lineno) = sensors_default_parse_error_wfn;
+void (*sensors_fatal_error) (const char *proc, const char *err) +						sensors_default_fatal_error;
Signature · 7 lines
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors