+/**
+ * collectd - src/python.c
+ * Copyright (C) 2009 Sven Trenkel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Sven Trenkel <collectd at semidefinite.de>
+ **/
+
#include <Python.h>
#include <structmember.h>
CPY_RETURN_FROM_THREADS 0;
}
}
- v = PyObject_CallFunction((PyObject *) &ValuesType, "sOssssdi", value_list->type, list,
+ v = PyObject_CallFunction((void *) &ValuesType, "sOssssdi", value_list->type, list,
value_list->plugin_instance, value_list->type_instance, value_list->plugin,
value_list->host, (double) value_list->time, value_list->interval);
Py_DECREF(list);
PyObject *ret, *n;
CPY_LOCK_THREADS
- n = PyObject_CallFunction((PyObject *) &NotificationType, "ssssssdi", notification->type, notification->message,
+ n = PyObject_CallFunction((void *) &NotificationType, "ssssssdi", notification->type, notification->message,
notification->plugin_instance, notification->type_instance, notification->plugin,
notification->host, (double) notification->time, notification->severity);
ret = PyObject_CallFunctionObjArgs(c->callback, n, c->data, (void *) 0); /* New reference. */
}
static PyObject *cpy_register_log(PyObject *self, PyObject *args, PyObject *kwds) {
- return cpy_register_generic_userdata(plugin_register_log, cpy_log_callback, args, kwds);
+ return cpy_register_generic_userdata((void *) plugin_register_log,
+ (void *) cpy_log_callback, args, kwds);
}
static PyObject *cpy_register_write(PyObject *self, PyObject *args, PyObject *kwds) {
- return cpy_register_generic_userdata(plugin_register_write, cpy_write_callback, args, kwds);
+ return cpy_register_generic_userdata((void *) plugin_register_write,
+ (void *) cpy_write_callback, args, kwds);
}
static PyObject *cpy_register_notification(PyObject *self, PyObject *args, PyObject *kwds) {
- return cpy_register_generic_userdata(plugin_register_notification, cpy_notification_callback, args, kwds);
+ return cpy_register_generic_userdata((void *) plugin_register_notification,
+ (void *) cpy_notification_callback, args, kwds);
}
static PyObject *cpy_register_flush(PyObject *self, PyObject *args, PyObject *kwds) {
- return cpy_register_generic_userdata(plugin_register_flush, cpy_flush_callback, args, kwds);
+ return cpy_register_generic_userdata((void *) plugin_register_flush,
+ (void *) cpy_flush_callback, args, kwds);
}
static PyObject *cpy_register_shutdown(PyObject *self, PyObject *args, PyObject *kwds) {
}
}
- item = PyObject_CallFunction((PyObject *) &ConfigType, "sONO", ci->key, parent, values, Py_None);
+ item = PyObject_CallFunction((void *) &ConfigType, "sONO", ci->key, parent, values, Py_None);
if (item == NULL)
return NULL;
children = PyTuple_New(ci->children_num); /* New reference. */
return 1;
}
module = Py_InitModule("collectd", cpy_methods); /* Borrowed reference. */
- PyModule_AddObject(module, "Config", (PyObject *) &ConfigType); /* Steals a reference. */
- PyModule_AddObject(module, "Values", (PyObject *) &ValuesType); /* Steals a reference. */
- PyModule_AddObject(module, "Notification", (PyObject *) &NotificationType); /* Steals a reference. */
+ PyModule_AddObject(module, "Config", (void *) &ConfigType); /* Steals a reference. */
+ PyModule_AddObject(module, "Values", (void *) &ValuesType); /* Steals a reference. */
+ PyModule_AddObject(module, "Notification", (void *) &NotificationType); /* Steals a reference. */
PyModule_AddIntConstant(module, "LOG_DEBUG", LOG_DEBUG);
PyModule_AddIntConstant(module, "LOG_INFO", LOG_INFO);
PyModule_AddIntConstant(module, "LOG_NOTICE", LOG_NOTICE);