Renaming in _isl.c
[linpy.git] / pypol / _isl.c
index 06f63fe..1b086dc 100644 (file)
@@ -3,33 +3,31 @@
 #include <isl/constraint.h>
 #include <isl/set.h>
 
-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;
     }