summaryrefslogtreecommitdiff
path: root/numpy/lib/src
diff options
context:
space:
mode:
authorDavid Warde-Farley <wardefar@iro.umontreal.ca>2011-09-20 17:27:53 -0400
committerDavid Warde-Farley <wardefar@iro.umontreal.ca>2011-09-20 17:27:53 -0400
commit214134f00dcd895582d80f9f09a961f8e33eb02c (patch)
tree973a0b16f684373529bb3e07fd6d310d86793f8a /numpy/lib/src
parent7d6ceb52c040df3f66e49b0ab11ec7b9108266fe (diff)
downloadnumpy-214134f00dcd895582d80f9f09a961f8e33eb02c.tar.gz
REF: simplify multi-loop breaking with a goto.
Diffstat (limited to 'numpy/lib/src')
-rw-r--r--numpy/lib/src/_compiled_base.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c
index 57a641b8c..58b9f5ecd 100644
--- a/numpy/lib/src/_compiled_base.c
+++ b/numpy/lib/src/_compiled_base.c
@@ -683,8 +683,10 @@ ravel_multi_index_loop(int ravel_ndim, npy_intp *ravel_dims,
j = *(npy_intp *)coords[i];
switch (modes[i]) {
case NPY_RAISE:
- if (j < 0 || j >= m)
+ if (j < 0 || j >= m) {
invalid = 1;
+ goto end_while;
+ }
break;
case NPY_WRAP:
if (j < 0) {
@@ -717,12 +719,10 @@ ravel_multi_index_loop(int ravel_ndim, npy_intp *ravel_dims,
coords[i] += coords_strides[i];
}
- if (invalid) {
- break;
- }
*(npy_intp *)coords[ravel_ndim] = raveled;
coords[ravel_ndim] += coords_strides[ravel_ndim];
}
+end_while:
NPY_END_ALLOW_THREADS;
if (invalid) {
PyErr_SetString(PyExc_ValueError,