From 6504401cf84ca826b3634db095f54033e76909b8 Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Sun, 18 Sep 2005 18:30:16 +0000 Subject: [PATCH] (mmh) This patch moves two macros from lib/proc.c to lib/data.h. The macros pick up the "sensors_" prefix along the way. The motivation is the same as the previous patch. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3091 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/data.h | 8 ++++++++ lib/proc.c | 20 ++++---------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/lib/data.h b/lib/data.h index fc8c6b06..1f75ff9b 100644 --- a/lib/data.h +++ b/lib/data.h @@ -182,10 +182,18 @@ extern sensors_proc_chips_entry *sensors_proc_chips; extern int sensors_proc_chips_count; extern int sensors_proc_chips_max; +#define sensors_add_proc_chips(el) sensors_add_array_el( \ + (el), &sensors_proc_chips, &sensors_proc_chips_count,\ + &sensors_proc_chips_max, sizeof(struct sensors_proc_chips_entry)) + extern sensors_bus *sensors_proc_bus; extern int sensors_proc_bus_count; extern int sensors_proc_bus_max; +#define sensors_add_proc_bus(el) sensors_add_array_el( \ + (el), &sensors_proc_bus, &sensors_proc_bus_count,\ + &sensors_proc_bus_max, sizeof(struct sensors_bus)) + extern sensors_chip_features sensors_chip_features_list[]; #endif /* def LIB_SENSORS_DATA_H */ diff --git a/lib/proc.c b/lib/proc.c index 898ab2d0..8009ade4 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -45,18 +45,6 @@ static int sensors_get_chip_id(sensors_chip_name name); int foundsysfs=0; char sysfsmount[NAME_MAX]; -#define add_proc_chips(el) sensors_add_array_el(el,\ - &sensors_proc_chips,\ - &sensors_proc_chips_count,\ - &sensors_proc_chips_max,\ - sizeof(struct sensors_proc_chips_entry)) - -#define add_proc_bus(el) sensors_add_array_el(el,\ - &sensors_proc_bus,\ - &sensors_proc_bus_count,\ - &sensors_proc_bus_max,\ - sizeof(struct sensors_bus)) - static int getsysname(const sensors_chip_feature *feature, char *sysname, int *sysmag, char *altsysname); @@ -105,7 +93,7 @@ static int sensors_read_one_sysfs_chip(char *name, char *dirname, char *id) fclose(f); } - add_proc_chips(&entry); + sensors_add_proc_chips(&entry); return 1; } @@ -234,7 +222,7 @@ proc: return res; } entry.sysctl = ((struct i2c_chips_data *) bufptr)->sysctl_id; - add_proc_chips(&entry); + sensors_add_proc_chips(&entry); bufptr += sizeof(struct i2c_chips_data); buflen -= sizeof(struct i2c_chips_data); lineno++; @@ -291,7 +279,7 @@ int sensors_read_proc_bus(void) entry.algorithm = strdup("Unavailable from sysfs"); if (entry.algorithm == NULL) goto FAT_ERROR_SYS; - add_proc_bus(&entry); + sensors_add_proc_bus(&entry); } } closedir(dir); @@ -330,7 +318,7 @@ proc: goto ERROR; sensors_strip_of_spaces(entry.algorithm); sensors_strip_of_spaces(entry.adapter); - add_proc_bus(&entry); + sensors_add_proc_bus(&entry); lineno++; } fclose(f);