summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2008-04-25 06:01:52 +0000
committerCharles Harris <charlesr.harris@gmail.com>2008-04-25 06:01:52 +0000
commitbbb83c0fe889e5b6c4eecda45b94617102d574f2 (patch)
treea05cf253c3184d614eb3d7bafe6842cb83d126a5 /numpy/core/src/arrayobject.c
parent8806030c6f06a39b830d029897fc539eea0d5a2b (diff)
downloadnumpy-bbb83c0fe889e5b6c4eecda45b94617102d574f2.tar.gz
Some cleanups
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r--numpy/core/src/arrayobject.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index 719bb5342..3d53325bc 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -4173,36 +4173,44 @@ dump_data(char **string, int *n, int *max_n, char *data, int nd,
if (nd == 0) {
- if ((op = descr->f->getitem(data, self)) == NULL) return -1;
+ if ((op = descr->f->getitem(data, self)) == NULL) {
+ return -1;
+ }
sp = PyObject_Repr(op);
- if (sp == NULL) {Py_DECREF(op); return -1;}
+ if (sp == NULL) {
+ Py_DECREF(op);
+ return -1;
+ }
ostring = PyString_AsString(sp);
N = PyString_Size(sp)*sizeof(char);
*n += N;
CHECK_MEMORY
- memmove(*string+(*n-N), ostring, N);
+ memmove(*string + (*n - N), ostring, N);
Py_DECREF(sp);
Py_DECREF(op);
return 0;
- } else {
+ }
+ else {
CHECK_MEMORY
(*string)[*n] = '[';
*n += 1;
- for(i=0; i<dimensions[0]; i++) {
+ for(i = 0; i < dimensions[0]; i++) {
if (dump_data(string, n, max_n,
- data+(*strides)*i,
- nd-1, dimensions+1,
- strides+1, self) < 0)
+ data + (*strides)*i,
+ nd - 1, dimensions + 1,
+ strides + 1, self) < 0) {
return -1;
+ }
CHECK_MEMORY
- if (i<dimensions[0]-1) {
+ if (i < dimensions[0] - 1) {
(*string)[*n] = ',';
(*string)[*n+1] = ' ';
*n += 2;
}
}
CHECK_MEMORY
- (*string)[*n] = ']'; *n += 1;
+ (*string)[*n] = ']';
+ *n += 1;
return 0;
}
@@ -4233,7 +4241,8 @@ array_repr_builtin(PyArrayObject *self, int repr)
if (dump_data(&string, &n, &max_n, self->data,
self->nd, self->dimensions,
self->strides, self) < 0) {
- _pya_free(string); return NULL;
+ _pya_free(string);
+ return NULL;
}
if (repr) {