#include <structmember.h>
#include <signal.h>
-#if HAVE_PTHREAD_H
-# include <pthread.h>
-#endif
#include "collectd.h"
#include "common.h"
char buf[512];
reg_function_t *register_function = (reg_function_t *) reg;
cpy_callback_t *c = NULL;
- user_data_t user_data;
+ user_data_t user_data = { 0 };
char *name = NULL;
PyObject *callback = NULL, *data = NULL;
static char *kwlist[] = {"callback", "data", "name", NULL};
c->data = data;
c->next = NULL;
- memset (&user_data, 0, sizeof (user_data));
user_data.free_func = cpy_destroy_user_data;
user_data.data = c;
static PyObject *cpy_register_read(PyObject *self, PyObject *args, PyObject *kwds) {
char buf[512];
cpy_callback_t *c = NULL;
- user_data_t user_data;
+ user_data_t user_data = { 0 };
double interval = 0;
char *name = NULL;
PyObject *callback = NULL, *data = NULL;
c->data = data;
c->next = NULL;
- memset (&user_data, 0, sizeof (user_data));
user_data.free_func = cpy_destroy_user_data;
user_data.data = c;
static void *cpy_interactive(void *data) {
sigset_t sigset;
- struct sigaction sig_int_action, old;
+ struct sigaction old;
/* Signal handler in a plugin? Bad stuff, but the best way to
* handle it I guess. In an interactive session people will
* still interrupt syscalls like sleep and pause.
* It does not raise a KeyboardInterrupt exception because so
* far nobody managed to figure out how to do that. */
- memset (&sig_int_action, '\0', sizeof (sig_int_action));
- sig_int_action.sa_handler = cpy_int_handler;
+ struct sigaction sig_int_action = {
+ .sa_handler = cpy_int_handler
+ };
sigaction (SIGINT, &sig_int_action, &old);
sigemptyset(&sigset);