Treewide: cleanup whitespace
[collectd.git] / src / pyvalues.c
index 1097f7f..3c52ce5 100644 (file)
@@ -21,7 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  *
  * Authors:
- *   Sven Trenkel <collectd at semidefinite.de>  
+ *   Sven Trenkel <collectd at semidefinite.de>
  **/
 
 #include <Python.h>
@@ -45,7 +45,7 @@ static PyObject *cpy_common_repr(PyObject *s) {
        static PyObject *l_type = NULL, *l_type_instance = NULL, *l_plugin = NULL, *l_plugin_instance = NULL;
        static PyObject *l_host = NULL, *l_time = NULL;
        PluginData *self = (PluginData *) s;
-       
+
        if (l_type == NULL)
                l_type = cpy_string_to_unicode_or_bytes("(type=");
        if (l_type_instance == NULL)
@@ -58,10 +58,10 @@ static PyObject *cpy_common_repr(PyObject *s) {
                l_host = cpy_string_to_unicode_or_bytes(",host=");
        if (l_time == NULL)
                l_time = cpy_string_to_unicode_or_bytes(",time=");
-       
+
        if (!l_type || !l_type_instance || !l_plugin || !l_plugin_instance || !l_host || !l_time)
                return NULL;
-       
+
        ret = cpy_string_to_unicode_or_bytes(s->ob_type->tp_name);
 
        CPY_STRCAT(&ret, l_type);
@@ -134,11 +134,11 @@ static char PluginData_doc[] = "This is an internal class that is the base for V
 
 static PyObject *PluginData_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
        PluginData *self;
-       
+
        self = (PluginData *) type->tp_alloc(type, 0);
        if (self == NULL)
                return NULL;
-       
+
        self->time = 0;
        self->host[0] = 0;
        self->plugin[0] = 0;
@@ -154,11 +154,11 @@ static int PluginData_init(PyObject *s, PyObject *args, PyObject *kwds) {
        char *type = NULL, *plugin_instance = NULL, *type_instance = NULL, *plugin = NULL, *host = NULL;
        static char *kwlist[] = {"type", "plugin_instance", "type_instance",
                        "plugin", "host", "time", NULL};
-       
+
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etetetetetd", kwlist, NULL, &type,
                        NULL, &plugin_instance, NULL, &type_instance, NULL, &plugin, NULL, &host, &time))
                return -1;
-       
+
        if (type && plugin_get_ds(type) == NULL) {
                PyErr_Format(PyExc_TypeError, "Dataset %s not found", type);
                FreeAll();
@@ -180,13 +180,13 @@ static int PluginData_init(PyObject *s, PyObject *args, PyObject *kwds) {
 static PyObject *PluginData_repr(PyObject *s) {
        PyObject *ret;
        static PyObject *l_closing = NULL;
-       
+
        if (l_closing == NULL)
                l_closing = cpy_string_to_unicode_or_bytes(")");
-       
+
        if (l_closing == NULL)
                return NULL;
-       
+
        ret = cpy_common_repr(s);
        CPY_STRCAT(&ret, l_closing);
        return ret;
@@ -199,14 +199,14 @@ static PyMemberDef PluginData_members[] = {
 
 static PyObject *PluginData_getstring(PyObject *self, void *data) {
        const char *value = ((char *) self) + (intptr_t) data;
-       
+
        return cpy_string_to_unicode_or_bytes(value);
 }
 
 static int PluginData_setstring(PyObject *self, PyObject *value, void *data) {
        char *old;
        const char *new;
-       
+
        if (value == NULL) {
                PyErr_SetString(PyExc_TypeError, "Cannot delete this attribute");
                return -1;
@@ -226,7 +226,7 @@ static int PluginData_setstring(PyObject *self, PyObject *value, void *data) {
 static int PluginData_settype(PyObject *self, PyObject *value, void *data) {
        char *old;
        const char *new;
-       
+
        if (value == NULL) {
                PyErr_SetString(PyExc_TypeError, "Cannot delete this attribute");
                return -1;
@@ -349,11 +349,11 @@ static char Values_doc[] = "A Values object used for dispatching values to colle
 
 static PyObject *Values_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
        Values *self;
-       
+
        self = (Values *) PluginData_new(type, args, kwds);
        if (self == NULL)
                return NULL;
-       
+
        self->values = PyList_New(0);
        self->meta = PyDict_New();
        self->interval = 0;
@@ -367,12 +367,12 @@ static int Values_init(PyObject *s, PyObject *args, PyObject *kwds) {
        char *type = NULL, *plugin_instance = NULL, *type_instance = NULL, *plugin = NULL, *host = NULL;
        static char *kwlist[] = {"type", "values", "plugin_instance", "type_instance",
                        "plugin", "host", "time", "interval", "meta", NULL};
-       
+
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etOetetetetddO", kwlist,
                        NULL, &type, &values, NULL, &plugin_instance, NULL, &type_instance,
                        NULL, &plugin, NULL, &host, &time, &interval, &meta))
                return -1;
-       
+
        if (type && plugin_get_ds(type) == NULL) {
                PyErr_Format(PyExc_TypeError, "Dataset %s not found", type);
                FreeAll();
@@ -394,18 +394,18 @@ static int Values_init(PyObject *s, PyObject *args, PyObject *kwds) {
        } else {
                Py_INCREF(values);
        }
-       
+
        if (meta == NULL) {
                meta = PyDict_New();
                PyErr_Clear();
        } else {
                Py_INCREF(meta);
        }
-       
+
        tmp = self->values;
        self->values = values;
        Py_XDECREF(tmp);
-       
+
        tmp = self->meta;
        self->meta = meta;
        Py_XDECREF(tmp);
@@ -418,7 +418,7 @@ static meta_data_t *cpy_build_meta(PyObject *meta) {
        int i, s;
        meta_data_t *m = NULL;
        PyObject *l;
-       
+
        if ((meta == NULL) || (meta == Py_None))
                return NULL;
 
@@ -437,7 +437,7 @@ static meta_data_t *cpy_build_meta(PyObject *meta) {
        for (i = 0; i < s; ++i) {
                const char *string, *keystring;
                PyObject *key, *value, *item, *tmp;
-               
+
                item = PyList_GET_ITEM(l, i);
                key = PyTuple_GET_ITEM(item, 0);
                Py_INCREF(key);
@@ -510,7 +510,7 @@ static PyObject *Values_dispatch(Values *self, PyObject *args, PyObject *kwds) {
        PyObject *values = self->values, *meta = self->meta;
        double time = self->data.time, interval = self->interval;
        char *host = NULL, *plugin = NULL, *plugin_instance = NULL, *type = NULL, *type_instance = NULL;
-       
+
        static char *kwlist[] = {"type", "values", "plugin_instance", "type_instance",
                        "plugin", "host", "time", "interval", "meta", NULL};
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etOetetetetddO", kwlist,
@@ -619,7 +619,7 @@ static PyObject *Values_write(Values *self, PyObject *args, PyObject *kwds) {
        PyObject *values = self->values, *meta = self->meta;
        double time = self->data.time, interval = self->interval;
        char *host = NULL, *plugin = NULL, *plugin_instance = NULL, *type = NULL, *type_instance = NULL, *dest = NULL;
-       
+
        static char *kwlist[] = {"destination", "type", "values", "plugin_instance", "type_instance",
                        "plugin", "host", "time", "interval", "meta", NULL};
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|etOetetetetdiO", kwlist, NULL, &dest,
@@ -718,7 +718,7 @@ static PyObject *Values_repr(PyObject *s) {
        PyObject *ret, *tmp;
        static PyObject *l_interval = NULL, *l_values = NULL, *l_meta = NULL, *l_closing = NULL;
        Values *self = (Values *) s;
-       
+
        if (l_interval == NULL)
                l_interval = cpy_string_to_unicode_or_bytes(",interval=");
        if (l_values == NULL)
@@ -727,10 +727,10 @@ static PyObject *Values_repr(PyObject *s) {
                l_meta = cpy_string_to_unicode_or_bytes(",meta=");
        if (l_closing == NULL)
                l_closing = cpy_string_to_unicode_or_bytes(")");
-       
+
        if (l_interval == NULL || l_values == NULL || l_meta == NULL || l_closing == NULL)
                return NULL;
-       
+
        ret = cpy_common_repr(s);
        if (self->interval != 0) {
                CPY_STRCAT(&ret, l_interval);
@@ -844,12 +844,12 @@ static int Notification_init(PyObject *s, PyObject *args, PyObject *kwds) {
        char *type = NULL, *plugin_instance = NULL, *type_instance = NULL, *plugin = NULL, *host = NULL;
        static char *kwlist[] = {"type", "message", "plugin_instance", "type_instance",
                        "plugin", "host", "time", "severity", NULL};
-       
+
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etetetetetetdi", kwlist,
                        NULL, &type, NULL, &message, NULL, &plugin_instance, NULL, &type_instance,
                        NULL, &plugin, NULL, &host, &time, &severity))
                return -1;
-       
+
        if (type && plugin_get_ds(type) == NULL) {
                PyErr_Format(PyExc_TypeError, "Dataset %s not found", type);
                FreeAll();
@@ -879,7 +879,7 @@ static PyObject *Notification_dispatch(Notification *self, PyObject *args, PyObj
        int severity = self->severity;
        char *host = NULL, *plugin = NULL, *plugin_instance = NULL, *type = NULL, *type_instance = NULL;
        char *message = NULL;
-       
+
        static char *kwlist[] = {"type", "message", "plugin_instance", "type_instance",
                        "plugin", "host", "time", "severity", NULL};
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etetetetetetdi", kwlist,
@@ -927,11 +927,11 @@ static PyObject *Notification_dispatch(Notification *self, PyObject *args, PyObj
 
 static PyObject *Notification_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
        Notification *self;
-       
+
        self = (Notification *) PluginData_new(type, args, kwds);
        if (self == NULL)
                return NULL;
-       
+
        self->message[0] = 0;
        self->severity = 0;
        return (PyObject *) self;
@@ -940,7 +940,7 @@ static PyObject *Notification_new(PyTypeObject *type, PyObject *args, PyObject *
 static int Notification_setstring(PyObject *self, PyObject *value, void *data) {
        char *old;
        const char *new;
-       
+
        if (value == NULL) {
                PyErr_SetString(PyExc_TypeError, "Cannot delete this attribute");
                return -1;
@@ -961,17 +961,17 @@ static PyObject *Notification_repr(PyObject *s) {
        PyObject *ret, *tmp;
        static PyObject *l_severity = NULL, *l_message = NULL, *l_closing = NULL;
        Notification *self = (Notification *) s;
-       
+
        if (l_severity == NULL)
                l_severity = cpy_string_to_unicode_or_bytes(",severity=");
        if (l_message == NULL)
                l_message = cpy_string_to_unicode_or_bytes(",message=");
        if (l_closing == NULL)
                l_closing = cpy_string_to_unicode_or_bytes(")");
-       
+
        if (l_severity == NULL || l_message == NULL || l_closing == NULL)
                return NULL;
-       
+
        ret = cpy_common_repr(s);
        if (self->severity != 0) {
                CPY_STRCAT(&ret, l_severity);