[Python-checkins] cpython: modsupport.c reuses Py_UNICODE_strlen()

victor.stinner python-checkins at python.org
Thu Sep 29 04:03:20 CEST 2011


http://hg.python.org/cpython/rev/204d9391889a
changeset:   72519:204d9391889a
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Thu Sep 29 04:01:43 2011 +0200
summary:
  modsupport.c reuses Py_UNICODE_strlen()

files:
  Python/modsupport.c |  11 +----------
  1 files changed, 1 insertions(+), 10 deletions(-)


diff --git a/Python/modsupport.c b/Python/modsupport.c
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -148,15 +148,6 @@
     return v;
 }
 
-static int
-_ustrlen(Py_UNICODE *u)
-{
-    int i = 0;
-    Py_UNICODE *v = u;
-    while (*v != 0) { i++; v++; }
-    return i;
-}
-
 static PyObject *
 do_mktuple(const char **p_format, va_list *p_va, int endchar, int n, int flags)
 {
@@ -269,7 +260,7 @@
             }
             else {
                 if (n < 0)
-                    n = _ustrlen(u);
+                    n = Py_UNICODE_strlen(u);
                 v = PyUnicode_FromUnicode(u, n);
             }
             return v;

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


More information about the Python-checkins mailing list