Skip to content

Commit

Permalink
STYLE: Replace NULL with nullptr in "Bridge/NumPy"
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Dekker committed Sep 27, 2024
1 parent f976818 commit 2e4f6a1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions Modules/Bridge/NumPy/include/itkPyBuffer.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ template <class TImage>
PyObject *
PyBuffer<TImage>::_GetArrayViewFromImage(ImageType * image)
{
PyObject * memoryView = NULL;
PyObject * memoryView = nullptr;
Py_buffer pyBuffer{};

Py_ssize_t len = 1;
Expand Down Expand Up @@ -58,7 +58,7 @@ PyBuffer<TImage>::_GetArrayViewFromImage(ImageType * image)
len *= numberOfComponents;
len *= sizeof(ComponentType);

res = PyBuffer_FillInfo(&pyBuffer, NULL, itkImageBuffer, len, 0, PyBUF_CONTIG);
res = PyBuffer_FillInfo(&pyBuffer, nullptr, itkImageBuffer, len, 0, PyBUF_CONTIG);
memoryView = PyMemoryView_FromBuffer(&pyBuffer);

PyBuffer_Release(&pyBuffer);
Expand All @@ -71,8 +71,8 @@ auto
PyBuffer<TImage>::_GetImageViewFromArray(PyObject * arr, PyObject * shape, PyObject * numOfComponent)
-> const OutputImagePointer
{
PyObject * shapeseq = NULL;
PyObject * item = NULL;
PyObject * shapeseq = nullptr;
PyObject * item = nullptr;

Py_buffer pyBuffer{};

Expand Down Expand Up @@ -111,7 +111,7 @@ PyBuffer<TImage>::_GetImageViewFromArray(PyObject * arr, PyObject * shape, PyObj
}

bool isFortranContiguous = false;
if (pyBuffer.strides != NULL && pyBuffer.itemsize == pyBuffer.strides[0])
if (pyBuffer.strides != nullptr && pyBuffer.itemsize == pyBuffer.strides[0])
{
isFortranContiguous = true;
}
Expand Down
10 changes: 5 additions & 5 deletions Modules/Bridge/NumPy/include/itkPyVectorContainer.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ template <typename TElementIdentifier, typename TElement>
PyObject *
PyVectorContainer<TElementIdentifier, TElement>::_array_view_from_vector_container(VectorContainerType * vector)
{
PyObject * memoryView = NULL;
PyObject * memoryView = nullptr;
Py_buffer pyBuffer{};

int res = 0;
Expand All @@ -45,7 +45,7 @@ PyVectorContainer<TElementIdentifier, TElement>::_array_view_from_vector_contain
Py_ssize_t len = vector->Size();
len *= sizeof(DataType);

res = PyBuffer_FillInfo(&pyBuffer, NULL, vectorBuffer, len, 0, PyBUF_CONTIG);
res = PyBuffer_FillInfo(&pyBuffer, nullptr, vectorBuffer, len, 0, PyBUF_CONTIG);
memoryView = PyMemoryView_FromBuffer(&pyBuffer);

PyBuffer_Release(&pyBuffer);
Expand All @@ -58,9 +58,9 @@ auto
PyVectorContainer<TElementIdentifier, TElement>::_vector_container_from_array(PyObject * arr, PyObject * shape) -> const
typename VectorContainerType::Pointer
{
PyObject * obj = NULL;
PyObject * shapeseq = NULL;
PyObject * item = NULL;
PyObject * obj = nullptr;
PyObject * shapeseq = nullptr;
PyObject * item = nullptr;

Py_buffer pyBuffer{};

Expand Down
20 changes: 10 additions & 10 deletions Modules/Bridge/NumPy/include/itkPyVnl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ template <class TElement>
PyObject *
PyVnl<TElement>::_GetArrayViewFromVnlVector(VectorType * vector)
{
PyObject * memoryView = NULL;
PyObject * memoryView = nullptr;
Py_buffer pyBuffer{};

int res = 0;
Expand All @@ -45,7 +45,7 @@ PyVnl<TElement>::_GetArrayViewFromVnlVector(VectorType * vector)
Py_ssize_t len = vector->size();
len *= sizeof(DataType);

res = PyBuffer_FillInfo(&pyBuffer, NULL, vectorBuffer, len, 0, PyBUF_CONTIG);
res = PyBuffer_FillInfo(&pyBuffer, nullptr, vectorBuffer, len, 0, PyBUF_CONTIG);
memoryView = PyMemoryView_FromBuffer(&pyBuffer);

PyBuffer_Release(&pyBuffer);
Expand All @@ -57,9 +57,9 @@ template <class TElement>
auto
PyVnl<TElement>::_GetVnlVectorFromArray(PyObject * arr, PyObject * shape) -> const VectorType
{
PyObject * obj = NULL;
PyObject * shapeseq = NULL;
PyObject * item = NULL;
PyObject * obj = nullptr;
PyObject * shapeseq = nullptr;
PyObject * item = nullptr;

Py_buffer pyBuffer{};

Expand Down Expand Up @@ -104,7 +104,7 @@ template <class TElement>
PyObject *
PyVnl<TElement>::_GetArrayViewFromVnlMatrix(MatrixType * matrix)
{
PyObject * memoryView = NULL;
PyObject * memoryView = nullptr;
Py_buffer pyBuffer{};

int res = 0;
Expand All @@ -122,7 +122,7 @@ PyVnl<TElement>::_GetArrayViewFromVnlMatrix(MatrixType * matrix)
Py_ssize_t len = matrix->size();
len *= sizeof(DataType);

res = PyBuffer_FillInfo(&pyBuffer, NULL, matrixBuffer, len, 0, PyBUF_CONTIG);
res = PyBuffer_FillInfo(&pyBuffer, nullptr, matrixBuffer, len, 0, PyBUF_CONTIG);
memoryView = PyMemoryView_FromBuffer(&pyBuffer);

PyBuffer_Release(&pyBuffer);
Expand All @@ -134,9 +134,9 @@ template <class TElement>
auto
PyVnl<TElement>::_GetVnlMatrixFromArray(PyObject * arr, PyObject * shape) -> const MatrixType
{
PyObject * obj = NULL;
PyObject * shapeseq = NULL;
PyObject * item = NULL;
PyObject * obj = nullptr;
PyObject * shapeseq = nullptr;
PyObject * item = nullptr;

Py_buffer pyBuffer{};

Expand Down

0 comments on commit 2e4f6a1

Please sign in to comment.