sensord: Don't name our variables "alarm"
PATCH 1/1 sensord: Don't name our variables "alarm"
"alarm" is a glibc function, don't use this identifier for our own variables to prevent any confusion.
--- prog/sensord/chips.c | 44 ++++++++++++++++++++++---------------------- prog/sensord/sense.c | 14 +++++++------- prog/sensord/sensord.h | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-)
prog/sensord/chips.c +22 -22
@@ -33,78 +33,78 @@static char buff[4096 ]; -static const char *fmtExtra (int alarm,int beep) +static const char *fmtExtra (int alrm,int beep) { -if (alarm) +if (alrm)sprintf (buff +strlen (buff)," [ALARM]" );if (beep)sprintf (buff +strlen (buff)," (beep)" );return buff; } -static const char *fmtTemps_1 (const double values[],int alarm,int beep) +static const char *fmtTemps_1 (const double values[],int alrm,int beep) {sprintf (buff,"%.1f C (limit = %.1f C, hysteresis = %.1f C)" , values[0 ], values[1 ], values[2 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtTemps_minmax_1 (const double values[],int alarm, +static const char *fmtTemps_minmax_1 (const double values[],int alrm,int beep) {sprintf (buff,"%.1f C (min = %.1f C, max = %.1f C)" , values[0 ], values[1 ], values[2 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtTemp_only (const double values[],int alarm,int beep) +static const char *fmtTemp_only (const double values[],int alrm,int beep) {sprintf (buff,"%.1f C" , values[0 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtVolt_2 (const double values[],int alarm,int beep) +static const char *fmtVolt_2 (const double values[],int alrm,int beep) {sprintf (buff,"%+.2f V" , values[0 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtVolt_3 (const double values[],int alarm,int beep) +static const char *fmtVolt_3 (const double values[],int alrm,int beep) {sprintf (buff,"%+.3f V" , values[0 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtVolts_2 (const double values[],int alarm,int beep) +static const char *fmtVolts_2 (const double values[],int alrm,int beep) {sprintf (buff,"%+.2f V (min = %+.2f V, max = %+.2f V)" , values[0 ], values[1 ], values[2 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtFans_0 (const double values[],int alarm,int beep) +static const char *fmtFans_0 (const double values[],int alrm,int beep) {sprintf (buff,"%.0f RPM (min = %.0f RPM, div = %.0f)" , values[0 ], values[1 ], values[2 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtFans_nodiv_0 (const double values[],int alarm,int beep) +static const char *fmtFans_nodiv_0 (const double values[],int alrm,int beep) {sprintf (buff,"%.0f RPM (min = %.0f RPM)" , values[0 ], values[1 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtFan_only (const double values[],int alarm,int beep) +static const char *fmtFan_only (const double values[],int alrm,int beep) {sprintf (buff,"%.0f RPM" , values[0 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtSoundAlarm (const double values[],int alarm,int beep) +static const char *fmtSoundAlarm (const double values[],int alrm,int beep) {sprintf (buff,"Sound alarm %s" , (values[0 ] <0.5 ) ?"disabled" :"enabled" ); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); }static const char *rrdF0 (const double values[])
prog/sensord/sense.c +7 -7
@@ -86,7 +86,7 @@ static int get_flag(const sensors_chip_nstatic int get_features (const sensors_chip_name *chip,const FeatureDescriptor *feature,int action, -char *label,int alarm,int beep) +char *label,int alrm,int beep) {int i, ret;double val[MAX_DATA ];
@@ -113,7 +113,7 @@ static int get_features(const sensors_chstrcat (strcat (rrdBuff,":" ), rrded ? rrded :"U" ); } }else { -const char *formatted = feature->format (val, alarm, beep); +const char *formatted = feature->format (val, alrm, beep);if (!formatted) {sensorLog (LOG_ERR ,"Error formatting sensor data" );
@@ -134,7 +134,7 @@ static int do_features(const sensors_chi const FeatureDescriptor *feature, int action) { char *label; -int alarm, beep; +int alrm, beep; label =sensors_get_label (chip, feature->feature);if (!label) {
@@ -143,17 +143,17 @@ static int do_features(const sensors_chireturn -1 ; } - alarm =get_flag (chip, feature->alarmNumber); -if (alarm =-1 ) + alrm =get_flag (chip, feature->alarmNumber); +if (alrm =-1 )return -1 ; -else if (action =DO_SCAN && !alarm) +else if (action =DO_SCAN && !alrm)return 0 ; beep =get_flag (chip, feature->beepNumber);if (beep =-1 )return -1 ; -return get_features (chip, feature, action, label, alarm, beep); +return get_features (chip, feature, action, label, alrm, beep); } static int doKnownChip(const sensors_chip_name *chip,
prog/sensord/sensord.h +1 -1
@@ -57,7 +57,7 @@ extern int rrdCGI(void);#define MAX_DATA 5 -typedef const char *(*FormatterFN ) (const double values[],int alarm, +typedef const char *(*FormatterFN ) (const double values[],int alrm,int beep);typedef const char *(*RRDFN ) (const double values[]);
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 2 lines · Jean Delvare
"alarm" is a glibc function, don't use this identifier for our own variables to prevent any confusion.
Looks good. I see you made this patch on the top of my patch series. Patch applies without conflicts.
Regards,
Andre
Quoted 180 lines
--- prog/sensord/chips.c | 44 ++++++++++++++++++++++---------------------- prog/sensord/sense.c | 14 +++++++------- prog/sensord/sensord.h | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-)prog/sensord/chips.c +22
-22@@ -33,78 +33,78 @@static char buff[4096 ]; -static const char *fmtExtra (int alarm,int beep) +static const char *fmtExtra (int alrm,int beep) { -if (alarm) +if (alrm)sprintf (buff +strlen (buff)," [ALARM]" );if (beep)sprintf (buff +strlen (buff)," (beep)" );return buff; } -static const char *fmtTemps_1 (const double values[],int alarm,int beep) +static const char *fmtTemps_1 (const double values[],int alrm,int beep) {sprintf (buff,"%.1f C (limit = %.1f C, hysteresis = %.1f C)" , values[0 ], values[1 ], values[2 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtTemps_minmax_1 (const double values[],int alarm, +static const char *fmtTemps_minmax_1 (const double values[],int alrm,int beep) {sprintf (buff,"%.1f C (min = %.1f C, max = %.1f C)" , values[0 ], values[1 ], values[2 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtTemp_only (const double values[],int alarm,int beep) +static const char *fmtTemp_only (const double values[],int alrm,int beep) {sprintf (buff,"%.1f C" , values[0 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtVolt_2 (const double values[],int alarm,int beep) +static const char *fmtVolt_2 (const double values[],int alrm,int beep) {sprintf (buff,"%+.2f V" , values[0 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtVolt_3 (const double values[],int alarm,int beep) +static const char *fmtVolt_3 (const double values[],int alrm,int beep) {sprintf (buff,"%+.3f V" , values[0 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtVolts_2 (const double values[],int alarm,int beep) +static const char *fmtVolts_2 (const double values[],int alrm,int beep) {sprintf (buff,"%+.2f V (min = %+.2f V, max = %+.2f V)" , values[0 ], values[1 ], values[2 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtFans_0 (const double values[],int alarm,int beep) +static const char *fmtFans_0 (const double values[],int alrm,int beep) {sprintf (buff,"%.0f RPM (min = %.0f RPM, div = %.0f)" , values[0 ], values[1 ], values[2 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtFans_nodiv_0 (const double values[],int alarm,int beep) +static const char *fmtFans_nodiv_0 (const double values[],int alrm,int beep) {sprintf (buff,"%.0f RPM (min = %.0f RPM)" , values[0 ], values[1 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtFan_only (const double values[],int alarm,int beep) +static const char *fmtFan_only (const double values[],int alrm,int beep) {sprintf (buff,"%.0f RPM" , values[0 ]); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); } -static const char *fmtSoundAlarm (const double values[],int alarm,int beep) +static const char *fmtSoundAlarm (const double values[],int alrm,int beep) {sprintf (buff,"Sound alarm %s" , (values[0 ] <0.5 ) ?"disabled" :"enabled" ); -return fmtExtra (alarm, beep); +return fmtExtra (alrm, beep); }static const char *rrdF0 (const double values[])prog/sensord/sense.c +7
-7@@ -86,7 +86,7 @@ static int get_flag(const sensors_chip_nstatic int get_features (const sensors_chip_name *chip,const FeatureDescriptor *feature,int action, -char *label,int alarm,int beep) +char *label,int alrm,int beep) {int i, ret;double val[MAX_DATA ];@@ -113,7 +113,7 @@ static int get_features(const sensors_chstrcat (strcat (rrdBuff,":" ), rrded ? rrded :"U" ); } }else { -const char *formatted = feature->format (val, alarm, beep); +const char *formatted = feature->format (val, alrm, beep);if (!formatted) {sensorLog (LOG_ERR ,"Error formatting sensor data" );@@ -134,7 +134,7 @@ static int do_features(const sensors_chi const FeatureDescriptor *feature, int action) { char *label; -int alarm, beep; +int alrm, beep; label =sensors_get_label (chip, feature->feature);if (!label) {@@ -143,17 +143,17 @@ static int do_features(const sensors_chireturn -1 ; } - alarm =get_flag (chip, feature->alarmNumber); -if (alarm =-1 ) + alrm =get_flag (chip, feature->alarmNumber); +if (alrm =-1 )return -1 ; -else if (action =DO_SCAN && !alarm) +else if (action =DO_SCAN && !alrm)return 0 ; beep =get_flag (chip, feature->beepNumber);if (beep =-1 )return -1 ; -return get_features (chip, feature, action, label, alarm, beep); +return get_features (chip, feature, action, label, alrm, beep); } static int doKnownChip(const sensors_chip_name *chip,prog/sensord/sensord.h +1
-1@@ -57,7 +57,7 @@ extern int rrdCGI(void);#define MAX_DATA 5 -typedef const char *(*FormatterFN ) (const double values[],int alarm, +typedef const char *(*FormatterFN ) (const double values[],int alrm,int beep);typedef const char *(*RRDFN ) (const double values[]);Signature · 7 lines
-- Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 6 lines · Andre Prendel
Quoted 2 lines · Jean Delvare
"alarm" is a glibc function, don't use this identifier for our own variables to prevent any confusion.
Looks good. I see you made this patch on the top of my patch series. Patch applies without conflicts.
Thanks for the review. Patch committed.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors