Skip to content

Commit 8d70f6d

Browse files
committed
STYLE: Remove unnecessary void * variables from PyVnl, PyVectorContainer
Passed the initial `buffer` variables directly to `PyBuffer_FillInfo`.
1 parent f1e84ce commit 8d70f6d

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

Modules/Bridge/NumPy/include/itkPyVectorContainer.hxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ PyVectorContainer<TElementIdentifier, TElement>::_array_view_from_vector_contain
3737

3838
DataType * buffer = vector->CastToSTLContainer().data();
3939

40-
void * vectorBuffer = buffer;
41-
4240
// Computing the length of data
4341
const auto len = static_cast<Py_ssize_t>(vector->size() * sizeof(DataType));
4442

45-
PyBuffer_FillInfo(&pyBuffer, nullptr, vectorBuffer, len, 0, PyBUF_CONTIG);
43+
PyBuffer_FillInfo(&pyBuffer, nullptr, buffer, len, 0, PyBUF_CONTIG);
4644
return PyMemoryView_FromBuffer(&pyBuffer);
4745
}
4846

Modules/Bridge/NumPy/include/itkPyVnl.hxx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ PyVnl<TElement>::_GetArrayViewFromVnlVector(VectorType * vector)
3737

3838
DataType * buffer = vector->data_block();
3939

40-
void * vectorBuffer = buffer;
41-
4240
// Computing the length of data
4341
const auto len = static_cast<Py_ssize_t>(vector->size() * sizeof(DataType));
4442

45-
PyBuffer_FillInfo(&pyBuffer, nullptr, vectorBuffer, len, 0, PyBUF_CONTIG);
43+
PyBuffer_FillInfo(&pyBuffer, nullptr, buffer, len, 0, PyBUF_CONTIG);
4644
return PyMemoryView_FromBuffer(&pyBuffer);
4745
}
4846

@@ -93,12 +91,10 @@ PyVnl<TElement>::_GetArrayViewFromVnlMatrix(MatrixType * matrix)
9391

9492
DataType * buffer = matrix->data_block();
9593

96-
void * matrixBuffer = buffer;
97-
9894
// Computing the length of data
9995
const auto len = static_cast<Py_ssize_t>(matrix->size() * sizeof(DataType));
10096

101-
PyBuffer_FillInfo(&pyBuffer, nullptr, matrixBuffer, len, 0, PyBUF_CONTIG);
97+
PyBuffer_FillInfo(&pyBuffer, nullptr, buffer, len, 0, PyBUF_CONTIG);
10298
return PyMemoryView_FromBuffer(&pyBuffer);
10399
}
104100

0 commit comments

Comments
 (0)