From: Vivien Maisonneuve Date: Tue, 24 Jun 2014 06:28:59 +0000 (+0200) Subject: Renaming in _isl.c X-Git-Tag: 1.0~213 X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/commitdiff_plain/600e193f0f6ba62014cb5ac3d804504cb064b0ac?ds=inline;hp=f85fc6de63ea023ab1a6aa4f5ff4ca96c79e384d Renaming in _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; } diff --git a/pypol/isl.py b/pypol/isl.py index a295e9f..0b9a485 100644 --- a/pypol/isl.py +++ b/pypol/isl.py @@ -12,7 +12,7 @@ __all__ = [ libisl = ctypes.CDLL(ctypes.util.find_library('isl')) libisl.isl_printer_get_str.restype = ctypes.c_char_p -libisl.isl_dim_set = _isl.isl_dim_set +libisl.isl_dim_set = _isl.dim_set class IslObject: @@ -59,4 +59,4 @@ class BasicSet(IslObject): libisl.isl_basic_set_free(self) def constraints(self): - return _isl.isl_basic_set_constraints(self._ptr) + return _isl.basic_set_constraints(self._ptr)