summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Bourque <jay.bourque@continuum.io>2013-07-15 17:56:59 -0500
committerJay Bourque <jay.bourque@continuum.io>2013-08-16 16:39:32 -0500
commit6c249cd038d15a6be00f3d611bccdbcc0fa0ff5e (patch)
tree4bc74417062e8417c85ddedd1abbf17efe05c3fd
parenta4bb3bc1dc2e5c7114e77e4a92df04d57ee02c9b (diff)
downloadnumpy-6c249cd038d15a6be00f3d611bccdbcc0fa0ff5e.tar.gz
Move NpyIter_IterNextFunc call outside of loop
-rw-r--r--numpy/core/src/umath/ufunc_object.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index 327fc2f62..4f7fdd381 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -4883,6 +4883,7 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args)
int nop;
NpyIter *iter_buffer;
+ NpyIter_IterNextFunc *iternext;
npy_uint32 op_flags[NPY_MAXARGS];
int buffersize;
int errormask = 0;
@@ -5059,6 +5060,12 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args)
needs_api = NpyIter_IterationNeedsAPI(iter_buffer);
+ iternext = NpyIter_GetIterNext(iter_buffer, NULL);
+ if (iternext == NULL) {
+ NpyIter_Deallocate(iter_buffer);
+ goto fail;
+ }
+
/*
* Iterate over first and second operands and call ufunc
* for each pair of inputs
@@ -5066,7 +5073,6 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args)
i = iter->size;
while (i > 0)
{
- NpyIter_IterNextFunc *iternext;
char *dataptr[3];
char **buffer_dataptr;
@@ -5084,12 +5090,6 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args)
dataptr[2] = NULL;
}
- iternext = NpyIter_GetIterNext(iter_buffer, NULL);
- if (iternext == NULL) {
- NpyIter_Deallocate(iter_buffer);
- goto fail;
- }
-
/* Reset NpyIter data pointers which will trigger a buffer copy */
NpyIter_ResetBasePointers(iter_buffer, dataptr, NULL);
buffer_dataptr = NpyIter_GetDataPtrArray(iter_buffer);