X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Firq.c;h=aa6ac04b0ba229bd4108e439501aaf29c0f8c1ab;hp=ea29261e30dfd308ec7c2c3c4b404f251dabbdc0;hb=06a86a60a7dabc685bdbd81ce3d36ea5f7e2c2d4;hpb=2079ee1517e34de372f58e7e2267ad5c71a8a41f diff --git a/src/irq.c b/src/irq.c index ea29261e..aa6ac04b 100644 --- a/src/irq.c +++ b/src/irq.c @@ -37,7 +37,7 @@ static const char *config_keys[] = {"Irq", "IgnoreSelected"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static ignorelist_t *ignorelist = NULL; +static ignorelist_t *ignorelist; /* * Private functions @@ -54,24 +54,20 @@ static int irq_config(const char *key, const char *value) { invert = 0; ignorelist_set_invert(ignorelist, invert); } else { - return (-1); + return -1; } - return (0); + return 0; } static void irq_submit(const char *irq_name, derive_t value) { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; if (ignorelist_match(ignorelist, irq_name) != 0) return; - values[0].derive = value; - - vl.values = values; + vl.values = &(value_t){.derive = value}; vl.values_len = 1; - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, "irq", sizeof(vl.plugin)); sstrncpy(vl.type, "irq", sizeof(vl.type)); sstrncpy(vl.type_instance, irq_name, sizeof(vl.type_instance)); @@ -94,10 +90,8 @@ static int irq_read(void) { */ fh = fopen("/proc/interrupts", "r"); if (fh == NULL) { - char errbuf[1024]; - ERROR("irq plugin: fopen (/proc/interrupts): %s", - sstrerror(errno, errbuf, sizeof(errbuf))); - return (-1); + ERROR("irq plugin: fopen (/proc/interrupts): %s", STRERRNO); + return -1; } /* Get CPU count from the first line */ @@ -107,7 +101,7 @@ static int irq_read(void) { ERROR("irq plugin: unable to get CPU count from first line " "of /proc/interrupts"); fclose(fh); - return (-1); + return -1; } while (fgets(buffer, sizeof(buffer), fh) != NULL) { @@ -169,7 +163,7 @@ static int irq_read(void) { fclose(fh); - return (0); + return 0; } /* int irq_read */ void module_register(void) {