[PATCH] obtain proper value type in python write callback=0A=

Gregory Szorc gregory.szorc at gmail.com
Mon Feb 28 23:32:25 CET 2011


=0A=
=0A=
Signed-off-by: Gregory Szorc <gregory.szorc at gmail.com>=0A=
---=0A=
 src/python.c |   10 +++++-----=0A=
 1 files changed, 5 insertions(+), 5 deletions(-)=0A=
=0A=
diff --git a/src/python.c b/src/python.c=0A=
index c056b5b..d5c2d46 100644=0A=
--- a/src/python.c=0A=
+++ b/src/python.c=0A=
@@ -345,26 +345,26 @@ static int cpy_write_callback(const data_set_t =
*ds, const value_list_t *value_li=0A=
 			CPY_RETURN_FROM_THREADS 0;=0A=
 		}=0A=
 		for (i =3D 0; i < value_list->values_len; ++i) {=0A=
-			if (ds->ds->type =3D=3D DS_TYPE_COUNTER) {=0A=
+			if (ds->ds[i].type =3D=3D DS_TYPE_COUNTER) {=0A=
 				if ((long) value_list->values[i].counter =3D=3D =
value_list->values[i].counter)=0A=
 					PyList_SetItem(list, i, =
PyInt_FromLong(value_list->values[i].counter));=0A=
 				else=0A=
 					PyList_SetItem(list, i, =
PyLong_FromUnsignedLongLong(value_list->values[i].counter));=0A=
-			} else if (ds->ds->type =3D=3D DS_TYPE_GAUGE) {=0A=
+			} else if (ds->ds[i].type =3D=3D DS_TYPE_GAUGE) {=0A=
 				PyList_SetItem(list, i, =
PyFloat_FromDouble(value_list->values[i].gauge));=0A=
-			} else if (ds->ds->type =3D=3D DS_TYPE_DERIVE) {=0A=
+			} else if (ds->ds[i].type =3D=3D DS_TYPE_DERIVE) {=0A=
 				if ((long) value_list->values[i].derive =3D=3D =
value_list->values[i].derive)=0A=
 					PyList_SetItem(list, i, =
PyInt_FromLong(value_list->values[i].derive));=0A=
 				else=0A=
 					PyList_SetItem(list, i, =
PyLong_FromLongLong(value_list->values[i].derive));=0A=
-			} else if (ds->ds->type =3D=3D DS_TYPE_ABSOLUTE) {=0A=
+			} else if (ds->ds[i].type =3D=3D DS_TYPE_ABSOLUTE) {=0A=
 				if ((long) value_list->values[i].absolute =3D=3D =
value_list->values[i].absolute)=0A=
 					PyList_SetItem(list, i, =
PyInt_FromLong(value_list->values[i].absolute));=0A=
 				else=0A=
 					PyList_SetItem(list, i, =
PyLong_FromUnsignedLongLong(value_list->values[i].absolute));=0A=
 			} else {=0A=
 				Py_BEGIN_ALLOW_THREADS=0A=
-				ERROR("cpy_write_callback: Unknown value type %d.", ds->ds->type);=0A=
+				ERROR("cpy_write_callback: Unknown value type %d.", ds->ds[i].type);=0A=
 				Py_END_ALLOW_THREADS=0A=
 				Py_DECREF(list);=0A=
 				CPY_RETURN_FROM_THREADS 0;=0A=
-- =0A=
1.7.4.1=0A=
=0A=

------=_NextPart_000_0546_01CBD75E.7A6BE4A0--




More information about the collectd mailing list