[Numpy-svn] r5081 - trunk/numpy/core/src

numpy-svn@scip... numpy-svn@scip...
Fri Apr 25 01:01:54 CDT 2008


Author: charris
Date: 2008-04-25 01:01:52 -0500 (Fri, 25 Apr 2008)
New Revision: 5081

Modified:
   trunk/numpy/core/src/arrayobject.c
Log:
Some cleanups


Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2008-04-25 03:01:33 UTC (rev 5080)
+++ trunk/numpy/core/src/arrayobject.c	2008-04-25 06:01:52 UTC (rev 5081)
@@ -4173,36 +4173,44 @@
 
     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 @@
     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) {



More information about the Numpy-svn mailing list