Exemplo n.º 1
0
static PyObject *_ffi_new_with_allocator(PyObject *allocator, PyObject *args,
                                         PyObject *kwds)
{
    return _ffi_new((FFIObject *)PyTuple_GET_ITEM(allocator, 0),
                    args, kwds,
                    &PyTuple_GET_ITEM(allocator, 1));
}
Exemplo n.º 2
0
static PyObject *_ffi_new_with_allocator(PyObject *allocator, PyObject *args,
                                         PyObject *kwds)
{
    cffi_allocator_t alloc1;
    PyObject *my_alloc, *my_free;
    my_alloc = PyTuple_GET_ITEM(allocator, 1);
    my_free  = PyTuple_GET_ITEM(allocator, 2);
    alloc1.ca_alloc = (my_alloc == Py_None ? NULL : my_alloc);
    alloc1.ca_free  = (my_free  == Py_None ? NULL : my_free);
    alloc1.ca_dont_clear = (PyTuple_GET_ITEM(allocator, 3) == Py_False);

    return _ffi_new((FFIObject *)PyTuple_GET_ITEM(allocator, 0),
                    args, kwds, &alloc1);
}
Exemplo n.º 3
0
static PyObject *ffi_new(FFIObject *self, PyObject *args, PyObject *kwds)
{
    return _ffi_new(self, args, kwds, default_allocator);
}