[Python-checkins] cpython: Revert my commit 7ba176c2f558: "Avoid useless "++" at the end of functions

victor.stinner python-checkins at python.org
Fri May 27 16:47:02 CEST 2011


http://hg.python.org/cpython/rev/43ee5ebaa62e
changeset:   70436:43ee5ebaa62e
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Fri May 27 16:46:51 2011 +0200
summary:
  Revert my commit 7ba176c2f558: "Avoid useless "++" at the end of functions

Warnings found by the Clang Static Analyzer."

Most people prefer ++ at the end of functions.

files:
  Objects/setobject.c     |  2 +-
  Objects/unicodeobject.c |  2 +-
  Python/compile.c        |  6 +++---
  3 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/Objects/setobject.c b/Objects/setobject.c
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -616,7 +616,7 @@
     Py_UNICODE_COPY(u, PyUnicode_AS_UNICODE(listrepr)+1,
                        newsize-2);
     u += newsize-2;
-    *u = '}';
+    *u++ = '}';
     Py_DECREF(listrepr);
 
     if (Py_TYPE(so) != &PySet_Type) {
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -6474,7 +6474,7 @@
         }
     }
     /* 0-terminate the output string */
-    *output = '\0';
+    *output++ = '\0';
     Py_XDECREF(exc);
     Py_XDECREF(errorHandler);
     return 0;
diff --git a/Python/compile.c b/Python/compile.c
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -3744,11 +3744,11 @@
     a->a_lnotab_off += 2;
     if (d_bytecode) {
         *lnotab++ = d_bytecode;
-        *lnotab = d_lineno;
+        *lnotab++ = d_lineno;
     }
     else {      /* First line of a block; def stmt, etc. */
         *lnotab++ = 0;
-        *lnotab = d_lineno;
+        *lnotab++ = d_lineno;
     }
     a->a_lineno = i->i_lineno;
     a->a_lineno_off = a->a_offset;
@@ -3793,7 +3793,7 @@
     if (i->i_hasarg) {
         assert(size == 3 || size == 6);
         *code++ = arg & 0xff;
-        *code = arg >> 8;
+        *code++ = arg >> 8;
     }
     return 1;
 }

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


More information about the Python-checkins mailing list