[Python-checkins] cpython: cleanup _Unpickler_SkipConsumed(): remove 1 level of indentation

victor.stinner python-checkins at python.org
Thu Oct 31 13:44:48 CET 2013


http://hg.python.org/cpython/rev/78b35cf9c024
changeset:   86796:78b35cf9c024
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Oct 31 13:38:42 2013 +0100
summary:
  cleanup _Unpickler_SkipConsumed(): remove 1 level of indentation

files:
  Modules/_pickle.c |  27 +++++++++++++++------------
  1 files changed, 15 insertions(+), 12 deletions(-)


diff --git a/Modules/_pickle.c b/Modules/_pickle.c
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -872,18 +872,21 @@
 static int
 _Unpickler_SkipConsumed(UnpicklerObject *self)
 {
-    Py_ssize_t consumed = self->next_read_idx - self->prefetched_idx;
-
-    if (consumed > 0) {
-        PyObject *r;
-        assert(self->peek);  /* otherwise we did something wrong */
-        /* This makes an useless copy... */
-        r = PyObject_CallFunction(self->read, "n", consumed);
-        if (r == NULL)
-            return -1;
-        Py_DECREF(r);
-        self->prefetched_idx = self->next_read_idx;
-    }
+    Py_ssize_t consumed;
+    PyObject *r;
+
+    consumed = self->next_read_idx - self->prefetched_idx;
+    if (consumed <= 0)
+        return 0;
+
+    assert(self->peek);  /* otherwise we did something wrong */
+    /* This makes an useless copy... */
+    r = PyObject_CallFunction(self->read, "n", consumed);
+    if (r == NULL)
+        return -1;
+    Py_DECREF(r);
+
+    self->prefetched_idx = self->next_read_idx;
     return 0;
 }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list