[Python-checkins] r46079 - in python/trunk: Include/unicodeobject.h Objects/unicodeobject.c

Neal Norwitz nnorwitz at gmail.com
Tue May 23 07:28:37 CEST 2006


On 5/22/06, fredrik.lundh <python-checkins at python.org> wrote:
> Author: fredrik.lundh
> Date: Mon May 22 19:12:58 2006
> New Revision: 46079
>
> Modified:
>    python/trunk/Include/unicodeobject.h
>    python/trunk/Objects/unicodeobject.c
> Log:
> needforspeed: use memcpy for "long" strings; use a better algorithm
> for long repeats.
>
>
>
> Modified: python/trunk/Objects/unicodeobject.c
> ==============================================================================
> --- python/trunk/Objects/unicodeobject.c        (original)
> +++ python/trunk/Objects/unicodeobject.c        Mon May 22 19:12:58 2006
> @@ -5900,11 +5900,18 @@
>
>      if (str->length == 1 && len > 0) {
>          Py_UNICODE_FILL(p, str->str[0], len);
> -    } else
> -        while (len-- > 0) {
> +    } else {
> +       int done = 0; /* number of characters copied this far */
> +       if (done < nchars) {
>              Py_UNICODE_COPY(p, str->str, str->length);
> -            p += str->length;
> -        }
> +            done = str->length;

done looks like it should be a Py_ssize_t here (since setting to str->length).

n


More information about the Python-checkins mailing list