X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/blobdiff_plain/f85fc6de63ea023ab1a6aa4f5ff4ca96c79e384d..5a4b72c59f689a3eb67303c60a5d76a99d4b097c:/pypol/_isl.c diff --git a/pypol/_isl.c b/pypol/_isl.c index 06f63fe..1b086dc 100644 --- a/pypol/_isl.c +++ b/pypol/_isl.c @@ -3,33 +3,31 @@ #include #include -struct _isl_constraint_list { +struct pointer_list { int cursor; - PyObject *constraints; + PyObject *pointers; }; -typedef struct _isl_constraint_list _isl_constraint_list; +typedef struct pointer_list pointer_list; -static int _isl_isl_basic_set_add_constraint_list(__isl_take isl_constraint *c, - void *user) { - _isl_constraint_list *list; +static int pointer_list_append_constraint(isl_constraint *c, void *user) { + pointer_list *list; PyObject *value; - list = (_isl_constraint_list *) user; + list = (pointer_list *) user; value = PyLong_FromVoidPtr(c); if (value == NULL) { return -1; } - PyList_SET_ITEM(list->constraints, list->cursor++, value); + PyList_SET_ITEM(list->pointers, list->cursor++, value); return 0; } -static PyObject * _isl_isl_basic_set_constraints(PyObject *self, - PyObject* args) { +static PyObject * basic_set_constraints(PyObject *self, PyObject* args) { long ptr; isl_basic_set *bset; int n; - PyObject *constraints; - _isl_constraint_list *list; + PyObject *pointers; + pointer_list *list; if (!PyArg_ParseTuple(args, "l", &ptr)) return NULL; @@ -40,31 +38,31 @@ static PyObject * _isl_isl_basic_set_constraints(PyObject *self, "an error occurred in isl_basic_set_n_constraint"); return NULL; } - constraints = PyList_New(n); - if (constraints == NULL) { + pointers = PyList_New(n); + if (pointers == NULL) { return NULL; } - list = malloc(sizeof(_isl_constraint_list)); + list = malloc(sizeof(pointer_list)); if (list == NULL) { - Py_DECREF(constraints); + Py_DECREF(pointers); return PyErr_NoMemory(); } list->cursor = 0; - list->constraints = constraints; - n = isl_basic_set_foreach_constraint(bset, - _isl_isl_basic_set_add_constraint_list, list); + list->pointers = pointers; + n = isl_basic_set_foreach_constraint(bset, pointer_list_append_constraint, + list); free(list); if (n == -1) { PyErr_SetString(PyExc_RuntimeError, "an error occurred in isl_basic_set_foreach_constraint"); - Py_DECREF(constraints); + Py_DECREF(pointers); return NULL; } - return constraints; + return pointers; } static PyMethodDef _isl_methods[] = { - {"isl_basic_set_constraints", _isl_isl_basic_set_constraints, METH_VARARGS, NULL}, + {"basic_set_constraints", basic_set_constraints, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; @@ -83,7 +81,7 @@ PyMODINIT_FUNC PyInit__isl(void) { return NULL; } - if (PyModule_AddObject(m, "isl_dim_set", PyLong_FromLong(isl_dim_set)) == -1) { + if (PyModule_AddObject(m, "dim_set", PyLong_FromLong(isl_dim_set)) == -1) { return NULL; }