From 6d3f81d5da907d8e86120ff7a080b83f1a82f828 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 5 Nov 2009 09:23:46 +0000 Subject: [PATCH] "alarm" is a glibc function, don't use this identifier for our own variables to prevent any confusion. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5797 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensord/chips.c | 44 +++++++++++++++++++++--------------------- prog/sensord/sense.c | 14 +++++++------- prog/sensord/sensord.h | 2 +- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/CHANGES b/CHANGES index 2f4d517b..6de836ab 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ SVN-HEAD pwmconfig: Exit immediately if not root Save device paths and names in configuration file sensors.conf.default: Encourage user to not modify this file + sensord: Don't name our variables "alarm" sensors-detect: Refer to tmp401 driver if TMP411 is detected Clean up the discovery of i2c adapters Report unsupported Access Bus adapters diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 75262e1b..16670343 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -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[]) diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index 01b388bc..ed9b13b0 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -84,7 +84,7 @@ static int get_flag(const sensors_chip_name *chip, int num) static 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]; @@ -111,7 +111,7 @@ static int get_features(const sensors_chip_name *chip, strcat(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"); @@ -132,7 +132,7 @@ static int do_features(const sensors_chip_name *chip, const FeatureDescriptor *feature, int action) { char *label; - int alarm, beep; + int alrm, beep; label = sensors_get_label(chip, feature->feature); if (!label) { @@ -141,17 +141,17 @@ static int do_features(const sensors_chip_name *chip, return -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, diff --git a/prog/sensord/sensord.h b/prog/sensord/sensord.h index 64c68557..37ff251d 100644 --- a/prog/sensord/sensord.h +++ b/prog/sensord/sensord.h @@ -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[]);