From 48b9d4757f2c8875646d65f8c4f31083e252c1a5 Mon Sep 17 00:00:00 2001 From: oetiker Date: Thu, 5 Jun 2008 19:57:25 +0000 Subject: [PATCH] fixed indenting git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1398 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/bindings/python/rrdtoolmodule.c | 30 ++++++++++++++----------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/program/bindings/python/rrdtoolmodule.c b/program/bindings/python/rrdtoolmodule.c index 37810f7c..4d3a0d57 100644 --- a/program/bindings/python/rrdtoolmodule.c +++ b/program/bindings/python/rrdtoolmodule.c @@ -407,14 +407,16 @@ static PyObject *PyDict_FromInfo( info_t *data) { PyObject *r; + r = PyDict_New(); - while (data){ + while (data) { PyObject *val = NULL; + switch (data->type) { case RD_I_VAL: - val = isnan(data->value.u_val) - ? (Py_INCREF(Py_None), Py_None) - : PyFloat_FromDouble(data->value.u_val); + val = isnan(data->value.u_val) + ? (Py_INCREF(Py_None), Py_None) + : PyFloat_FromDouble(data->value.u_val); break; case RD_I_CNT: val = PyLong_FromUnsignedLong(data->value.u_cnt); @@ -426,11 +428,13 @@ static PyObject *PyDict_FromInfo( val = PyString_FromString(data->value.u_str); break; case RD_I_BLO: - val = PyString_FromStringAndSize((char*)data->value.u_blo.ptr, data->value.u_blo.size); + val = + PyString_FromStringAndSize((char *) data->value.u_blo.ptr, + data->value.u_blo.size); break; } - if (val){ - PyDict_SetItemString(r,data->key,val); + if (val) { + PyDict_SetItemString(r, data->key, val); } data = data->next; } @@ -449,9 +453,9 @@ static PyObject *PyRRD_info( char **argv; info_t *data; - if (create_args("info", args, &argc, &argv) < 0) + if (create_args("info", args, &argc, &argv) < 0) return NULL; - + if ((data = rrd_info(argc, argv)) == NULL) { PyErr_SetString(ErrorObject, rrd_get_error()); rrd_clear_error(); @@ -474,9 +478,9 @@ static PyObject *PyRRD_graphv( char **argv; info_t *data; - if (create_args("graphv", args, &argc, &argv) < 0) + if (create_args("graphv", args, &argc, &argv) < 0) return NULL; - + if ((data = rrd_graph_v(argc, argv)) == NULL) { PyErr_SetString(ErrorObject, rrd_get_error()); rrd_clear_error(); @@ -499,9 +503,9 @@ static PyObject *PyRRD_updatev( char **argv; info_t *data; - if (create_args("updatev", args, &argc, &argv) < 0) + if (create_args("updatev", args, &argc, &argv) < 0) return NULL; - + if ((data = rrd_update_v(argc, argv)) == NULL) { PyErr_SetString(ErrorObject, rrd_get_error()); rrd_clear_error(); -- 2.30.2