summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2015-05-15 11:24:28 +0000
committerkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2015-05-15 11:24:28 +0000
commit060ae3b6b2fcc3d3f1afe22ef97c6d80ede90fac (patch)
tree52748a492863f353dd99d4f621c38f718c50eac2
parentd9983967a89382f64c65db67026f85f073ef9b74 (diff)
downloadlm-sensors-060ae3b6b2fcc3d3f1afe22ef97c6d80ede90fac.tar.gz
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. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6280 7894878c-1315-0410-8ee3-d5d059ff63e0
-rw-r--r--CHANGES1
-rw-r--r--lib/access.c6
-rw-r--r--lib/error.c27
3 files changed, 15 insertions, 19 deletions
diff --git a/CHANGES b/CHANGES
index a5eb974b..be22247a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,7 @@ SVN HEAD
sensors.conf.default: Add support for NCT6779 and NCT6791
libsensors: Get rid of arbitrary limit on per-type sensor count
Add support for temperature min and critical min hysteresis
+ Fix sparse warnings
sensors: Add support for temperature min and critical min hysteresis
fancontrol: Deal with moving hwmon attributes
Fix shell error when FCFANS is not set
diff --git a/lib/access.c b/lib/access.c
index 94db6e3e..2adeed44 100644
--- a/lib/access.c
+++ b/lib/access.c
@@ -435,9 +435,9 @@ sensors_get_subfeature(const sensors_chip_name *name,
}
/* 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;
diff --git a/lib/error.c b/lib/error.c
index 5df7eccf..4c651c28 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -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 char *err, int lineno)
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(const char *err,
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;