projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
contrib/docker: add LD_PRELOAD wrapper to fopen/open/opendir syscalls
[collectd.git]
/
src
/
nut.c
diff --git
a/src/nut.c
b/src/nut.c
index
17eb1b9
..
29074c4
100644
(file)
--- a/
src/nut.c
+++ b/
src/nut.c
@@
-25,10
+25,10
@@
**/
#include "collectd.h"
**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "common.h"
#include "plugin.h"
-#include <pthread.h>
#include <upsclient.h>
#if HAVE_UPSCONN_T
#include <upsclient.h>
#if HAVE_UPSCONN_T
@@
-120,13
+120,10
@@
static int nut_config (const char *key, const char *value)
static void nut_submit (nut_ups_t *ups, const char *type,
const char *type_instance, gauge_t value)
{
static void nut_submit (nut_ups_t *ups, const char *type,
const char *type_instance, gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
- vl.values_len = STATIC_ARRAY_SIZE (values);
+ vl.values = &(value_t) { .gauge = value };
+ vl.values_len = 1;
sstrncpy (vl.host,
(strcasecmp (ups->hostname, "localhost") == 0)
? hostname_g
sstrncpy (vl.host,
(strcasecmp (ups->hostname, "localhost") == 0)
? hostname_g
@@
-248,7
+245,6
@@
static int nut_read_one (nut_ups_t *ups)
static int nut_read (void)
{
static int nut_read (void)
{
- nut_ups_t *ups;
int success = 0;
pthread_mutex_lock (&read_lock);
int success = 0;
pthread_mutex_lock (&read_lock);
@@
-259,7
+255,7
@@
static int nut_read (void)
if (success != 0)
return (0);
if (success != 0)
return (0);
- for (ups = upslist_head; ups != NULL; ups = ups->next)
+ for (
nut_ups_t *
ups = upslist_head; ups != NULL; ups = ups->next)
if (nut_read_one (ups) == 0)
success++;
if (nut_read_one (ups) == 0)
success++;