From 7c465730deb5663e4fa4d760a50306bb4912b6cb Mon Sep 17 00:00:00 2001 From: Jim Paris Date: Fri, 15 Mar 2013 17:34:29 -0400 Subject: [PATCH] Remove rocket.extract_pyobject --- nilmdb/server/rocket.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/nilmdb/server/rocket.c b/nilmdb/server/rocket.c index 92c01bd..a5e2736 100644 --- a/nilmdb/server/rocket.c +++ b/nilmdb/server/rocket.c @@ -438,41 +438,6 @@ static int _extract_handle_params(Rocket *self, PyObject *args, long *count) return 0; } -/* Helper for extracting data from a file as a Python object */ -static inline void *extract_pyobject(FILE *in, layout_type_t type) -{ - union8_t t8; - union16_t t16; - union32_t t32; - union64_t t64; - - switch (type) { -#define CASE(type, pyconvert, pytype, disktype, letoh, bytes) \ - case LAYOUT_TYPE_##type: \ - if (fread(&disktype, bytes, 1, in) <= 0) \ - break; \ - disktype = letoh(disktype); \ - return pyconvert(pytype); \ - break - CASE(INT8, PyInt_FromLong, t8.i, t8.u, , 1); - CASE(UINT8, PyInt_FromLong, t8.u, t8.u, , 1); - CASE(INT16, PyInt_FromLong, t16.i, t16.u, le16toh, 2); - CASE(UINT16, PyInt_FromLong, t16.u, t16.u, le16toh, 2); - CASE(INT32, PyInt_FromLong, t32.i, t32.u, le32toh, 4); - CASE(UINT32, PyInt_FromLong, t32.u, t32.u, le32toh, 4); - CASE(INT64, PyInt_FromLong, t64.i, t64.u, le64toh, 8); - CASE(UINT64, PyInt_FromLong, t64.u, t64.u, le64toh, 8); - CASE(FLOAT32, PyFloat_FromDouble, t32.f, t32.u, le32toh, 4); - CASE(FLOAT64, PyFloat_FromDouble, t64.d, t64.u, le64toh, 8); -#undef CASE - default: - PyErr_SetString(PyExc_TypeError, "unknown type"); - return NULL; - } - PyErr_SetString(PyExc_OSError, "failed to read from file"); - return NULL; -} - /**** * Extract to string */