10000 ENH: Add const qualifier to some arguments in ndarraytypes.h functions. · numpy-buildbot/numpy@56a5472 · GitHub
[go: up one dir, main page]

Skip to content

Commit 56a5472

Browse files
committed
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.
1 parent b20a013 commit 56a5472

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

numpy/core/include/numpy/ndarraytypes.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter);
14411441
*/
14421442

14431443
static NPY_INLINE int
1444-
PyArray_NDIM(PyArrayObject *arr)
1444+
PyArray_NDIM(const PyArrayObject *arr)
14451445
{
14461446
return ((PyArrayObject_fields *)arr)->nd;
14471447
}
@@ -1465,13 +1465,13 @@ PyArray_STRIDES(PyArrayObject *arr)
14651465
}
14661466

14671467
static NPY_INLINE npy_intp
1468-
PyArray_DIM(PyArrayObject *arr, int idim)
1468+
PyArray_DIM(const PyArrayObject *arr, int idim)
14691469
{
14701470
return ((PyArrayObject_fields *)arr)->dimensions[idim];
14711471
}
14721472

14731473
static NPY_INLINE npy_intp
1474-
PyArray_STRIDE(PyArrayObject *arr, int istride)
1474+
PyArray_STRIDE(const PyArrayObject *arr, int istride)
14751475
{
14761476
return ((PyArrayObject_fields *)arr)->strides[istride];
14771477
}
@@ -1489,31 +1489,31 @@ PyArray_DESCR(PyArrayObject *arr)
14891489
}
14901490

14911491
static NPY_INLINE int
1492-
PyArray_FLAGS(PyArrayObject *arr)
1492+
PyArray_FLAGS(const PyArrayObject *arr)
14931493
{
14941494
return ((PyArrayObject_fields *)arr)->flags;
14951495
}
14961496

14971497
static NPY_INLINE npy_intp
1498-
PyArray_ITEMSIZE(PyArrayObject *arr)
1498+
PyArray_ITEMSIZE(const PyArrayObject *arr)
14991499
{
15001500
return ((PyArrayObject_fields *)arr)->descr->elsize;
15011501
}
15021502

15031503
static NPY_INLINE int
1504-
PyArray_TYPE(PyArrayObject *arr)
1504+
PyArray_TYPE(const PyArrayObject *arr)
15051505
{
15061506
return ((PyArrayObject_fields *)arr)->descr->type_num;
15071507
}
15081508

15091509
static NPY_INLINE int
1510-
PyArray_CHKFLAGS(PyArrayObject *arr, int flags)
1510+
PyArray_CHKFLAGS(const PyArrayObject *arr, int flags)
15111511
{
15121512
return (PyArray_FLAGS(arr) & flags) == flags;
15131513
}
15141514

15151515
static NPY_INLINE PyObject *
1516-
PyArray_GETITEM(PyArrayObject *arr, char *itemptr)
1516+
PyArray_GETITEM(const PyArrayObject *arr, const char *itemptr)
15171517
{
15181518
return ((PyArrayObject_fields *)arr)->descr->f->getitem(
15191519
itemptr, arr);

0 commit comments

Comments
 (0)
0