Commit 0749e99a authored by Guido van Rossum's avatar Guido van Rossum

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.
parent e8d2acf1
......@@ -144,7 +144,7 @@ PyString_FromString(const char *str)
#ifdef INTERN_STRINGS
op->ob_sinterned = NULL;
#endif
strcpy(op->ob_sval, str);
memcpy(op->ob_sval, str, size+1);
#ifndef DONT_SHARE_SHORT_STRINGS
if (size == 0) {
PyObject *t = (PyObject *)op;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment