mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
SF patch #491049 (David Jacobs): Small PyString_FromString optimization
PyString_FromString(): Since the length of the string is already being stored in size, changed the strcpy() to a memcpy() for a small speed improvement.
This commit is contained in:
parent
49bdaede1b
commit
169192e818
1 changed files with 1 additions and 1 deletions
|
@ -144,7 +144,7 @@ PyString_FromString(const char *str)
|
||||||
#ifdef INTERN_STRINGS
|
#ifdef INTERN_STRINGS
|
||||||
op->ob_sinterned = NULL;
|
op->ob_sinterned = NULL;
|
||||||
#endif
|
#endif
|
||||||
strcpy(op->ob_sval, str);
|
memcpy(op->ob_sval, str, size+1);
|
||||||
#ifndef DONT_SHARE_SHORT_STRINGS
|
#ifndef DONT_SHARE_SHORT_STRINGS
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
PyObject *t = (PyObject *)op;
|
PyObject *t = (PyObject *)op;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue