summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2012-02-11 19:18:18 -0700
committerCharles Harris <charlesr.harris@gmail.com>2012-02-16 19:31:26 -0700
commit56a54727433d38cc3e9187c029a0d2bcfdcfcc2f (patch)
treef2add6a144e9280be1421e0b51bcddbe9129bdce
parentb20a013ef99aadb87f7ce21648e1ebbc6623bd49 (diff)
downloadnumpy-56a54727433d38cc3e9187c029a0d2bcfdcfcc2f.tar.gz
ENH: Add const qualifier to some arguments in ndarraytypes.h functions.
Some of the new access functions in ndarraytypes.h can use the const qualifier. In particular, this avoids a lot of warnings when the code in f2py is updated to use non-deprecated means of accessing ndarray internals.
-rw-r--r--numpy/core/include/numpy/ndarraytypes.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h
index af09c69cd..64d5b30b5 100644
--- a/numpy/core/include/numpy/ndarraytypes.h
+++ b/numpy/core/include/numpy/ndarraytypes.h
@@ -1441,7 +1441,7 @@ PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter);
*/
static NPY_INLINE int
-PyArray_NDIM(PyArrayObject *arr)
+PyArray_NDIM(const PyArrayObject *arr)
{
return ((PyArrayObject_fields *)arr)->nd;
}
@@ -1465,13 +1465,13 @@ PyArray_STRIDES(PyArrayObject *arr)
}
static NPY_INLINE npy_intp
-PyArray_DIM(PyArrayObject *arr, int idim)
+PyArray_DIM(const PyArrayObject *arr, int idim)
{
return ((PyArrayObject_fields *)arr)->dimensions[idim];
}
static NPY_INLINE npy_intp
-PyArray_STRIDE(PyArrayObject *arr, int istride)
+PyArray_STRIDE(const PyArrayObject *arr, int istride)
{
return ((PyArrayObject_fields *)arr)->strides[istride];
}
@@ -1489,31 +1489,31 @@ PyArray_DESCR(PyArrayObject *arr)
}
static NPY_INLINE int
-PyArray_FLAGS(PyArrayObject *arr)
+PyArray_FLAGS(const PyArrayObject *arr)
{
return ((PyArrayObject_fields *)arr)->flags;
}
static NPY_INLINE npy_intp
-PyArray_ITEMSIZE(PyArrayObject *arr)
+PyArray_ITEMSIZE(const PyArrayObject *arr)
{
return ((PyArrayObject_fields *)arr)->descr->elsize;
}
static NPY_INLINE int
-PyArray_TYPE(PyArrayObject *arr)
+PyArray_TYPE(const PyArrayObject *arr)
{
return ((PyArrayObject_fields *)arr)->descr->type_num;
}
static NPY_INLINE int
-PyArray_CHKFLAGS(PyArrayObject *arr, int flags)
+PyArray_CHKFLAGS(const PyArrayObject *arr, int flags)
{
return (PyArray_FLAGS(arr) & flags) == flags;
}
static NPY_INLINE PyObject *
-PyArray_GETITEM(PyArrayObject *arr, char *itemptr)
+PyArray_GETITEM(const PyArrayObject *arr, const char *itemptr)
{
return ((PyArrayObject_fields *)arr)->descr->f->getitem(
itemptr, arr);