mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-30 13:00:30 +00:00
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.
This commit is contained in:
1 parent
aaf34b0de8
commit
b200f794b3
3 files changed
+15
-19
No files matched your search
@@ -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
|
||||
|
||||
+3
-3
@@ -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;
|
||||
|
||||
+11
-16
@@ -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;
|
||||
Reference in new issue
Block a user