X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fpython.c;h=3a282918c6eafe6ae32b3de7109fff388edf1075;hb=610204218564e01513607a0f077c33145f2b41f7;hp=1ed6dc0165b0c5477b55d7c05f2f77eba8a8c261;hpb=aef15b632b9f415e5ebfadd4e41fa8a3c19407ee;p=collectd.git diff --git a/src/python.c b/src/python.c index 1ed6dc01..3a282918 100644 --- a/src/python.c +++ b/src/python.c @@ -28,9 +28,6 @@ #include #include -#if HAVE_PTHREAD_H -# include -#endif #include "collectd.h" #include "common.h" @@ -626,7 +623,7 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler, PyObjec 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}; @@ -652,7 +649,6 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler, PyObjec 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; @@ -663,7 +659,7 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler, PyObjec 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; @@ -690,7 +686,6 @@ static PyObject *cpy_register_read(PyObject *self, PyObject *args, PyObject *kwd 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; @@ -923,7 +918,7 @@ static void cpy_int_handler(int sig) { 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 @@ -941,8 +936,9 @@ static void *cpy_interactive(void *data) { * 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);