From: Florian Forster Date: Sat, 11 May 2013 07:40:05 +0000 (+0200) Subject: mic plugin: Remove the NUM_THERMS define. X-Git-Tag: collectd-5.4.0~42^2~11 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e1f9a8285e12663764f7b74e21a394eb04613dc6;p=collectd.git mic plugin: Remove the NUM_THERMS define. Also some coding style changes: Limit line length, move temporary variables to an innter scope, print the temperature name in an error message (rather than its ID). --- diff --git a/src/mic.c b/src/mic.c index 80a85c59..566b2166 100644 --- a/src/mic.c +++ b/src/mic.c @@ -35,9 +35,13 @@ static MicDeviceOnSystem mics[MAX_MICS]; static U32 num_mics = 0; static HANDLE mic_handle = NULL; -#define NUM_THERMS 7 -static const int therms[NUM_THERMS] = {eMicThermalDie,eMicThermalDevMem,eMicThermalFin,eMicThermalFout,eMicThermalVccp,eMicThermalVddg,eMicThermalVddq}; -static const char *therm_names[NUM_THERMS] = {"die","devmem","fin","fout","vccp","vddg","vddq"}; + +static int const therm_ids[] = { + eMicThermalDie, eMicThermalDevMem, eMicThermalFin, eMicThermalFout, + eMicThermalVccp, eMicThermalVddg, eMicThermalVddq }; +static char const * const therm_names[] = { + "die", "devmem", "fin", "fout", + "vccp", "vddg", "vddq" }; static const char *config_keys[] = { @@ -183,20 +187,26 @@ static void mic_submit_temp(int micnumber, const char *type, gauge_t val) /* Gather Temperature Information */ static int mic_read_temps(int mic) { - int j; - U32 ret; - U32 temp_buffer; - U32 buffer_size = (U32)sizeof(temp_buffer); + size_t num_therms = STATIC_ARRAY_SIZE(therm_ids); + size_t j; - for (j=0;j