summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 81e21f0)
raw | patch | inline | side by side (parent: 81e21f0)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 5 Jun 2008 19:57:25 +0000 (19:57 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 5 Jun 2008 19:57:25 +0000 (19:57 +0000) |
bindings/python/rrdtoolmodule.c | patch | blob | history |
index 37810f7c08fc47edb560ba9cd08c19d74d6a490e..4d3a0d57e031d23f2af1d58eb69f0424e26114a8 100644 (file)
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);
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;
}
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();
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();
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();