Browse Source

Remove rocket.extract_pyobject

tags/nilmdb-1.4.0
Jim Paris 10 years ago
parent
commit
7c465730de
1 changed files with 0 additions and 35 deletions
  1. +0
    -35
      nilmdb/server/rocket.c

+ 0
- 35
nilmdb/server/rocket.c View File

@@ -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
*/


Loading…
Cancel
Save