Browse Source

Consolidate rocket._extract_handle.params with extract_string

tags/nilmdb-1.4.0
Jim Paris 11 years ago
parent
commit
b8d2cf1b78
1 changed files with 8 additions and 18 deletions
  1. +8
    -18
      nilmdb/server/rocket.c

+ 8
- 18
nilmdb/server/rocket.c View File

@@ -418,35 +418,25 @@ extra_data_on_line:
}

/****
* Extract to Python list
* Extract to string
*/

static int _extract_handle_params(Rocket *self, PyObject *args, long *count)
static PyObject *Rocket_extract_string(Rocket *self, PyObject *args)
{
long count;
long offset;
if (!PyArg_ParseTuple(args, "ll", &offset, count))
return -1;

if (!PyArg_ParseTuple(args, "ll", &offset, &count))
return NULL;
if (!self->file) {
PyErr_SetString(PyExc_Exception, "no file");
return -1;
return NULL;
}
/* Seek to target location */
if (fseek(self->file, offset, SEEK_SET) < 0) {
PyErr_SetFromErrno(PyExc_OSError);
return -1;
}
return 0;
}

/****
* Extract to string
*/

static PyObject *Rocket_extract_string(Rocket *self, PyObject *args)
{
long count;
if (_extract_handle_params(self, args, &count) < 0)
return NULL;
}

char *str = NULL, *new;
long len_alloc = 0;


Loading…
Cancel
Save