X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fpython.c;h=0dae99d8242f69804a2c2b3e1ffee2e96b132aa9;hb=0a8741b9061f8df4a78a448c021612db06e17425;hp=ec2317b3721d00149e68fdc1567f59340da2cf99;hpb=5523a080010dcb7a61dc0dccc3969a2a048e52f9;p=collectd.git diff --git a/src/python.c b/src/python.c index ec2317b3..0dae99d8 100644 --- a/src/python.c +++ b/src/python.c @@ -665,12 +665,11 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler, PyObjec c->data = data; c->next = NULL; - user_data_t user_data = { - .data = c, - .free_func = cpy_destroy_user_data - }; + register_function(buf, handler, &(user_data_t) { + .data = c, + .free_func = cpy_destroy_user_data, + }); - register_function(buf, handler, &user_data); ++cpy_num_callbacks; return cpy_string_to_unicode_or_bytes(buf); } @@ -704,13 +703,12 @@ static PyObject *cpy_register_read(PyObject *self, PyObject *args, PyObject *kwd c->data = data; c->next = NULL; - user_data_t user_data = { - .data = c, - .free_func = cpy_destroy_user_data - }; - plugin_register_complex_read(/* group = */ "python", buf, - cpy_read_callback, DOUBLE_TO_CDTIME_T (interval), &user_data); + cpy_read_callback, DOUBLE_TO_CDTIME_T (interval), + &(user_data_t) { + .data = c, + .free_func = cpy_destroy_user_data, + }); ++cpy_num_callbacks; return cpy_string_to_unicode_or_bytes(buf); } @@ -1022,7 +1020,8 @@ static int cpy_init(void) { ERROR("python: Unable to create pipe."); return 1; } - if (plugin_thread_create(&thread, NULL, cpy_interactive, pipefd + 1)) { + if (plugin_thread_create(&thread, NULL, cpy_interactive, pipefd + 1, + "python interpreter")) { ERROR("python: Error creating thread for interactive interpreter."); } if(read(pipefd[0], &buf, 1))