From 931a4a355aeb3a5f272af91258b848e81114febb Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Tue, 28 Feb 2006 21:58:27 +0000 Subject: Code cleanup --- numpy/core/src/arrayobject.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'numpy/core/src/arrayobject.c') diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 1cca1eebe..55abc36f0 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -4147,7 +4147,6 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) longlong offset=0; int fortran = 0; PyArrayObject *ret; - intp nb, off; buffer.ptr = NULL; /* Usually called with shape and type @@ -4185,36 +4184,35 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) } if (strides.ptr != NULL) { + intp nb, off; if (strides.len != dims.len) { PyErr_SetString(PyExc_ValueError, "strides, if given, must be " \ "the same length as shape"); goto fail; } - } - if (buffer.ptr == NULL) { - nb = 0; - off = 0; - } - else { - nb = buffer.len; - off = offset; - } - + if (buffer.ptr == NULL) { + nb = 0; + off = 0; + } + else { + nb = buffer.len; + off = offset; + } + - if (strides.ptr && \ - !PyArray_CheckStrides(itemsize, dims.len, - nb, off, - dims.ptr, strides.ptr)) { - PyErr_SetString(PyExc_ValueError, - "strides is incompatible " \ - "with shape of requested " \ - "array and size of buffer"); - goto fail; + if (!PyArray_CheckStrides(itemsize, dims.len, + nb, off, + dims.ptr, strides.ptr)) { + PyErr_SetString(PyExc_ValueError, + "strides is incompatible " \ + "with shape of requested " \ + "array and size of buffer"); + goto fail; + } } - - + if (buffer.ptr == NULL) { ret = (PyArrayObject *) \ PyArray_NewFromDescr(subtype, descr, -- cgit v1.2.1