From 169192e8184fe742c9694bb2ba9a545302a0fc44 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 10 Dec 2001 15:45:54 +0000 Subject: [PATCH] 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. --- Objects/stringobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 657b20093b9..992f3d95ec2 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -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;