2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-01 06:45:24 +00:00

Mass reindent, coding style and whitespace cleanups.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4736 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2007-08-31 14:42:20 +00:00
parent 02dc2e6679
commit a82c6b0476
14 changed files with 249 additions and 243 deletions

View File

@@ -26,7 +26,7 @@
/* Look up a resource in the intern chip list, and return a pointer to it.
Do not modify the struct the return value points to! Returns NULL if
not found. */
extern const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip,
const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip,
int feature);
/* Check whether the chip name is an 'absolute' name, which can only match

View File

@@ -21,12 +21,12 @@
#define LIB_SENSORS_CONF_H
/* This is defined in conf-lex.l */
extern int sensors_yylex(void);
int sensors_yylex(void);
extern char sensors_lex_error[];
extern int sensors_yylineno;
extern FILE *sensors_yyin;
/* This is defined in conf-parse.y */
extern int sensors_yyparse(void);
int sensors_yyparse(void);
#endif /* LIB_SENSORS_CONF_H */

View File

@@ -29,12 +29,14 @@
/* Kinds of expression operators recognized */
typedef enum sensors_operation {
sensors_add, sensors_sub, sensors_multiply, sensors_divide,
sensors_negate, sensors_exp, sensors_log } sensors_operation;
sensors_negate, sensors_exp, sensors_log,
} sensors_operation;
/* An expression can have several forms */
typedef enum sensors_expr_kind {
sensors_kind_val, sensors_kind_source, sensors_kind_var,
sensors_kind_sub } sensors_expr_kind;
sensors_kind_sub
} sensors_expr_kind;
/* An expression. It is either a floating point value, a variable name,
an operation on subexpressions, or the special value 'sub' } */

View File

@@ -30,8 +30,8 @@ void (*sensors_parse_error) (const char *err, int lineno) =
void (*sensors_fatal_error) (const char *proc, const char *err) =
sensors_default_fatal_error;
static const char *errorlist[] =
{ /* Unknown error */ "sensors_strerror: Unknown error!",
static const char *errorlist[] = {
/* Unknown error */ "sensors_strerror: Unknown error!",
/* SENSORS_ERR_WILDCARDS */ "Wildcard found in chip name",
/* SENSORS_ERR_NO_ENTRY */ "No such feature known",
/* SENSORS_ERR_ACCESS */ "Can't read or write",
@@ -41,7 +41,7 @@ static const char *errorlist[] =
/* SENSORS_ERR_BUS_NAME */ "Can't parse bus name",
/* SENSORS_ERR_PARSE */ "General parse error",
/* SENSORS_ERR_ACCESS_W */ "Can't write",
/* SENSORS_ERR_ACCESS_R */ "Can't read"
/* SENSORS_ERR_ACCESS_R */ "Can't read",
};
const char *sensors_strerror(int errnum)

View File

@@ -39,7 +39,7 @@ extern "C" {
/* This function returns a pointer to a string which describes the error.
errnum may be negative (the corresponding positive error is returned).
You may not modify the result! */
extern const char *sensors_strerror(int errnum);
const char *sensors_strerror(int errnum);
/* This function is called when a parse error is detected. Give it a new
value, and your own function is called instead of the default (which

View File

@@ -33,7 +33,8 @@ void sensors_malloc_array(void *list, int *num_el, int *max_el, int el_size)
*my_list = malloc(el_size*A_BUNCH);
if (! *my_list)
sensors_fatal_error("sensors_malloc_array","Allocating new elements");
sensors_fatal_error("sensors_malloc_array",
"Allocating new elements");
*max_el = A_BUNCH;
*num_el = 0;
}
@@ -57,7 +58,8 @@ void sensors_add_array_el(const void *el, void *list, int *num_el,
new_max_el = *max_el + A_BUNCH;
*my_list = realloc(*my_list, new_max_el * el_size);
if (! *my_list)
sensors_fatal_error("sensors_add_array_el","Allocating new elements");
sensors_fatal_error("sensors_add_array_el",
"Allocating new elements");
*max_el = new_max_el;
}
memcpy(((char *) *my_list) + *num_el * el_size, el, el_size);
@@ -74,7 +76,8 @@ void sensors_add_array_els(const void *els, int nr_els, void *list,
new_max_el -= new_max_el % A_BUNCH;
*my_list = realloc(*my_list, new_max_el * el_size);
if (! *my_list)
sensors_fatal_error("sensors_add_array_els","Allocating new elements");
sensors_fatal_error("sensors_add_array_els",
"Allocating new elements");
*max_el = new_max_el;
}
memcpy(((char *)*my_list) + *num_el * el_size, els, el_size * nr_els);
@@ -85,6 +88,6 @@ void sensors_add_array_els(const void *els, int nr_els, void *list,
void sensors_strip_of_spaces(char *name)
{
int i;
for (i = strlen(name)-1; (i>=0) && (name[i] == ' '); i--);
for (i = strlen(name) - 1; i >= 0 && name[i] == ' '; i--);
name[i + 1] = '\0';
}

View File

@@ -25,16 +25,16 @@
made between the current number of elements and the maximum number.
You can only add elements at the end. Primitive, but very useful
for internal use. */
extern void sensors_malloc_array(void *list, int *num_el, int *max_el,
void sensors_malloc_array(void *list, int *num_el, int *max_el,
int el_size);
extern void sensors_free_array(void *list, int *num_el, int *max_el);
extern void sensors_add_array_el(const void *el, void *list, int *num_el,
void sensors_free_array(void *list, int *num_el, int *max_el);
void sensors_add_array_el(const void *el, void *list, int *num_el,
int *max_el, int el_size);
extern void sensors_add_array_els(const void *els, int nr_els, void *list,
void sensors_add_array_els(const void *els, int nr_els, void *list,
int *num_el, int *max_el, int el_size);
/* Strip a string of all terminating spaces */
extern void sensors_strip_of_spaces(char *name);
void sensors_strip_of_spaces(char *name);
#define ARRAY_SIZE(arr) (int)(sizeof(arr) / sizeof((arr)[0]))

View File

@@ -43,7 +43,8 @@ int sensors_init(FILE *input)
if (!sensors_init_sysfs())
return -SENSORS_ERR_PROC;
if ((res = sensors_read_sysfs_bus()) || (res = sensors_read_sysfs_chips()))
if ((res = sensors_read_sysfs_bus()) ||
(res = sensors_read_sysfs_chips()))
return res;
if ((res = sensors_scanner_init(input)))
return -SENSORS_ERR_PARSE;

View File

@@ -20,8 +20,8 @@
#ifndef LIB_SENSORS_SCANNER_H
#define LIB_SENSORS_SCANNER_H
extern int sensors_scanner_init(FILE *input);
extern void sensors_scanner_exit(void);
int sensors_scanner_init(FILE *input);
void sensors_scanner_exit(void);
#endif

View File

@@ -22,11 +22,11 @@
extern char sensors_sysfs_mount[];
extern int sensors_init_sysfs(void);
int sensors_init_sysfs(void);
extern int sensors_read_sysfs_chips(void);
int sensors_read_sysfs_chips(void);
extern int sensors_read_sysfs_bus(void);
int sensors_read_sysfs_bus(void);
/* Read a value out of a sysfs attribute file */
int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature,